Piotr Caban : wininet: Improve searching for no-store header in HTTP response.

Alexandre Julliard julliard at winehq.org
Wed Apr 24 13:45:58 CDT 2013


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Apr 24 11:23:18 2013 +0200

wininet: Improve searching for no-store header in HTTP response.

---

 dlls/wininet/http.c       |   27 ++++++++++++++++++++++++---
 dlls/wininet/tests/http.c |    2 +-
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 9f01d0c..c910c59 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2307,9 +2307,30 @@ static void create_cache_entry(http_request_t *req)
 
     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(header_idx != -1) {
+            WCHAR *ptr;
+
+            for(ptr=req->custHeaders[header_idx].lpszValue; *ptr; ) {
+                WCHAR *end;
+
+                while(*ptr==' ' || *ptr=='\t')
+                    ptr++;
+
+                end = strchrW(ptr, ',');
+                if(!end)
+                    end = ptr + strlenW(ptr);
+
+                if(!strncmpiW(ptr, no_cacheW, sizeof(no_cacheW)/sizeof(*no_cacheW)-1)
+                        || !strncmpiW(ptr, no_storeW, sizeof(no_storeW)/sizeof(*no_storeW)-1)) {
+                    b = FALSE;
+                    break;
+                }
+
+                ptr = end;
+                if(*ptr == ',')
+                    ptr++;
+            }
+        }
     }
 
     if(!b) {
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index fa01917..de7f354 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -2026,7 +2026,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
         }
         if (strstr(buffer, "GET /test_cache_control_no_store"))
         {
-            static const char no_cache_response[] = "HTTP/1.1 200 OK\r\nCache-Control: No-StOrE\r\n\r\nsome content";
+            static const char no_cache_response[] = "HTTP/1.1 200 OK\r\nCache-Control: junk, \t No-StOrE\r\n\r\nsome content";
             send(c, no_cache_response, sizeof(no_cache_response)-1, 0);
         }
         if (strstr(buffer, "GET /test_premature_disconnect"))




More information about the wine-cvs mailing list