Commit 1bf936c9 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Replacing a header with an empty value deletes it.

parent cf380c9c
......@@ -6062,7 +6062,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
{
HTTP_DeleteCustomHeader( request, index );
if (value)
if (value && value[0])
{
HTTPHEADERW hdr;
......
......@@ -1759,6 +1759,27 @@ static void HttpHeaders_test(void)
ok(index == 1, "Index was not incremented\n");
ok(strcmp(buffer,"value3")==0, "incorrect string was returned(%s)\n",buffer);
ok(HttpAddRequestHeaders(hRequest, "Authorization: Basic\r\n", -1, HTTP_ADDREQ_FLAG_ADD),
"unable to add header %u\n", GetLastError());
index = 0;
buffer[0] = 0;
len = sizeof(buffer);
ok(HttpQueryInfo(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index),
"unable to query header %u\n", GetLastError());
ok(index == 1, "index was not incremented\n");
ok(!strcmp(buffer, "Basic"), "incorrect string was returned (%s)\n", buffer);
ok(HttpAddRequestHeaders(hRequest, "Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE),
"unable to remove header %u\n", GetLastError());
index = 0;
len = sizeof(buffer);
SetLastError(0xdeadbeef);
ok(!HttpQueryInfo(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index),
"header still present\n");
ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "got %u\n", GetLastError());
ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
done:
ok(InternetCloseHandle(hConnect), "Close connect handle failed\n");
......
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