Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
55425e85
Commit
55425e85
authored
Jun 03, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Jun 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Abort websocket IO on handle close.
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
parent
3eda59af
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
4 deletions
+39
-4
handle.c
dlls/winhttp/handle.c
+6
-1
net.c
dlls/winhttp/net.c
+9
-1
request.c
dlls/winhttp/request.c
+19
-2
session.c
dlls/winhttp/session.c
+3
-0
winhttp_private.h
dlls/winhttp/winhttp_private.h
+2
-0
No files found.
dlls/winhttp/handle.c
View file @
55425e85
...
...
@@ -142,7 +142,12 @@ BOOL free_handle( HINTERNET hinternet )
LeaveCriticalSection
(
&
handle_cs
);
if
(
hdr
)
release_object
(
hdr
);
if
(
hdr
)
{
if
(
hdr
->
vtbl
->
handle_closing
)
hdr
->
vtbl
->
handle_closing
(
hdr
);
release_object
(
hdr
);
}
EnterCriticalSection
(
&
handle_cs
);
if
(
next_handle
>
handle
&&
!
handles
[
handle
])
next_handle
=
handle
;
...
...
dlls/winhttp/net.c
View file @
55425e85
...
...
@@ -269,7 +269,8 @@ void netconn_close( struct netconn *conn )
free
(
conn
->
extra_buf
);
DeleteSecurityContext
(
&
conn
->
ssl_ctx
);
}
closesocket
(
conn
->
socket
);
if
(
conn
->
socket
!=
-
1
)
closesocket
(
conn
->
socket
);
release_host
(
conn
->
host
);
free
(
conn
);
}
...
...
@@ -629,6 +630,13 @@ DWORD netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int
return
ERROR_SUCCESS
;
}
void
netconn_cancel_io
(
struct
netconn
*
conn
)
{
SOCKET
socket
=
InterlockedExchange
(
(
LONG
*
)
&
conn
->
socket
,
-
1
);
closesocket
(
socket
);
}
ULONG
netconn_query_data_available
(
struct
netconn
*
conn
)
{
return
conn
->
secure
?
conn
->
peek_len
:
0
;
...
...
dlls/winhttp/request.c
View file @
55425e85
...
...
@@ -231,9 +231,10 @@ static BOOL task_needs_completion( struct task_header *task_hdr )
return
!
InterlockedExchange
(
&
task_hdr
->
completion_sent
,
1
);
}
static
void
cancel_queue
(
struct
queue
*
queue
)
static
BOOL
cancel_queue
(
struct
queue
*
queue
)
{
struct
task_header
*
task_hdr
,
*
found
;
BOOL
cancelled
=
FALSE
;
while
(
1
)
{
...
...
@@ -250,9 +251,11 @@ static void cancel_queue( struct queue *queue )
}
ReleaseSRWLockExclusive
(
&
queue
->
lock
);
if
(
!
found
)
break
;
cancelled
=
TRUE
;
found
->
callback
(
found
,
TRUE
);
release_task
(
found
);
}
return
cancelled
;
}
static
void
free_header
(
struct
header
*
header
)
...
...
@@ -1885,7 +1888,8 @@ static void finished_reading( struct request *request )
if
(
!
request
->
netconn
)
return
;
if
(
request
->
hdr
.
disable_flags
&
WINHTTP_DISABLE_KEEP_ALIVE
)
close
=
TRUE
;
if
(
request
->
netconn
->
socket
==
-
1
)
close
=
TRUE
;
else
if
(
request
->
hdr
.
disable_flags
&
WINHTTP_DISABLE_KEEP_ALIVE
)
close
=
TRUE
;
else
if
(
!
query_headers
(
request
,
WINHTTP_QUERY_CONNECTION
,
NULL
,
connection
,
&
size
,
NULL
)
||
!
query_headers
(
request
,
WINHTTP_QUERY_PROXY_CONNECTION
,
NULL
,
connection
,
&
size
,
NULL
))
{
...
...
@@ -3121,6 +3125,18 @@ BOOL WINAPI WinHttpWriteData( HINTERNET hrequest, const void *buffer, DWORD to_w
return
!
ret
;
}
static
void
socket_handle_closing
(
struct
object_header
*
hdr
)
{
struct
socket
*
socket
=
(
struct
socket
*
)
hdr
;
BOOL
pending_tasks
;
pending_tasks
=
cancel_queue
(
&
socket
->
send_q
);
pending_tasks
=
cancel_queue
(
&
socket
->
recv_q
)
||
pending_tasks
;
if
(
pending_tasks
)
netconn_cancel_io
(
socket
->
request
->
netconn
);
}
static
BOOL
socket_query_option
(
struct
object_header
*
hdr
,
DWORD
option
,
void
*
buffer
,
DWORD
*
buflen
)
{
FIXME
(
"unimplemented option %lu
\n
"
,
option
);
...
...
@@ -3151,6 +3167,7 @@ static BOOL socket_set_option( struct object_header *hdr, DWORD option, void *bu
static
const
struct
object_vtbl
socket_vtbl
=
{
socket_handle_closing
,
socket_destroy
,
socket_query_option
,
socket_set_option
,
...
...
dlls/winhttp/session.c
View file @
55425e85
...
...
@@ -242,6 +242,7 @@ static BOOL session_set_option( struct object_header *hdr, DWORD option, void *b
static
const
struct
object_vtbl
session_vtbl
=
{
NULL
,
session_destroy
,
session_query_option
,
session_set_option
...
...
@@ -382,6 +383,7 @@ static BOOL connect_query_option( struct object_header *hdr, DWORD option, void
static
const
struct
object_vtbl
connect_vtbl
=
{
NULL
,
connect_destroy
,
connect_query_option
,
NULL
...
...
@@ -1085,6 +1087,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
static
const
struct
object_vtbl
request_vtbl
=
{
NULL
,
request_destroy
,
request_query_option
,
request_set_option
...
...
dlls/winhttp/winhttp_private.h
View file @
55425e85
...
...
@@ -30,6 +30,7 @@
struct
object_header
;
struct
object_vtbl
{
void
(
*
handle_closing
)
(
struct
object_header
*
);
void
(
*
destroy
)(
struct
object_header
*
);
BOOL
(
*
query_option
)(
struct
object_header
*
,
DWORD
,
void
*
,
DWORD
*
);
BOOL
(
*
set_option
)(
struct
object_header
*
,
DWORD
,
void
*
,
DWORD
);
...
...
@@ -370,6 +371,7 @@ DWORD netconn_recv( struct netconn *, void *, size_t, int, int * ) DECLSPEC_HIDD
DWORD
netconn_resolve
(
WCHAR
*
,
INTERNET_PORT
,
struct
sockaddr_storage
*
,
int
)
DECLSPEC_HIDDEN
;
DWORD
netconn_secure_connect
(
struct
netconn
*
,
WCHAR
*
,
DWORD
,
CredHandle
*
,
BOOL
)
DECLSPEC_HIDDEN
;
DWORD
netconn_send
(
struct
netconn
*
,
const
void
*
,
size_t
,
int
*
,
WSAOVERLAPPED
*
)
DECLSPEC_HIDDEN
;
void
netconn_cancel_io
(
struct
netconn
*
conn
)
DECLSPEC_HIDDEN
;
DWORD
netconn_set_timeout
(
struct
netconn
*
,
BOOL
,
int
)
DECLSPEC_HIDDEN
;
BOOL
netconn_is_alive
(
struct
netconn
*
)
DECLSPEC_HIDDEN
;
const
void
*
netconn_get_certificate
(
struct
netconn
*
)
DECLSPEC_HIDDEN
;
...
...
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