Aric Stewart : wininet: Handle HTTP_QUERY_CUSTOM.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 8 07:06:15 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 7bca41a739a1f1bfb4f83ebea46355ac94b902b0
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=7bca41a739a1f1bfb4f83ebea46355ac94b902b0

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Dec  8 12:44:45 2005 +0100

wininet: Handle HTTP_QUERY_CUSTOM.
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).

---

 dlls/wininet/http.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index ffa5414..f35e2ae 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -102,6 +102,7 @@ static BOOL WINAPI HTTP_HttpQueryInfoW( 
 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 @@ static BOOL WINAPI HTTP_HttpQueryInfoW( 
         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 @@ static BOOL WINAPI HTTP_HttpQueryInfoW( 
             (*lpdwIndex)++;
 	    }
     }
-    else
+    else if (lphttpHdr->lpszValue)
     {
         DWORD len = (strlenW(lphttpHdr->lpszValue) + 1) * sizeof(WCHAR);
 
@@ -1475,6 +1481,9 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHt
 
     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-cvs mailing list