[1/2] wininet: Add support of INTERNET_FLAG_NO_CACHE_WRITE

Alexander Morozov amorozov at etersoft.ru
Fri Jul 4 03:15:57 CDT 2008


Add "Cache-Contol: no-cache" to HTTP header if HttpOpenRequest is called 
with "POST" and INTERNET_FLAG_NO_CACHE_WRITE
-------------- next part --------------
From 3bbfa55222e8bdd7d498e5136e5173f3fa24d576 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at etersoft.ru>
Date: Thu, 3 Jul 2008 16:34:08 +0400
Subject: [PATCH] wininet: Add support of INTERNET_FLAG_NO_CACHE_WRITE

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

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 970e502..813b963 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -74,6 +74,7 @@ static const WCHAR szProxy_Authorization[] = { 'P','r','o','x','y','-','A','u','
 static const WCHAR szStatus[] = { 'S','t','a','t','u','s',0 };
 static const WCHAR szKeepAlive[] = {'K','e','e','p','-','A','l','i','v','e',0};
 static const WCHAR szGET[] = { 'G','E','T', 0 };
+static const WCHAR szPOST[] = {'P','O','S','T',0};
 
 #define MAXHOSTNAME 100
 #define MAX_FIELD_VALUE_LEN 256
@@ -3181,6 +3182,14 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
         static const WCHAR pragma_nocache[] = {'P','r','a','g','m','a',':',' ','n','o','-','c','a','c','h','e','\r','\n',0};
         HTTP_HttpAddRequestHeadersW(lpwhr, pragma_nocache, strlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
     }
+    if ((lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) &&
+            CSTR_EQUAL == CompareStringW(LOCALE_SYSTEM_DEFAULT, 0,
+            lpwhr->lpszVerb, strlenW(lpwhr->lpszVerb), szPOST, strlenW(szPOST)))
+    {
+        static const WCHAR cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',':',
+                                              ' ','n','o','-','c','a','c','h','e','\r','\n',0};
+        HTTP_HttpAddRequestHeadersW(lpwhr, cache_control, strlenW(cache_control), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
+    }
 
     do
     {
-- 
1.5.4.5.GIT



More information about the wine-patches mailing list