winhttp: Implement WinHttpQueryHeaders.

This commit is contained in:
Hans Leidekker 2008-08-20 11:36:23 +02:00 committed by Alexandre Julliard
parent 8f1d818bf3
commit f14b6afb9c
3 changed files with 267 additions and 138 deletions

View File

@ -164,18 +164,6 @@ BOOL WINAPI WinHttpWriteData (HINTERNET hRequest, LPCVOID lpBuffer,
return FALSE;
}
/***********************************************************************
* WinHttpQueryHeaders (winhttp.@)
*/
BOOL WINAPI WinHttpQueryHeaders (HINTERNET hRequest, DWORD dwInfoLevel, LPCWSTR pwszName,
LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
{
FIXME("(%d): stub\n", dwInfoLevel);
SetLastError(ERROR_NOT_SUPPORTED);
return FALSE;
}
BOOL WINAPI InternetCrackUrlW( LPCWSTR, DWORD, DWORD, LPURL_COMPONENTSW );
BOOL WINAPI InternetCreateUrlW( LPURL_COMPONENTS, DWORD, LPWSTR, LPDWORD );

View File

@ -318,3 +318,198 @@ BOOL WINAPI WinHttpAddRequestHeaders( HINTERNET hrequest, LPCWSTR headers, DWORD
release_object( &request->hdr );
return ret;
}
static WCHAR *build_request_string( request_t *request, LPCWSTR verb, LPCWSTR path, LPCWSTR version )
{
static const WCHAR space[] = {' ',0};
static const WCHAR crlf[] = {'\r','\n',0};
static const WCHAR colon[] = {':',' ',0};
static const WCHAR twocrlf[] = {'\r','\n','\r','\n',0};
WCHAR *ret;
const WCHAR **headers, **p;
unsigned int len, i = 0, j;
/* allocate space for an array of all the string pointers to be added */
len = request->num_headers * 4 + 7;
if (!(headers = heap_alloc( len * sizeof(LPCWSTR) ))) return NULL;
headers[i++] = verb;
headers[i++] = space;
headers[i++] = path;
headers[i++] = space;
headers[i++] = version;
for (j = 0; j < request->num_headers; j++)
{
if (request->headers[j].is_request)
{
headers[i++] = crlf;
headers[i++] = request->headers[j].field;
headers[i++] = colon;
headers[i++] = request->headers[j].value;
TRACE("adding header %s (%s)\n", debugstr_w(request->headers[j].field),
debugstr_w(request->headers[j].value));
}
}
headers[i++] = twocrlf;
headers[i] = NULL;
len = 0;
for (p = headers; *p; p++) len += strlenW( *p );
len++;
if (!(ret = heap_alloc( len * sizeof(WCHAR) )))
{
heap_free( headers );
return NULL;
}
*ret = 0;
for (p = headers; *p; p++) strcatW( ret, *p );
heap_free( headers );
return ret;
}
#define QUERY_MODIFIER_MASK (WINHTTP_QUERY_FLAG_REQUEST_HEADERS | WINHTTP_QUERY_FLAG_SYSTEMTIME | WINHTTP_QUERY_FLAG_NUMBER)
static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID buffer, LPDWORD buflen, LPDWORD index )
{
header_t *header = NULL;
BOOL request_only, ret = FALSE;
int requested_index, header_index = -1;
DWORD attribute;
request_only = level & WINHTTP_QUERY_FLAG_REQUEST_HEADERS;
requested_index = index ? *index : 0;
attribute = level & ~QUERY_MODIFIER_MASK;
switch (attribute)
{
case WINHTTP_QUERY_CUSTOM:
{
header_index = get_header_index( request, name, requested_index, request_only );
break;
}
case WINHTTP_QUERY_RAW_HEADERS_CRLF:
{
WCHAR *headers;
DWORD len;
if (request_only)
headers = build_request_string( request, request->verb, request->path, request->version );
else
headers = request->raw_headers;
len = strlenW( headers ) * sizeof(WCHAR);
if (len + sizeof(WCHAR) > *buflen)
{
len += sizeof(WCHAR);
set_last_error( ERROR_INSUFFICIENT_BUFFER );
}
else if (buffer)
{
memcpy( buffer, headers, len + sizeof(WCHAR) );
TRACE("returning data: %s\n", debugstr_wn(buffer, len / sizeof(WCHAR)));
ret = TRUE;
}
*buflen = len;
if (request_only) heap_free( headers );
return ret;
}
default:
{
FIXME("attribute %u not implemented\n", attribute);
return FALSE;
}
}
if (header_index >= 0)
{
header = &request->headers[header_index];
}
if (!header || (request_only && !header->is_request))
{
set_last_error( ERROR_WINHTTP_HEADER_NOT_FOUND );
return FALSE;
}
if (index) *index += 1;
if (level & WINHTTP_QUERY_FLAG_NUMBER)
{
int *number = buffer;
if (sizeof(int) > *buflen)
{
set_last_error( ERROR_INSUFFICIENT_BUFFER );
}
else if (number)
{
*number = atoiW( header->value );
TRACE("returning number: %d\n", *number);
ret = TRUE;
}
*buflen = sizeof(int);
}
else if (level & WINHTTP_QUERY_FLAG_SYSTEMTIME)
{
SYSTEMTIME *st = buffer;
if (sizeof(SYSTEMTIME) > *buflen)
{
set_last_error( ERROR_INSUFFICIENT_BUFFER );
}
else if (st && (ret = WinHttpTimeToSystemTime( header->value, st )))
{
TRACE("returning time: %04d/%02d/%02d - %d - %02d:%02d:%02d.%02d\n",
st->wYear, st->wMonth, st->wDay, st->wDayOfWeek,
st->wHour, st->wMinute, st->wSecond, st->wMilliseconds);
}
*buflen = sizeof(SYSTEMTIME);
}
else if (header->value)
{
WCHAR *string = buffer;
DWORD len = (strlenW( header->value ) + 1) * sizeof(WCHAR);
if (len > *buflen)
{
set_last_error( ERROR_INSUFFICIENT_BUFFER );
*buflen = len;
return FALSE;
}
else if (string)
{
strcpyW( string, header->value );
TRACE("returning string: %s\n", debugstr_w(string));
ret = TRUE;
}
*buflen = len - sizeof(WCHAR);
}
return ret;
}
/***********************************************************************
* WinHttpQueryHeaders (winhttp.@)
*/
BOOL WINAPI WinHttpQueryHeaders( HINTERNET hrequest, DWORD level, LPCWSTR name, LPVOID buffer, LPDWORD buflen, LPDWORD index )
{
BOOL ret;
request_t *request;
TRACE("%p, 0x%08x, %s, %p, %p, %p\n", hrequest, level, debugstr_w(name), buffer, buflen, index);
if (!(request = (request_t *)grab_object( hrequest )))
{
set_last_error( ERROR_INVALID_HANDLE );
return FALSE;
}
if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST)
{
release_object( &request->hdr );
set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE );
return FALSE;
}
ret = query_headers( request, level, name, buffer, buflen, index );
release_object( &request->hdr );
return ret;
}

