mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 14:17:58 +00:00
winhttp: Don't make a copy of the string in add_request_headers().
This commit is contained in:
parent
6a84877cc2
commit
7cd30faabe
1 changed files with 4 additions and 8 deletions
|
@ -455,23 +455,20 @@ DWORD process_header( struct request *request, const WCHAR *field, const WCHAR *
|
|||
DWORD add_request_headers( struct request *request, const WCHAR *headers, DWORD len, DWORD flags )
|
||||
{
|
||||
DWORD ret = ERROR_WINHTTP_INVALID_HEADER;
|
||||
WCHAR *buffer, *p, *q;
|
||||
struct header *header;
|
||||
const WCHAR *p, *q;
|
||||
|
||||
if (len == ~0u) len = lstrlenW( headers );
|
||||
if (!len) return ERROR_SUCCESS;
|
||||
if (!(buffer = malloc( (len + 1) * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
|
||||
memcpy( buffer, headers, len * sizeof(WCHAR) );
|
||||
buffer[len] = 0;
|
||||
|
||||
p = buffer;
|
||||
p = headers;
|
||||
do
|
||||
{
|
||||
const WCHAR *end;
|
||||
|
||||
if (!*p) break;
|
||||
if (p >= headers + len) break;
|
||||
|
||||
for (q = p; *q && *q != '\r' && *q != '\n'; ++q)
|
||||
for (q = p; q < headers + len && *q != '\r' && *q != '\n'; ++q)
|
||||
;
|
||||
end = q;
|
||||
while (*q == '\r' || *q == '\n')
|
||||
|
@ -485,7 +482,6 @@ DWORD add_request_headers( struct request *request, const WCHAR *headers, DWORD
|
|||
p = q;
|
||||
} while (!ret);
|
||||
|
||||
free( buffer );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue