[grits] Fix caching bugs with some http servers



commit 75df11f7088dac5301deec551d7458d9572f1848
Author: Andy Spencer <andy753421 gmail com>
Date:   Mon Feb 14 05:26:29 2011 +0000

    Fix caching bugs with some http servers
    
    Some server (e.g. weather.gov) send old versions of index files which
    causes grits_http_available to return incorrect information.
    
    Setting `Cache-Control: max-age=0' fixes this.

 src/data/grits-http.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/data/grits-http.c b/src/data/grits-http.c
index c4b4484..943441d 100644
--- a/src/data/grits-http.c
+++ b/src/data/grits-http.c
@@ -179,6 +179,9 @@ gchar *grits_http_fetch(GritsHttp *http, const gchar *uri, const char *local,
 			g_error("message is null, cannot parse uri");
 		g_signal_connect(message, "got-chunk", G_CALLBACK(_chunk_cb), &info);
 		soup_message_headers_set_range(message->request_headers, ftell(fp), -1);
+		if (mode == GRITS_REFRESH)
+			soup_message_headers_replace(message->request_headers,
+					"Cache-Control", "max-age=0");
 		soup_session_send_message(http->soup, message);
 
 		/* Close file */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]