wininet: HTTP_HttpAddRequestHeadersW should ignore 0-length headers.

This commit is contained in:
Paul TBBle Hampson 2009-04-25 02:31:06 +10:00 committed by Alexandre Julliard
parent 01a83cde55
commit 4d57ee3409
2 changed files with 7 additions and 2 deletions

View File

@ -610,6 +610,13 @@ static BOOL HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr,
lpszEnd += 2; /* Jump over \r\n */
}
TRACE("interpreting header %s\n", debugstr_w(lpszStart));
if (*lpszStart == '\0')
{
/* Skip 0-length headers */
lpszStart = lpszEnd;
bSuccess = TRUE;
continue;
}
pFieldAndValue = HTTP_InterpretHttpHeader(lpszStart);
if (pFieldAndValue)
{

View File

@ -1275,7 +1275,6 @@ static void HttpHeaders_test(void)
ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
/* Ensure that blank headers are ignored and don't cause a failure */
todo_wine{
ok(HttpAddRequestHeaders(hRequest,"\r\nBlankTest:value\r\n\r\n",-1, HTTP_ADDREQ_FLAG_ADD_IF_NEW), "Failed to add header with blank entries in list\n");
index = 0;
@ -1284,7 +1283,6 @@ static void HttpHeaders_test(void)
ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
ok(index == 1, "Index was not incremented\n");
ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
}
ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
done: