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
295291b4
Commit
295291b4
authored
Mar 13, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Always use non-blocking reads in HTTP_ReceiveRequestData.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
23d28c45
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
31 deletions
+22
-31
http.c
dlls/wininet/http.c
+7
-31
http.c
dlls/wininet/tests/http.c
+15
-0
No files found.
dlls/wininet/http.c
View file @
295291b4
...
...
@@ -2614,21 +2614,6 @@ static DWORD refill_read_buffer(http_request_t *req, BOOL allow_blocking, DWORD
return
res
;
}
/* return the size of data available to be read immediately (the read section must be held) */
static
DWORD
get_avail_data
(
http_request_t
*
req
)
{
DWORD
avail
=
req
->
read_size
;
/*
* Different Windows versions have different limits of returned data, but all
* of them return no more than centrain amount. We use READ_BUFFER_SIZE as a limit.
*/
if
(
avail
<
READ_BUFFER_SIZE
)
avail
+=
req
->
data_stream
->
vtbl
->
get_avail_data
(
req
->
data_stream
,
req
);
return
min
(
avail
,
READ_BUFFER_SIZE
);
}
static
DWORD
netconn_get_avail_data
(
data_stream_t
*
stream
,
http_request_t
*
req
)
{
netconn_stream_t
*
netconn_stream
=
(
netconn_stream_t
*
)
stream
;
...
...
@@ -2978,21 +2963,17 @@ static void send_request_complete(http_request_t *req, DWORD_PTR result, DWORD e
sizeof
(
INTERNET_ASYNC_RESULT
));
}
static
void
HTTP_ReceiveRequestData
(
http_request_t
*
req
,
BOOL
first_notif
,
DWORD
*
ret_size
)
static
void
HTTP_ReceiveRequestData
(
http_request_t
*
req
)
{
DWORD
res
,
read
=
0
,
avail
=
0
;
BOOL
allow_blocking
;
DWORD
res
,
read
=
0
;
TRACE
(
"%p
\n
"
,
req
);
EnterCriticalSection
(
&
req
->
read_section
);
allow_blocking
=
!
first_notif
||
!
req
->
read_size
;
res
=
refill_read_buffer
(
req
,
allow_blocking
,
&
read
);
if
(
res
==
ERROR_SUCCESS
)
{
avail
=
get_avail_data
(
req
);
res
=
refill_read_buffer
(
req
,
FALSE
,
&
read
);
if
(
res
==
ERROR_SUCCESS
)
read
+=
req
->
read_size
;
}
LeaveCriticalSection
(
&
req
->
read_section
);
...
...
@@ -3006,12 +2987,7 @@ static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif, DWORD
return
;
}
if
(
ret_size
)
*
ret_size
=
avail
;
if
(
first_notif
)
avail
=
0
;
send_request_complete
(
req
,
req
->
session
->
hdr
.
dwInternalFlags
&
INET_OPENURL
?
(
DWORD_PTR
)
req
->
hdr
.
hInternet
:
1
,
avail
);
send_request_complete
(
req
,
req
->
session
->
hdr
.
dwInternalFlags
&
INET_OPENURL
?
(
DWORD_PTR
)
req
->
hdr
.
hInternet
:
1
,
0
);
}
/* read data from the http connection (the read section must be held) */
...
...
@@ -5202,7 +5178,7 @@ lend:
{
if
(
res
==
ERROR_SUCCESS
)
{
if
(
bEndRequest
&&
request
->
contentLength
&&
request
->
bytesWritten
==
request
->
bytesToWrite
)
HTTP_ReceiveRequestData
(
request
,
TRUE
,
NULL
);
HTTP_ReceiveRequestData
(
request
);
else
send_request_complete
(
request
,
request
->
session
->
hdr
.
dwInternalFlags
&
INET_OPENURL
?
(
DWORD_PTR
)
request
->
hdr
.
hInternet
:
1
,
0
);
...
...
@@ -5309,7 +5285,7 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
create_cache_entry
(
request
);
if
(
res
==
ERROR_SUCCESS
&&
request
->
contentLength
)
HTTP_ReceiveRequestData
(
request
,
TRUE
,
NULL
);
HTTP_ReceiveRequestData
(
request
);
else
send_request_complete
(
request
,
res
==
ERROR_SUCCESS
,
res
);
...
...
dlls/wininet/tests/http.c
View file @
295291b4
...
...
@@ -4995,6 +4995,21 @@ static void test_http_read(int port)
close_async_handle
(
req
.
session
,
hCompleteEvent
,
2
);
open_read_test_request
(
port
,
&
req
,
"HTTP/1.1 200 OK
\r\n
"
"Server: winetest
\r\n
"
"Connection: close
\r\n
"
"
\r\n
"
);
readex_expect_async
(
req
.
request
,
IRF_NO_WAIT
,
&
ib
,
sizeof
(
buf
),
NULL
);
send_response_ex_and_wait
(
"123"
,
TRUE
,
&
ib
,
NULL
,
0
,
3
);
readex_expect_sync_data
(
req
.
request
,
IRF_NO_WAIT
,
&
ib
,
sizeof
(
buf
),
"123"
,
0
);
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
);
trace
(
"Testing InternetQueryDataAvailable...
\n
"
);
open_read_test_request
(
port
,
&
req
,
...
...
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