diff options
author | Dave Beckett <dave@dajobe.org> | 2008-02-24 01:40:45 +0000 |
---|---|---|
committer | Dave Beckett <dave@dajobe.org> | 2008-02-24 01:40:45 +0000 |
commit | e2da3bb496ff061b39428c24f80950885ad04908 (patch) | |
tree | 682cb0945e53bf4676fc659a167f3fb306eadbab /src/raptor_www_curl.c | |
parent | 0d52c44293b44a370571bd0d9a6fa013a5ca5c0d (diff) | |
download | raptor-e2da3bb496ff061b39428c24f80950885ad04908.tar.gz |
Add RAPTOR_FEATURE_WWW_HTTP_CACHE_CONTROL and RAPTOR_FEATURE_WWW_HTTP_USER_AGENT to control WWW. Pass that on in parsers to internal www. raptor_www struct gains cache_control and user_agent fields. (raptor_www_curl_fetch): Disable curl www Pragma: header always. (raptor_www_set_http_cache_control): Added. (raptor_www_set_user_agent, raptor_www_set_proxy): Error checking on malloc failure. Fixes bug http://bugs.librdf.org/mantis/view.php?id=252
Diffstat (limited to 'src/raptor_www_curl.c')
-rw-r--r-- | src/raptor_www_curl.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/raptor_www_curl.c b/src/raptor_www_curl.c index 244587a5..96f77e5a 100644 --- a/src/raptor_www_curl.c +++ b/src/raptor_www_curl.c @@ -2,7 +2,7 @@ * * raptor_www_curl.c - Raptor WWW retrieval via libcurl * - * Copyright (C) 2003-2007, David Beckett http://purl.org/net/dajobe/ + * Copyright (C) 2003-2008, David Beckett http://purl.org/net/dajobe/ * Copyright (C) 2003-2004, University of Bristol, UK http://www.bristol.ac.uk/ * * This package is Free Software and part of Redland http://librdf.org/ @@ -186,12 +186,16 @@ raptor_www_curl_fetch(raptor_www *www) if(www->user_agent) curl_easy_setopt(www->curl_handle, CURLOPT_USERAGENT, www->user_agent); - /* Insert HTTP Accept: header only */ - if(www->http_accept) { + if(www->http_accept) slist=curl_slist_append(slist, (const char*)www->http_accept); + + /* ALWAYS disable curl default "Pragma: no-cache" */ + slist=curl_slist_append(slist, "Pragma:"); + if(www->cache_control) + slist=curl_slist_append(slist, (const char*)www->cache_control); + + if(slist) curl_easy_setopt(www->curl_handle, CURLOPT_HTTPHEADER, slist); - } - /* specify URL to get */ curl_easy_setopt(www->curl_handle, CURLOPT_URL, |