Commit 788f588f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Set last error for invalid and unimplemented header queries.

parent d6a80a48
......@@ -746,9 +746,15 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
return ret;
default:
if (attr >= ARRAY_SIZE(attribute_table) || !attribute_table[attr])
if (attr >= ARRAY_SIZE(attribute_table))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (!attribute_table[attr])
{
FIXME("attribute %u not implemented\n", attr);
SetLastError( ERROR_WINHTTP_HEADER_NOT_FOUND );
return FALSE;
}
TRACE("attribute %s\n", debugstr_w(attribute_table[attr]));
......
......@@ -456,6 +456,14 @@ static void test_WinHttpSendRequest (void)
"Expected ERROR_SUCCESS got %u.\n", GetLastError());
ok(ret == TRUE, "WinHttpReceiveResponse failed: %u.\n", GetLastError());
SetLastError(0xdeadbeef);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_ORIG_URI, NULL, NULL, &len, NULL);
ok(!ret && GetLastError() == ERROR_WINHTTP_HEADER_NOT_FOUND, "got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_MAX + 1, NULL, NULL, &len, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %u\n", GetLastError());
bytes_rw = -1;
ret = WinHttpReadData(request, buffer, sizeof(buffer) - 1, &bytes_rw);
ok(ret == TRUE, "WinHttpReadData failed: %u.\n", GetLastError());
......
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