summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKraant <kraant@gmail.com>2008-08-10 10:56:58 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-07 01:41:35 +0100
commit5554fdc59a308c46012f3afa16af60d66a00465e (patch)
treeb63163af124085383faa16ed1e8ec69364e8b7a0
parent8f1048c7b30631a1e3caca6aca7dcb63220b6fb7 (diff)
downloadmana-5554fdc59a308c46012f3afa16af60d66a00465e.tar.gz
mana-5554fdc59a308c46012f3afa16af60d66a00465e.tar.bz2
mana-5554fdc59a308c46012f3afa16af60d66a00465e.tar.xz
mana-5554fdc59a308c46012f3afa16af60d66a00465e.zip
Set headers for CURL so that proxies won't cache
Applied only to resources2.txt and news.txt. (cherry picked from commits 047f598be826dd57dd1124db914e8367256112be, cabf8905526b6601813573d049f6afaf364e1cac and 416e28057f5a6073a2ef44f296ed1c8bc1280bf6)
-rw-r--r--NEWS2
-rw-r--r--src/gui/updatewindow.cpp16
2 files changed, 18 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index ca1286f1..cc6fdff6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- Make sure news and update file list aren't cached (from Aethyra)
+
0.0.25 (27 July 2008)
- Added support for whispering to other players
- Added ability to ignore other players
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index ff1e600c..0d6b00af 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -315,6 +315,17 @@ int UpdaterWindow::downloadThread(void *ptr)
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15);
+ struct curl_slist *pHeaders = NULL;
+ if (uw->mDownloadStatus != UPDATE_RESOURCES)
+ {
+ // Make sure the resources2.txt and news.txt aren't cached,
+ // in order to always get the latest version.
+ pHeaders = curl_slist_append(pHeaders, "pragma: no-cache");
+ pHeaders =
+ curl_slist_append(pHeaders, "Cache-Control: no-cache");
+ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, pHeaders);
+ }
+
if ((res = curl_easy_perform(curl)) != 0)
{
uw->mDownloadStatus = UPDATE_ERROR;
@@ -339,6 +350,11 @@ int UpdaterWindow::downloadThread(void *ptr)
curl_easy_cleanup(curl);
+ if (uw->mDownloadStatus != UPDATE_RESOURCES)
+ {
+ curl_slist_free_all(pHeaders);
+ }
+
if (!uw->mStoreInMemory)
{
// Don't check resources2.txt checksum