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
34b3d212
Commit
34b3d212
authored
Nov 17, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Nov 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Send connection close notifications in finished_reading().
parent
f75a8b35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
25 deletions
+18
-25
request.c
dlls/winhttp/request.c
+12
-3
notification.c
dlls/winhttp/tests/notification.c
+6
-22
No files found.
dlls/winhttp/request.c
View file @
34b3d212
...
...
@@ -1704,10 +1704,8 @@ void close_connection( struct request *request )
{
if
(
!
request
->
netconn
)
return
;
send_callback
(
&
request
->
hdr
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
0
,
0
);
netconn_release
(
request
->
netconn
);
request
->
netconn
=
NULL
;
send_callback
(
&
request
->
hdr
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
0
,
0
);
}
static
DWORD
add_host_header
(
struct
request
*
request
,
DWORD
modifier
)
...
...
@@ -1868,7 +1866,7 @@ static DWORD refill_buffer( struct request *request, BOOL notify )
static
void
finished_reading
(
struct
request
*
request
)
{
BOOL
close
=
FALSE
;
BOOL
close
=
FALSE
,
notify
;
WCHAR
connection
[
20
];
DWORD
size
=
sizeof
(
connection
);
...
...
@@ -1884,7 +1882,18 @@ static void finished_reading( struct request *request )
else
if
(
!
wcscmp
(
request
->
version
,
L"HTTP/1.0"
))
close
=
TRUE
;
if
(
close
)
{
size
=
sizeof
(
connection
);
notify
=
(
!
query_headers
(
request
,
WINHTTP_QUERY_CONNECTION
|
WINHTTP_QUERY_FLAG_REQUEST_HEADERS
,
NULL
,
connection
,
&
size
,
NULL
)
||
!
query_headers
(
request
,
WINHTTP_QUERY_PROXY_CONNECTION
|
WINHTTP_QUERY_FLAG_REQUEST_HEADERS
,
NULL
,
connection
,
&
size
,
NULL
))
&&
!
wcsicmp
(
connection
,
L"close"
);
if
(
notify
)
send_callback
(
&
request
->
hdr
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
0
,
0
);
netconn_release
(
request
->
netconn
);
if
(
notify
)
send_callback
(
&
request
->
hdr
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
0
,
0
);
}
else
cache_connection
(
request
->
netconn
);
request
->
netconn
=
NULL
;
...
...
dlls/winhttp/tests/notification.c
View file @
34b3d212
...
...
@@ -146,8 +146,6 @@ static const struct notification cache_test[] =
{
winhttp_send_request
,
WINHTTP_CALLBACK_STATUS_REQUEST_SENT
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
{
winhttp_open_request
,
WINHTTP_CALLBACK_STATUS_HANDLE_CREATED
},
{
winhttp_send_request
,
WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER
,
NF_WINE_ALLOW
},
...
...
@@ -156,8 +154,6 @@ static const struct notification cache_test[] =
{
winhttp_send_request
,
WINHTTP_CALLBACK_STATUS_REQUEST_SENT
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
...
...
@@ -171,8 +167,6 @@ static const struct notification cache_test[] =
{
winhttp_send_request
,
WINHTTP_CALLBACK_STATUS_REQUEST_SENT
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
{
winhttp_open_request
,
WINHTTP_CALLBACK_STATUS_HANDLE_CREATED
},
{
winhttp_send_request
,
WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER
,
NF_WINE_ALLOW
},
...
...
@@ -181,8 +175,6 @@ static const struct notification cache_test[] =
{
winhttp_send_request
,
WINHTTP_CALLBACK_STATUS_REQUEST_SENT
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
}
...
...
@@ -442,8 +434,6 @@ static const struct notification redirect_test[] =
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_REQUEST_SENT
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
},
{
winhttp_receive_response
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
}
...
...
@@ -523,6 +513,8 @@ static const struct notification async_test[] =
{
winhttp_query_data
,
WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE
,
NF_SIGNAL
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE
,
NF_ALLOW
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED
,
NF_ALLOW
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
},
{
winhttp_read_data
,
WINHTTP_CALLBACK_STATUS_READ_COMPLETE
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
...
...
@@ -578,6 +570,10 @@ static void test_async( void )
ok
(
req
!=
NULL
,
"failed to open a request %lu
\n
"
,
err
);
ok
(
err
==
ERROR_SUCCESS
,
"got %lu
\n
"
,
err
);
ret
=
WinHttpAddRequestHeaders
(
req
,
L"Connection: close"
,
-
1L
,
WINHTTP_ADDREQ_FLAG_REPLACE
|
WINHTTP_ADDREQ_FLAG_ADD
);
err
=
GetLastError
();
ok
(
ret
,
"WinHttpAddRequestHeaders failed to add new header, got %d with error %lu
\n
"
,
ret
,
err
);
setup_test
(
&
info
,
winhttp_send_request
,
__LINE__
);
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSendRequest
(
req
,
NULL
,
0
,
NULL
,
0
,
0
,
0
);
...
...
@@ -685,8 +681,6 @@ static const struct notification websocket_test[] =
{
winhttp_websocket_receive
,
WINHTTP_CALLBACK_STATUS_READ_COMPLETE
,
NF_SAVE_BUFFER
|
NF_SIGNAL
},
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
};
...
...
@@ -708,8 +702,6 @@ static const struct notification websocket_test2[] =
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
,
NF_MAIN_THREAD
|
NF_SAVE_BUFFER
},
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
}
};
...
...
@@ -733,8 +725,6 @@ static const struct notification websocket_test3[] =
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
,
NF_SAVE_BUFFER
},
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
};
...
...
@@ -757,8 +747,6 @@ static struct notification websocket_test4[] =
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_REQUEST_ERROR
,
NF_SAVE_BUFFER
},
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
},
};
...
...
@@ -783,8 +771,6 @@ static const struct notification websocket_test5[] =
{
winhttp_websocket_close
,
WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE
,
NF_MAIN_THREAD
|
NF_SAVE_BUFFER
|
NF_SIGNAL
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_WINE_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
}
...
...
@@ -1626,8 +1612,6 @@ static const struct notification close_request_test[] =
static
const
struct
notification
close_allow_connection_close_request_test
[]
=
{
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION
,
NF_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED
,
NF_ALLOW
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
},
{
winhttp_close_handle
,
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING
,
NF_SIGNAL
}
...
...
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