View File

@ -249,15 +249,11 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed: header index not incremented\n");
ok(memcmp(buffer, test_indices[0], sizeof(test_indices[0])) == 0,
"WinHttpQueryHeaders failed: incorrect string returned\n");
ok(len == 5*sizeof(WCHAR),
"WinHttpQueryHeaders failed: invalid length returned, expected 5, got %d\n", len);
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed: header index not incremented\n");
ok(memcmp(buffer, test_indices[0], sizeof(test_indices[0])) == 0, "WinHttpQueryHeaders failed: incorrect string returned\n");
ok(len == 5*sizeof(WCHAR), "WinHttpQueryHeaders failed: invalid length returned, expected 5, got %d\n", len);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded, second index should not exist.\n");
@ -271,7 +267,7 @@ static void test_WinHttpAddHeaders(void)
ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded with a buffer thats too small.\n");
ok(memcmp(buffer, check_buffer, sizeof(buffer)) == 0,
"WinHttpQueryHeaders failed, modified the buffer when it should not have.\n");
todo_wine ok(len == 6*sizeof(WCHAR), "WinHttpQueryHeaders returned invalid length, expected 12, got %d\n", len);
ok(len == 6*sizeof(WCHAR), "WinHttpQueryHeaders returned invalid length, expected 12, got %d\n", len);
/* Try with a NULL buffer */
index = 0;
@ -281,7 +277,7 @@ static void test_WinHttpAddHeaders(void)
test_header_name, NULL, &len, &index);
ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n");
todo_wine ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len);
todo_wine ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len);
ok(index == 0, "WinHttpQueryHeaders incorrectly incremented header index.\n");
/* Try with a NULL buffer and a length thats too small */
@ -291,12 +287,9 @@ static void test_WinHttpAddHeaders(void)
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, NULL, &len, &index);
ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n");
todo_wine
{
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICENT_BUFFER, go %u\n", GetLastError());
ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len);
}
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICENT_BUFFER, go %u\n", GetLastError());
todo_wine ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len);
ok(index == 0, "WinHttpQueryHeaders incorrectly incremented header index.\n");
index = 0;
@ -305,13 +298,9 @@ static void test_WinHttpAddHeaders(void)
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, NULL, &len, &index);
ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n");
todo_wine
{
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICIENT_BUFFER, got %u\n",
GetLastError());
ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len);
}
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
todo_wine ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len);
ok(index == 0, "WinHttpQueryHeaders failed: index was incremented.\n");
/* valid query */
@ -321,13 +310,12 @@ static void test_WinHttpAddHeaders(void)
memset(buffer, 0xff, sizeof(buffer));
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
ok(ret == TRUE, "WinHttpQueryHeaders failed: got %d\n", ret);
ok(len + sizeof(WCHAR) <= oldlen, "WinHttpQueryHeaders resulting length longer than advertized.\n");
ok((len < sizeof(buffer) - sizeof(WCHAR)) && buffer[len / sizeof(WCHAR)] == 0, "WinHttpQueryHeaders did not append NULL terminator\n");
ok(len == lstrlenW(buffer) * sizeof(WCHAR), "WinHttpQueryHeaders returned incorrect length.\n");
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: got %d\n", ret);
ok(len + sizeof(WCHAR) <= oldlen, "WinHttpQueryHeaders resulting length longer than advertized.\n");
ok((len < sizeof(buffer) - sizeof(WCHAR)) && buffer[len / sizeof(WCHAR)] == 0,
"WinHttpQueryHeaders did not append NULL terminator\n");
ok(len == lstrlenW(buffer) * sizeof(WCHAR), "WinHttpQueryHeaders returned incorrect length.\n");
ok(memcmp(buffer, test_header_begin, sizeof(test_header_begin)) == 0,
"WinHttpQueryHeaders returned invalid beginning of header string.\n");
ok(memcmp(buffer + lstrlenW(buffer) - 4, test_header_end, sizeof(test_header_end)) == 0,
@ -343,23 +331,16 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[0], sizeof(test_indices[0])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[0], sizeof(test_indices[0])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
ret = WinHttpAddRequestHeaders(request, test_headers[2], -1L, WINHTTP_ADDREQ_FLAG_REPLACE);
ok(ret == TRUE, "WinHttpAddRequestHeaders failed to add duplicate header.\n");
@ -368,23 +349,16 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
/* add if new flag */
ret = WinHttpAddRequestHeaders(request, test_headers[3], -1L, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW);
@ -394,23 +368,17 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
@ -424,23 +392,17 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_flag_coalesce, sizeof(test_flag_coalesce)) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_flag_coalesce, sizeof(test_flag_coalesce)) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
@ -454,23 +416,18 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_flag_coalesce_comma, sizeof(test_flag_coalesce_comma)) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_flag_coalesce_comma, sizeof(test_flag_coalesce_comma)) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
@ -485,23 +442,18 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_flag_coalesce_semicolon, sizeof(test_flag_coalesce_semicolon)) == 0,
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_flag_coalesce_semicolon, sizeof(test_flag_coalesce_semicolon)) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
@ -515,23 +467,17 @@ static void test_WinHttpAddHeaders(void)
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[2], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);
todo_wine
{
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[3], sizeof(test_indices[2])) == 0,
"WinHttpQueryHeaders returned incorrect string.\n");
}
ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError());
ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n");
ok(memcmp(buffer, test_indices[3], sizeof(test_indices[2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n");
len = sizeof(buffer);
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS,
test_header_name, buffer, &len, &index);