Commit abfa73b5 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

wininet: Document HttpAddRequestHeadersW()'s handling of the trailing '\0'. Fix…

wininet: Document HttpAddRequestHeadersW()'s handling of the trailing '\0'. Fix tracing of the corresponding header strings as they may not be '\0' terminated.
parent 7a585f3c
...@@ -594,7 +594,7 @@ static BOOL WINAPI HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr, ...@@ -594,7 +594,7 @@ static BOOL WINAPI HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr,
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
DWORD len; DWORD len;
TRACE("copying header: %s\n", debugstr_w(lpszHeader)); TRACE("copying header: %s\n", debugstr_wn(lpszHeader, dwHeaderLength));
if( dwHeaderLength == ~0U ) if( dwHeaderLength == ~0U )
len = strlenW(lpszHeader); len = strlenW(lpszHeader);
...@@ -650,6 +650,12 @@ static BOOL WINAPI HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr, ...@@ -650,6 +650,12 @@ static BOOL WINAPI HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr,
* *
* Adds one or more HTTP header to the request handler * Adds one or more HTTP header to the request handler
* *
* NOTE
* On Windows if dwHeaderLength includes the trailing '\0', then
* HttpAddRequestHeadersW() adds it too. However this results in an
* invalid Http header which is rejected by some servers so we probably
* don't need to match Windows on that point.
*
* RETURNS * RETURNS
* TRUE on success * TRUE on success
* FALSE on failure * FALSE on failure
...@@ -661,8 +667,7 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, ...@@ -661,8 +667,7 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest,
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
LPWININETHTTPREQW lpwhr; LPWININETHTTPREQW lpwhr;
TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_w(lpszHeader), dwHeaderLength, TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_wn(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier);
dwModifier);
if (!lpszHeader) if (!lpszHeader)
return TRUE; return TRUE;
...@@ -698,8 +703,7 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, ...@@ -698,8 +703,7 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest,
LPWSTR hdr; LPWSTR hdr;
BOOL r; BOOL r;
TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_a(lpszHeader), dwHeaderLength, TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_an(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier);
dwModifier);
len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 ); len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 );
hdr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); hdr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment