From 1d9bb1c7b05d877f7dc2f8b537feada3f2c373a3 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sat, 6 Aug 2011 10:56:07 +0200 Subject: [PATCH] Use Cache-Control when --no-cache is specified. --- src/ChangeLog | 26 ++++++++++++++++---------- src/http.c | 8 +++++++- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b50e33f6..b998e98f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,13 @@ +2011-08-06 Giuseppe Scrivano + + * http.c (gethttp): Add the Cache-Control HTTP header when --no-cache + is specified. + Reported by: Коренберг Марк . + 2011-08-05 Giuseppe Scrivano - * utils.c (acceptable): Accept the file if it is the specified output - destination. + * utils.c (acceptable): Accept always the file if it is the specified + output destination. Reported by: Shai Berger 2011-08-05 Giuseppe Scrivano @@ -13,14 +19,14 @@ * cookies.c (parse_set_cookie): If the value is quoted, do not modify it. - Reported by: Nirgal Vourgère + Reported by: Nirgal Vourgère 2011-07-29 Giuseppe Scrivano * log.c (logprintf): Exit immediately on a SIGPIPE error. - Reported by: Noèl Köthe . + Reported by: Noèl Köthe . -2011-07-26 Carlos Martín Nieto (tiny change) +2011-07-26 Carlos Martín Nieto (tiny change) * init.c (home_dir): Allocate path buffer dinamically. @@ -109,7 +115,7 @@ SSL_pending. (openssl_peek): Make the call non-blocking. -2011-04-11 Cristian Rodríguez (tiny change) +2011-04-11 Cristian Rodríguez (tiny change) * openssl.c (ssl_init) [! OPENSSL_NO_SSL2]: Use SSLv2 only when available. @@ -1636,7 +1642,7 @@ * html-url.c, http.c: Avoid casts in a couple spots. -2008-05-30 Henri Häkkinen +2008-05-30 Henri Häkkinen * cookies.c, ftp-basic.c, hash.c, html-url.c, http-ntlm.c, http.c, init.c, log.c, main.c, progress.c, ptimer.c, spider.c, url.c, @@ -8627,7 +8633,7 @@ 2001-02-16 Dan Harkless - * init.c (commands): Hack Kampbjørn discovered + * init.c (commands): Hack Kampbjørn discovered that "httpsproxy" had been inserted into commands[] out of alphabetical order, causing "BUG: unknown command `httpuser'". @@ -8679,7 +8685,7 @@ characters. (skip_uname): Ditto. -2001-02-11 Hack Kampbjørn +2001-02-11 Hack Kampbjørn * url.c (parseurl): Debug-print u->ftp_type. @@ -8787,7 +8793,7 @@ 2000-12-30 Dan Harkless - * ftp.c, http.c: Applied Hack Kampbjørn 's + * ftp.c, http.c: Applied Hack Kampbjørn 's patch to deal with h_errno not being defined in netdb.h under Cygwin. 2000-12-18 Csaba Raduly diff --git a/src/http.c b/src/http.c index 1aa9ef02..247ba674 100644 --- a/src/http.c +++ b/src/http.c @@ -1619,7 +1619,13 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy, request_set_header (req, "Referer", (char *) hs->referer, rel_none); if (*dt & SEND_NOCACHE) - request_set_header (req, "Pragma", "no-cache", rel_none); + { + /* Cache-Control MUST be obeyed by all HTTP/1.1 caching mechanisms... */ + request_set_header (req, "Cache-Control", "no-cache, must-revalidate", rel_none); + + /* ... but some HTTP/1.0 caches doesn't implement Cache-Control. */ + request_set_header (req, "Pragma", "no-cache", rel_none); + } if (hs->restval && !opt.timestamping) request_set_header (req, "Range", aprintf ("bytes=%s-", -- 2.39.2