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
bd2a2c25
Commit
bd2a2c25
authored
Jan 23, 2024
by
Paul Gofman
Committed by
Alexandre Julliard
Jan 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Always return result at once if available in WinHttpReadData().
parent
fd253442
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
4 deletions
+48
-4
request.c
dlls/winhttp/request.c
+39
-3
notification.c
dlls/winhttp/tests/notification.c
+9
-1
No files found.
dlls/winhttp/request.c
View file @
bd2a2c25
...
...
@@ -3213,7 +3213,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW
DWORD
ret
;
struct
request
*
request
;
BOOL
async
;
BOOL
wont_block
;
BOOL
wont_block
=
FALSE
;
TRACE
(
"%p, %p, %lu, %p
\n
"
,
hrequest
,
buffer
,
to_read
,
read
);
...
...
@@ -3229,7 +3229,44 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW
return
FALSE
;
}
if
((
async
=
request
->
connect
->
hdr
.
flags
&
WINHTTP_FLAG_ASYNC
)
&&
!
skip_async_queue
(
request
,
&
wont_block
))
if
(
!
(
async
=
request
->
connect
->
hdr
.
flags
&
WINHTTP_FLAG_ASYNC
)
||
skip_async_queue
(
request
,
&
wont_block
))
{
ret
=
read_data
(
request
,
buffer
,
to_read
,
read
,
async
);
}
else
if
(
wont_block
)
{
/* Data available but recursion limit reached, only queue callback. */
struct
send_callback
*
s
;
if
(
!
(
s
=
malloc
(
sizeof
(
*
s
)
)))
{
release_object
(
&
request
->
hdr
);
SetLastError
(
ERROR_OUTOFMEMORY
);
return
FALSE
;
}
if
(
!
(
ret
=
read_data
(
request
,
buffer
,
to_read
,
&
s
->
count
,
FALSE
)))
{
if
(
read
)
*
read
=
s
->
count
;
s
->
status
=
WINHTTP_CALLBACK_STATUS_READ_COMPLETE
;
s
->
info
=
buffer
;
s
->
buflen
=
s
->
count
;
}
else
{
s
->
result
.
dwResult
=
API_READ_DATA
;
s
->
result
.
dwError
=
ret
;
s
->
status
=
WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
;
s
->
info
=
&
s
->
result
;
s
->
buflen
=
sizeof
(
s
->
result
);
}
if
((
ret
=
queue_task
(
&
request
->
queue
,
task_send_callback
,
&
s
->
task_hdr
,
&
request
->
hdr
)))
free
(
s
);
else
ret
=
ERROR_IO_PENDING
;
}
else
{
struct
read_data
*
r
;
...
...
@@ -3248,7 +3285,6 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW
else
ret
=
ERROR_IO_PENDING
;
}
else
ret
=
read_data
(
request
,
buffer
,
to_read
,
read
,
async
);
release_object
(
&
request
->
hdr
);
SetLastError
(
ret
);
...
...
dlls/winhttp/tests/notification.c
View file @
bd2a2c25
...
...
@@ -1904,6 +1904,9 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex
break
;
case
WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE
:
{
DWORD
len
;
if
(
!
context
->
read_from_callback
)
{
SetEvent
(
context
->
wait
);
...
...
@@ -1920,13 +1923,18 @@ static void CALLBACK test_recursion_callback( HINTERNET handle, DWORD_PTR contex
"got %lu, thread %#lx
\n
"
,
context
->
recursion_count
,
GetCurrentThreadId
()
);
context
->
max_recursion_query
=
max
(
context
->
max_recursion_query
,
context
->
recursion_count
);
InterlockedIncrement
(
&
context
->
recursion_count
);
ret
=
WinHttpReadData
(
context
->
request
,
&
b
,
1
,
NULL
);
b
=
0xff
;
len
=
0xdeadbeef
;
ret
=
WinHttpReadData
(
context
->
request
,
&
b
,
1
,
&
len
);
err
=
GetLastError
();
ok
(
ret
,
"failed to read data, GetLastError() %lu
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
||
err
==
ERROR_IO_PENDING
,
"got %lu
\n
"
,
err
);
ok
(
b
!=
0xff
,
"got %#x.
\n
"
,
b
);
ok
(
len
==
1
,
"got %lu.
\n
"
,
len
);
if
(
err
==
ERROR_SUCCESS
)
context
->
have_sync_callback
=
TRUE
;
InterlockedDecrement
(
&
context
->
recursion_count
);
break
;
}
case
WINHTTP_CALLBACK_STATUS_READ_COMPLETE
:
{
...
...
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