From cfb4b0a305140ff018e117d0c8ce330eb7ba74ad Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 24 Mar 2014 16:25:16 +0100 Subject: [PATCH] wininet: Fixed tests on some old Windows versions. --- dlls/wininet/tests/http.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 5edc55ab358..70e82db09be 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -2196,7 +2196,7 @@ static DWORD CALLBACK server_thread(LPVOID param) if (!memcmp(buffer, "GET ", sizeof("GET ")-1) && !strstr(buffer, "Cache-Control: no-cache\r\n")) send(c, okmsg, sizeof(okmsg)-1, 0); else if (strstr(buffer, "Cache-Control: no-cache\r\n")) send(c, okmsg, sizeof(okmsg)-1, 0); - send(c, notokmsg, sizeof(notokmsg)-1, 0); + else send(c, notokmsg, sizeof(notokmsg)-1, 0); } if (strstr(buffer, "GET /test_premature_disconnect")) trace("closing connection\n"); @@ -3055,12 +3055,17 @@ static void test_no_content(int port) CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT); CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE); CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED); - CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION); - CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED); CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); close_async_handle(session, hCompleteEvent, 2); CloseHandle(hCompleteEvent); + + /* + * The connection should be closed before closing handle. This is true for most + * wininet versions (including Wine), but some old win2k versions fail to do that. + */ + CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION); + CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED); } static void test_conn_close(int port) @@ -3910,6 +3915,7 @@ static void test_cache_control_verb(int port) ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); + InternetCloseHandle(request); request = HttpOpenRequestA(connect, "POST", "/test_cache_control_verb", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); @@ -3917,6 +3923,7 @@ static void test_cache_control_verb(int port) ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); + InternetCloseHandle(request); request = HttpOpenRequestA(connect, "HEAD", "/test_cache_control_verb", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); @@ -3924,6 +3931,7 @@ static void test_cache_control_verb(int port) ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); + InternetCloseHandle(request); request = HttpOpenRequestA(connect, "GET", "/test_cache_control_verb", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); @@ -3931,8 +3939,8 @@ static void test_cache_control_verb(int port) ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); - InternetCloseHandle(request); + InternetCloseHandle(connect); InternetCloseHandle(session); }