WININET: take account of dwHeaderLength in HttpSendRequest (RESEND)
Mike McCormack
mike at codeweavers.com
Tue Aug 10 01:31:14 CDT 2004
Some garbage characters were getting into the HTTP request if
HttpSendRequest was called with a positive dwHeaderLength and a
lpszRequest that was not nul terminated.
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.76
diff -u -r1.76 http.c
--- dlls/wininet/http.c 9 Aug 2004 18:54:23 -0000 1.76
+++ dlls/wininet/http.c 10 Aug 2004 05:05:30 -0000
@@ -1536,14 +1536,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 == ~0UL )
+ 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