Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
920a261d
Commit
920a261d
authored
Nov 26, 2013
by
Ričardas Barkauskas
Committed by
Alexandre Julliard
Nov 26, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet/tests: Test successive HttpSendRequest calls.
parent
f34ba032
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
4 deletions
+95
-4
http.c
dlls/wininet/tests/http.c
+95
-4
No files found.
dlls/wininet/tests/http.c
View file @
920a261d
...
...
@@ -1927,14 +1927,14 @@ static const char page1[] =
static
const
char
ok_with_length
[]
=
"HTTP/1.1 200 OK
\r\n
"
"Connection: Keep-Alive
\r\n
"
"Content-Length:
23
\r\n\r\n
"
"
abc
\r\n
HTTP/1.1 211 OK
\r\n\r\n
"
;
"Content-Length:
18
\r\n\r\n
"
"HTTP/1.1 211 OK
\r\n\r\n
"
;
static
const
char
ok_with_length2
[]
=
"HTTP/1.1 210 OK
\r\n
"
"Connection: Keep-Alive
\r\n
"
"Content-Length:
24
\r\n\r\n
"
"
abc
\r\n
HTTP/1.1 211 OK
\r\n\r\n
"
;
"Content-Length:
19
\r\n\r\n
"
"HTTP/1.1 211 OK
\r\n\r\n
"
;
struct
server_info
{
HANDLE
hEvent
;
...
...
@@ -2147,6 +2147,12 @@ static DWORD CALLBACK server_thread(LPVOID param)
count
=
0
;
}
}
if
(
strstr
(
buffer
,
"GET /testH"
))
{
send
(
c
,
ok_with_length2
,
sizeof
(
ok_with_length2
)
-
1
,
0
);
recvfrom
(
c
,
buffer
,
sizeof
(
buffer
),
0
,
NULL
,
NULL
);
send
(
c
,
ok_with_length
,
sizeof
(
ok_with_length
)
-
1
,
0
);
}
if
(
strstr
(
buffer
,
"GET /test_no_content"
))
{
...
...
@@ -2937,6 +2943,90 @@ static void test_connection_closing(int port)
CloseHandle
(
hCompleteEvent
);
}
static
void
test_successive_HttpSendRequest
(
int
port
)
{
HINTERNET
session
,
connection
,
req
;
DWORD
res
;
hCompleteEvent
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
session
=
InternetOpenA
(
""
,
INTERNET_OPEN_TYPE_DIRECT
,
NULL
,
NULL
,
INTERNET_FLAG_ASYNC
);
ok
(
session
!=
NULL
,
"InternetOpen failed with error %u
\n
"
,
GetLastError
());
pInternetSetStatusCallbackA
(
session
,
callback
);
SET_EXPECT
(
INTERNET_STATUS_HANDLE_CREATED
);
connection
=
InternetConnectA
(
session
,
"localhost"
,
port
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0x0
,
0xdeadbeef
);
ok
(
connection
!=
NULL
,
"InternetConnect failed with error %u
\n
"
,
GetLastError
());
CHECK_NOTIFIED
(
INTERNET_STATUS_HANDLE_CREATED
);
SET_EXPECT
(
INTERNET_STATUS_HANDLE_CREATED
);
req
=
HttpOpenRequestA
(
connection
,
"GET"
,
"/testH"
,
NULL
,
NULL
,
NULL
,
INTERNET_FLAG_KEEP_CONNECTION
,
0xdeadbeaf
);
ok
(
req
!=
NULL
,
"HttpOpenRequest failed: %u
\n
"
,
GetLastError
());
CHECK_NOTIFIED
(
INTERNET_STATUS_HANDLE_CREATED
);
SET_OPTIONAL
(
INTERNET_STATUS_COOKIE_SENT
);
SET_OPTIONAL
(
INTERNET_STATUS_DETECTING_PROXY
);
SET_EXPECT
(
INTERNET_STATUS_CONNECTING_TO_SERVER
);
SET_EXPECT
(
INTERNET_STATUS_CONNECTED_TO_SERVER
);
SET_EXPECT
(
INTERNET_STATUS_SENDING_REQUEST
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_SENT
);
SET_EXPECT
(
INTERNET_STATUS_RECEIVING_RESPONSE
);
SET_EXPECT
(
INTERNET_STATUS_RESPONSE_RECEIVED
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_COMPLETE
);
res
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_IO_PENDING
),
"Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING
\n
"
);
WaitForSingleObject
(
hCompleteEvent
,
INFINITE
);
ok
(
req_error
==
ERROR_SUCCESS
,
"req_error = %u
\n
"
,
req_error
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_COOKIE_SENT
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_DETECTING_PROXY
);
CHECK_NOTIFIED
(
INTERNET_STATUS_CONNECTING_TO_SERVER
);
CHECK_NOTIFIED
(
INTERNET_STATUS_CONNECTED_TO_SERVER
);
CHECK_NOTIFIED
(
INTERNET_STATUS_SENDING_REQUEST
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_SENT
);
CHECK_NOTIFIED
(
INTERNET_STATUS_RECEIVING_RESPONSE
);
CHECK_NOTIFIED
(
INTERNET_STATUS_RESPONSE_RECEIVED
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_COMPLETE
);
test_status_code
(
req
,
210
);
SET_OPTIONAL
(
INTERNET_STATUS_COOKIE_SENT
);
SET_OPTIONAL
(
INTERNET_STATUS_DETECTING_PROXY
);
SET_EXPECT
(
INTERNET_STATUS_SENDING_REQUEST
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_SENT
);
SET_EXPECT
(
INTERNET_STATUS_RECEIVING_RESPONSE
);
SET_EXPECT
(
INTERNET_STATUS_RESPONSE_RECEIVED
);
SET_OPTIONAL
(
INTERNET_STATUS_CLOSING_CONNECTION
);
SET_OPTIONAL
(
INTERNET_STATUS_CONNECTION_CLOSED
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_COMPLETE
);
res
=
HttpSendRequestA
(
req
,
NULL
,
0
,
NULL
,
0
);
ok
(
!
res
&&
(
GetLastError
()
==
ERROR_IO_PENDING
),
"Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING
\n
"
);
WaitForSingleObject
(
hCompleteEvent
,
INFINITE
);
ok
(
req_error
==
ERROR_SUCCESS
,
"req_error = %u
\n
"
,
req_error
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_COOKIE_SENT
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_DETECTING_PROXY
);
CHECK_NOTIFIED
(
INTERNET_STATUS_SENDING_REQUEST
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_SENT
);
CHECK_NOTIFIED
(
INTERNET_STATUS_RECEIVING_RESPONSE
);
CHECK_NOTIFIED
(
INTERNET_STATUS_RESPONSE_RECEIVED
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_CLOSING_CONNECTION
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_CONNECTION_CLOSED
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_COMPLETE
);
test_status_code_todo
(
req
,
200
);
SET_WINE_ALLOW
(
INTERNET_STATUS_CLOSING_CONNECTION
);
SET_WINE_ALLOW
(
INTERNET_STATUS_CONNECTION_CLOSED
);
close_async_handle
(
session
,
hCompleteEvent
,
2
);
CloseHandle
(
hCompleteEvent
);
}
static
void
test_no_content
(
int
port
)
{
...
...
@@ -3912,6 +4002,7 @@ static void test_http_connection(void)
test_premature_disconnect
(
si
.
port
);
test_connection_closing
(
si
.
port
);
test_cache_control_verb
(
si
.
port
);
test_successive_HttpSendRequest
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
test_basic_request
(
si
.
port
,
"GET"
,
"/quit"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment