resend http.c: handle HTTP_QUERY_CUSTOM

Aric Stewart aric at codeweavers.com
Wed Dec 7 13:19:43 CST 2005


in HttpQueryInfo if dwInfoLevel includes HTTP_QUERY_CUSTOM then lpBuffer 
is In/Out because the header we are querying is there. Additionally 
standard headers can be queried in this manner as well (such as Set-Cookie)
-------------- next part --------------
Index: dlls/wininet/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/http.c,v
retrieving revision 1.132
diff -u -r1.132 http.c
--- dlls/wininet/http.c	3 Dec 2005 18:35:15 -0000	1.132
+++ dlls/wininet/http.c	7 Dec 2005 19:08:47 -0000
@@ -102,6 +102,7 @@
 static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl,
         LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD
         dwOptionalLength, DWORD dwContentLength);
+static INT HTTP_GetStdHeaderIndex(LPCWSTR lpszField);
 
 /***********************************************************************
  *           HTTP_Tokenize (internal)
@@ -1161,9 +1162,14 @@
         INT index = HTTP_GetCustomHeaderIndex(lpwhr, (LPWSTR)lpBuffer);
 
         if (index < 0)
-            return bSuccess;
+            index = HTTP_GetStdHeaderIndex(lpBuffer);
+        else
+            lphttpHdr = &lpwhr->pCustHeaders[index];
 
-        lphttpHdr = &lpwhr->pCustHeaders[index];
+        if (index < 0)
+            return bSuccess;
+        else
+            lphttpHdr = &lpwhr->StdHeaders[index];
     }
     else
     {
@@ -1285,7 +1291,7 @@
             (*lpdwIndex)++;
 	    }
     }
-    else
+    else if (lphttpHdr->lpszValue)
     {
         DWORD len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR);
 
@@ -1475,6 +1481,9 @@
 
     len = (*lpdwBufferLength)*sizeof(WCHAR);
     bufferW = HeapAlloc( GetProcessHeap(), 0, len );
+    /* buffer is in/out because of HTTP_QUERY_CUSTOM */
+    if ((dwInfoLevel & HTTP_QUERY_HEADER_MASK) == HTTP_QUERY_CUSTOM)
+        MultiByteToWideChar(CP_ACP,0,lpBuffer,-1,bufferW,len);
     result = HttpQueryInfoW( hHttpRequest, dwInfoLevel, bufferW,
                            &len, lpdwIndex );
     if( result )



More information about the wine-patches mailing list