Piotr Caban : wininet: Don't create cache file if it's forbidden.

Alexandre Julliard julliard at winehq.org
Wed Mar 13 17:10:07 CDT 2013


Module: wine
Branch: master
Commit: bbbc6d119bd353a71dc475d61358372342a388b8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bbbc6d119bd353a71dc475d61358372342a388b8

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Mar 13 17:05:41 2013 +0100

wininet: Don't create cache file if it's forbidden.

---

 dlls/wininet/http.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index a019095..a3f68ae 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2261,15 +2261,35 @@ static void commit_cache_entry(http_request_t *req)
 
 static void create_cache_entry(http_request_t *req)
 {
+    static const WCHAR no_cacheW[] = {'n','o','-','c','a','c','h','e',0};
+    static const WCHAR no_storeW[] = {'n','o','-','s','t','o','r','e',0};
+
     WCHAR url[INTERNET_MAX_URL_LENGTH];
     WCHAR file_name[MAX_PATH+1];
-    BOOL b;
+    BOOL b = TRUE;
 
     /* FIXME: We should free previous cache file earlier */
     heap_free(req->cacheFile);
     CloseHandle(req->hCacheFile);
     req->hCacheFile = NULL;
 
+    if(req->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE)
+        b = FALSE;
+
+    if(b) {
+        int header_idx = HTTP_GetCustomHeaderIndex(req, szCache_Control, 0, FALSE);
+        if(header_idx!=-1 && (!strcmpiW(req->custHeaders[header_idx].lpszValue, no_cacheW)
+                    || !strcmpiW(req->custHeaders[header_idx].lpszValue, no_storeW)))
+            b = FALSE;
+    }
+
+    if(!b) {
+        if(!(req->hdr.dwFlags & INTERNET_FLAG_NEED_FILE))
+            return;
+
+        FIXME("INTERNET_FLAG_NEED_FILE is not supported correctly\n");
+    }
+
     b = HTTP_GetRequestURL(req, url);
     if(!b) {
         WARN("Could not get URL\n");




More information about the wine-cvs mailing list