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
7b42dc49
Commit
7b42dc49
authored
Feb 27, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Improved netconn_drain_content.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f2499d20
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
12 deletions
+55
-12
http.c
dlls/wininet/http.c
+9
-6
http.c
dlls/wininet/tests/http.c
+46
-6
No files found.
dlls/wininet/http.c
View file @
7b42dc49
...
...
@@ -2682,17 +2682,20 @@ static BOOL netconn_drain_content(data_stream_t *stream, http_request_t *req)
{
netconn_stream_t
*
netconn_stream
=
(
netconn_stream_t
*
)
stream
;
BYTE
buf
[
1024
];
int
len
;
int
len
,
res
;
size_t
size
;
if
(
netconn_
end_of_data
(
stream
,
req
)
)
return
TRU
E
;
if
(
netconn_
stream
->
content_length
==
~
0u
)
return
FALS
E
;
do
{
if
(
NETCON_recv
(
req
->
netconn
,
buf
,
sizeof
(
buf
),
FALSE
,
&
len
)
!=
ERROR_SUCCESS
)
while
(
netconn_stream
->
content_read
<
netconn_stream
->
content_length
)
{
size
=
min
(
sizeof
(
buf
),
netconn_stream
->
content_length
-
netconn_stream
->
content_read
);
res
=
NETCON_recv
(
req
->
netconn
,
buf
,
size
,
FALSE
,
&
len
);
if
(
res
||
!
len
)
return
FALSE
;
netconn_stream
->
content_read
+=
len
;
}
while
(
netconn_stream
->
content_read
<
netconn_stream
->
content_length
);
}
return
TRUE
;
}
...
...
dlls/wininet/tests/http.c
View file @
7b42dc49
...
...
@@ -4652,7 +4652,14 @@ static void _readex_expect_sync_data(unsigned line, HINTERNET req, DWORD flags,
_readex_expect_sync_data_len
(
line
,
req
,
flags
,
buf
,
buf_size
,
exdata
,
strlen
(
exdata
));
}
static
void
send_response_and_wait
(
const
char
*
response
,
BOOL
close_connection
,
INTERNET_BUFFERSW
*
buf
)
static
void
close_connection
(
void
)
{
char
c
;
SetEvent
(
conn_wait_event
);
recv
(
server_socket
,
&
c
,
1
,
0
);
}
static
void
send_response_and_wait
(
const
char
*
response
,
BOOL
do_close_connection
,
INTERNET_BUFFERSW
*
buf
)
{
DWORD
orig_size
=
buf
->
dwBufferLength
;
...
...
@@ -4661,11 +4668,8 @@ static void send_response_and_wait(const char *response, BOOL close_connection,
if
(
response
)
server_send_string
(
response
);
if
(
close_connection
)
{
char
c
;
SetEvent
(
conn_wait_event
);
recv
(
server_socket
,
&
c
,
1
,
0
);
}
if
(
do_close_connection
)
close_connection
();
WaitForSingleObject
(
hCompleteEvent
,
INFINITE
);
...
...
@@ -4821,6 +4825,41 @@ static void test_http_read(int port)
CloseHandle
(
server_req_rec_event
);
}
static
void
test_connection_break
(
int
port
)
{
INTERNET_BUFFERSW
ib
;
test_request_t
req
;
char
buf
[
24000
];
if
(
!
is_ie7plus
)
return
;
hCompleteEvent
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
conn_wait_event
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
server_req_rec_event
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
memset
(
&
ib
,
0
,
sizeof
(
ib
));
ib
.
dwStructSize
=
sizeof
(
ib
);
ib
.
lpvBuffer
=
buf
;
trace
(
"Testing InternetReadFileExW on broken connection...
\n
"
);
open_read_test_request
(
port
,
&
req
,
"HTTP/1.1 200 OK
\r\n
"
"Server: winetest
\r\n
"
"Content-Length: 10000
\r\n
"
"
\r\n
"
"xx"
);
/* close connection and make sure that it's closed on handle release. */
close_connection
();
SET_EXPECT
(
INTERNET_STATUS_CLOSING_CONNECTION
);
SET_EXPECT
(
INTERNET_STATUS_CONNECTION_CLOSED
);
close_async_handle
(
req
.
session
,
hCompleteEvent
,
2
);
CHECK_NOTIFIED
(
INTERNET_STATUS_CLOSING_CONNECTION
);
CHECK_NOTIFIED
(
INTERNET_STATUS_CONNECTION_CLOSED
);
}
static
void
test_long_url
(
int
port
)
{
char
long_path
[
INTERNET_MAX_PATH_LENGTH
*
2
]
=
"/echo_request?"
;
...
...
@@ -4919,6 +4958,7 @@ static void test_http_connection(void)
test_basic_auth_credentials_reuse
(
si
.
port
);
test_async_read
(
si
.
port
);
test_http_read
(
si
.
port
);
test_connection_break
(
si
.
port
);
test_long_url
(
si
.
port
);
test_remove_dot_segments
(
si
.
port
);
...
...
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