winhttp/tests: Keep the connection alive in a couple of tests.
This commit is contained in:
parent
faf70e2fbd
commit
142ac82490
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
static HANDLE wait_event;
|
|
||||||
static const WCHAR test_useragent[] =
|
static const WCHAR test_useragent[] =
|
||||||
{'W','i','n','e',' ','R','e','g','r','e','s','s','i','o','n',' ','T','e','s','t',0};
|
{'W','i','n','e',' ','R','e','g','r','e','s','s','i','o','n',' ','T','e','s','t',0};
|
||||||
static const WCHAR test_winehq[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0};
|
static const WCHAR test_winehq[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0};
|
||||||
|
@ -1830,7 +1829,7 @@ struct server_info
|
||||||
static DWORD CALLBACK server_thread(LPVOID param)
|
static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
{
|
{
|
||||||
struct server_info *si = param;
|
struct server_info *si = param;
|
||||||
int r, c, i, on;
|
int r, c = -1, i, on;
|
||||||
SOCKET s;
|
SOCKET s;
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
char buffer[0x100];
|
char buffer[0x100];
|
||||||
|
@ -1859,7 +1858,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
SetEvent(si->event);
|
SetEvent(si->event);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c = accept(s, NULL, NULL);
|
if (c == -1) c = accept(s, NULL, NULL);
|
||||||
|
|
||||||
memset(buffer, 0, sizeof buffer);
|
memset(buffer, 0, sizeof buffer);
|
||||||
for(i = 0; i < sizeof buffer - 1; i++)
|
for(i = 0; i < sizeof buffer - 1; i++)
|
||||||
|
@ -1898,11 +1897,12 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
if (strstr(buffer, "GET /no_content"))
|
if (strstr(buffer, "GET /no_content"))
|
||||||
{
|
{
|
||||||
send(c, nocontentmsg, sizeof nocontentmsg - 1, 0);
|
send(c, nocontentmsg, sizeof nocontentmsg - 1, 0);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (strstr(buffer, "GET /not_modified"))
|
if (strstr(buffer, "GET /not_modified"))
|
||||||
{
|
{
|
||||||
send(c, notmodified, sizeof notmodified - 1, 0);
|
send(c, notmodified, sizeof notmodified - 1, 0);
|
||||||
WaitForSingleObject(wait_event, 5000);
|
continue;
|
||||||
}
|
}
|
||||||
if (strstr(buffer, "GET /quit"))
|
if (strstr(buffer, "GET /quit"))
|
||||||
{
|
{
|
||||||
|
@ -1912,6 +1912,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
}
|
}
|
||||||
shutdown(c, 2);
|
shutdown(c, 2);
|
||||||
closesocket(c);
|
closesocket(c);
|
||||||
|
c = -1;
|
||||||
|
|
||||||
} while (!last_request);
|
} while (!last_request);
|
||||||
|
|
||||||
|
@ -2250,8 +2251,6 @@ static void test_not_modified(int port)
|
||||||
ret = WinHttpReceiveResponse(request, NULL);
|
ret = WinHttpReceiveResponse(request, NULL);
|
||||||
ok(ret, "WinHttpReceiveResponse failed: %u\n", GetLastError());
|
ok(ret, "WinHttpReceiveResponse failed: %u\n", GetLastError());
|
||||||
|
|
||||||
SetEvent(wait_event);
|
|
||||||
|
|
||||||
size = sizeof(status);
|
size = sizeof(status);
|
||||||
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER,
|
ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER,
|
||||||
NULL, &status, &size, NULL);
|
NULL, &status, &size, NULL);
|
||||||
|
@ -3275,8 +3274,6 @@ START_TEST (winhttp)
|
||||||
if (ret != WAIT_OBJECT_0)
|
if (ret != WAIT_OBJECT_0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wait_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
|
||||||
|
|
||||||
test_connection_info(si.port);
|
test_connection_info(si.port);
|
||||||
test_basic_request(si.port, NULL, basicW);
|
test_basic_request(si.port, NULL, basicW);
|
||||||
test_no_headers(si.port);
|
test_no_headers(si.port);
|
||||||
|
@ -3289,7 +3286,5 @@ START_TEST (winhttp)
|
||||||
/* send the basic request again to shutdown the server thread */
|
/* send the basic request again to shutdown the server thread */
|
||||||
test_basic_request(si.port, NULL, quitW);
|
test_basic_request(si.port, NULL, quitW);
|
||||||
|
|
||||||
CloseHandle(wait_event);
|
|
||||||
|
|
||||||
WaitForSingleObject(thread, 3000);
|
WaitForSingleObject(thread, 3000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue