aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2004-12-06 04:00:03 +0000
committerJason Woodward2004-12-06 04:00:03 +0000
commit09b72defcfe47ed8a1b7fc93f1706e54ef9437e6 (patch)
tree7025e27c68aebd0e8d8b4797471f4ee862de4e14 /src
parent594c53e8583ecc8dac71b0c30fd3dc72bff727aa (diff)
downloadslapt-get-09b72defcfe47ed8a1b7fc93f1706e54ef9437e6.tar.gz
disabled default header of "Pragma: no-cache" for users behind web proxy
Diffstat (limited to 'src')
-rw-r--r--src/curl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/curl.c b/src/curl.c
index f5db6da..0bdc8d2 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -24,6 +24,7 @@ int download_data(FILE *fh,const char *url,size_t bytes,int use_curl_dl_stats){
CURLcode response;
char curl_err_buff[1024];
int return_code = 0;
+ struct curl_slist *headers = NULL;
#if DEBUG == 1
printf(_("Fetching url:[%s]\n"),url);
@@ -39,6 +40,8 @@ int download_data(FILE *fh,const char *url,size_t bytes,int use_curl_dl_stats){
#endif
curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1);
+ headers = curl_slist_append(headers, "Pragma: "); /* override no-cache */
+
if( use_curl_dl_stats != 1 ){
curl_easy_setopt(ch, CURLOPT_PROGRESSFUNCTION, progress_callback );
curl_easy_setopt(ch, CURLOPT_PROGRESSDATA, &bytes);
@@ -72,6 +75,7 @@ int download_data(FILE *fh,const char *url,size_t bytes,int use_curl_dl_stats){
curl_easy_cleanup(ch);
/* can't do a curl_free() after curl_easy_cleanup() */
/* curl_free(ch); */
+ curl_slist_free_all(headers);
return return_code;
}
@@ -96,6 +100,7 @@ char *head_request(const char *url){
CURL *ch = NULL;
CURLcode response;
struct head_data_t head_t;
+ struct curl_slist *headers = NULL;
head_t.data = malloc( sizeof *head_t.data );
head_t.size = 0;
@@ -114,13 +119,17 @@ char *head_request(const char *url){
#endif
curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1);
+ headers = curl_slist_append(headers, "Pragma: "); /* override no-cache */
+
if( (response = curl_easy_perform(ch)) != 0 ){
free(head_t.data);
curl_easy_cleanup(ch);
+ curl_slist_free_all(headers);
return NULL;
}
curl_easy_cleanup(ch);
+ curl_slist_free_all(headers);
return head_t.data;
}