From: Paul Gofman pgofman@codeweavers.com
--- dlls/winhttp/request.c | 20 +++++++++----------- dlls/winhttp/tests/winhttp.c | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 1b6cb1e2a45..207f1ec5c61 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -1922,7 +1922,7 @@ static DWORD refill_buffer( struct request *request, BOOL notify )
static void finished_reading( struct request *request ) { - BOOL close = FALSE, notify; + BOOL close = FALSE, close_request_headers; WCHAR connection[20]; DWORD size = sizeof(connection);
@@ -1937,18 +1937,16 @@ static void finished_reading( struct request *request ) } else if (!wcscmp( request->version, L"HTTP/1.0" )) close = TRUE;
- if (close) + size = sizeof(connection); + close_request_headers = + (!query_headers( request, WINHTTP_QUERY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, NULL, connection, &size, NULL ) + || !query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, NULL, connection, &size, NULL )) + && !wcsicmp( connection, L"close" ); + if (close || close_request_headers) { - size = sizeof(connection); - notify = (!query_headers( request, WINHTTP_QUERY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - NULL, connection, &size, NULL ) - || !query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - NULL, connection, &size, NULL )) - && !wcsicmp( connection, L"close" ); - - if (notify) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 0 ); + if (close_request_headers) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 0 ); netconn_release( request->netconn ); - if (notify) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 0 ); + if (close_request_headers) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 0 ); } else cache_connection( request->netconn ); diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 5d0ccd11f52..ee01fd5ec72 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -2591,7 +2591,7 @@ static DWORD CALLBACK server_thread(LPVOID param) ok(!!strstr(buffer, "GET /cached"), "request not found.\n"); send(c, okmsg_length0, sizeof okmsg_length0 - 1, 0); r = server_receive_request(c, buffer, sizeof(buffer)); - todo_wine ok(!r, "got %d, buffer[0] %d.\n", r, buffer[0]); + ok(!r, "got %d, buffer[0] %d.\n", r, buffer[0]); } if (strstr(buffer, "GET /notcached")) {