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
23e78c01
Commit
23e78c01
authored
May 31, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
May 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet/tests: Added redirection tests using test server.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
71ae1923
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
http.c
dlls/wininet/tests/http.c
+98
-0
No files found.
dlls/wininet/tests/http.c
View file @
23e78c01
...
...
@@ -4561,6 +4561,11 @@ static void server_send_string(const char *msg)
send
(
server_socket
,
msg
,
strlen
(
msg
),
0
);
}
static
size_t
server_read_data
(
char
*
buf
,
size_t
buf_size
)
{
return
recv
(
server_socket
,
buf
,
buf_size
,
0
);
}
static
BOOL
skip_receive_notification_tests
;
static
DWORD
received_response_size
;
...
...
@@ -5152,6 +5157,98 @@ static void test_long_url(int port)
close_request
(
&
req
);
}
static
void
test_redirect
(
int
port
)
{
char
buf
[
4000
],
*
p
,
expect_url
[
INTERNET_MAX_URL_LENGTH
];
INTERNET_BUFFERSW
ib
;
test_request_t
req
;
size_t
size
;
if
(
!
is_ie7plus
)
return
;
skip_receive_notification_tests
=
TRUE
;
memset
(
&
ib
,
0
,
sizeof
(
ib
));
ib
.
dwStructSize
=
sizeof
(
ib
);
ib
.
lpvBuffer
=
buf
;
trace
(
"Testing redirection...
\n
"
);
open_socket_request
(
port
,
&
req
);
SET_OPTIONAL
(
INTERNET_STATUS_COOKIE_SENT
);
SET_EXPECT
(
INTERNET_STATUS_REDIRECT
);
SET_EXPECT
(
INTERNET_STATUS_SENDING_REQUEST
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_SENT
);
server_send_string
(
"HTTP/1.1 302 Found
\r\n
"
"Server: winetest
\r\n
"
"Location: test_redirection
\r\n
"
"Connection: keep-alive
\r\n
"
"Content-Length: 0
\r\n
"
"
\r\n
"
);
size
=
server_read_data
(
buf
,
sizeof
(
buf
));
buf
[
size
]
=
0
;
p
=
strstr
(
buf
,
"
\r\n
"
);
if
(
p
)
*
p
=
0
;
ok
(
p
&&
!
strcmp
(
buf
,
"GET /test_redirection HTTP/1.1"
),
"unexpected request %s
\n
"
,
buf
);
CHECK_NOTIFIED
(
INTERNET_STATUS_SENDING_REQUEST
);
sprintf
(
expect_url
,
"http://localhost:%u/test_redirection"
,
port
);
test_request_url
(
req
.
request
,
expect_url
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_COMPLETE
);
server_send_string
(
"HTTP/1.1 200 OK
\r\n
"
"Server: winetest
\r\n
"
"Content-Length: 3
\r\n
"
"
\r\n
"
"xxx"
);
WaitForSingleObject
(
complete_event
,
INFINITE
);
CLEAR_NOTIFIED
(
INTERNET_STATUS_COOKIE_SENT
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_SENT
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REDIRECT
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_COMPLETE
);
ok
(
req_error
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
req_error
);
test_status_code
(
req
.
request
,
200
);
close_connection
();
close_async_handle
(
req
.
session
,
2
);
trace
(
"Test redirect to non-http URL...
\n
"
);
open_socket_request
(
port
,
&
req
);
SET_EXPECT
(
INTERNET_STATUS_REQUEST_COMPLETE
);
server_send_string
(
"HTTP/1.1 302 Found
\r\n
"
"Server: winetest
\r\n
"
"Location: test:non:http/url
\r\n
"
"Connection: keep-alive
\r\n
"
"Content-Length: 0
\r\n
"
"
\r\n
"
);
WaitForSingleObject
(
complete_event
,
INFINITE
);
CHECK_NOTIFIED
(
INTERNET_STATUS_REQUEST_COMPLETE
);
ok
(
req_error
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
req_error
);
sprintf
(
expect_url
,
"http://localhost:%u/socket"
,
port
);
test_request_url
(
req
.
request
,
expect_url
);
test_status_code
(
req
.
request
,
302
);
close_connection
();
close_async_handle
(
req
.
session
,
2
);
skip_receive_notification_tests
=
FALSE
;
}
static
void
test_remove_dot_segments
(
int
port
)
{
test_request_t
req
;
...
...
@@ -5218,6 +5315,7 @@ static void test_http_connection(void)
test_http_read
(
si
.
port
);
test_connection_break
(
si
.
port
);
test_long_url
(
si
.
port
);
test_redirect
(
si
.
port
);
test_remove_dot_segments
(
si
.
port
);
/* send the basic request again to shutdown the server thread */
...
...
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