WININET: take account of dwHeaderLength in HttpSendRequest
Mike McCormack
mike at codeweavers.com
Tue Aug 3 09:03:34 CDT 2004
Dmitry Timoshkov wrote:
>>+ if( dwHeaderLength < 0 )
> (dwHeaderLength < 0) is an always true condition, since dwHeaderLength is DWORD,
> i.e. unsigned long.
Does this look better? Strange I didn't get a compiler warning from that...
Mike
ChangeLog:
* take account of dwHeaderLength in HttpSendRequest
-------------- next part --------------
Index: dlls/wininet/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/http.c,v
retrieving revision 1.75
diff -u -r1.75 http.c
--- dlls/wininet/http.c 22 Jul 2004 20:36:36 -0000 1.75
+++ dlls/wininet/http.c 3 Aug 2004 12:42:25 -0000
@@ -1537,14 +1537,17 @@
}
/* add the headers the caller supplied */
- if( lpszHeaders )
+ if( lpszHeaders && dwHeaderLength )
{
- len = strlenW(lpszHeaders)+3;
- szCookedHeaders = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR)*len );
- strcpyW( szCookedHeaders, lpszHeaders );
+ if( dwHeaderLength == -1L )
+ len = strlenW(lpszHeaders);
+ else
+ len = dwHeaderLength;
+ szCookedHeaders = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR)*(len+1) );
+ strncpyW( szCookedHeaders, lpszHeaders, len );
- /* make sure there's exactly one linebreak at the end of the string */
- p = &szCookedHeaders[len-4];
+ /* make sure there's no linebreaks at the end of the string */
+ p = &szCookedHeaders[len-1];
while( (szCookedHeaders <= p) && ((*p == '\n') || (*p == '\r')) )
p--;
p[1] = 0;
More information about the wine-patches
mailing list