]> Pileus Git - grits/commitdiff
Fix caching bugs with some http servers
authorAndy Spencer <andy753421@gmail.com>
Mon, 14 Feb 2011 05:26:29 +0000 (05:26 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 14 Feb 2011 05:26:29 +0000 (05:26 +0000)
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

index c4b4484faa7250f88c805b76f87a2bde7d33e16d..943441dfa55a892521c05c873ceb19c9dc137b6d 100644 (file)
@@ -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 */