It turns out that WinHttpReceiveResponse() completes synchronously in async mode (unless recursive request for handling authorization or redirect is involved). Some apps depend on that and do not wait for WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, calling WinHttpQueryHeaders() or WinHttpWebSocketCompleteUpgrade() right after calling WinHttpReceiveResponse, relying on that to finish synchronously.
My initial out of tree testing shows that no network communication is performed during WinHttpReceiveResponse() call (when recursive request is not involved). I tested that by inserting a wait between WinHttpSendRequest and WinHttpReceiveResponse and disabling network connection during the wait. WinHttpReceiveResponse still succeeds on Windows.
I think the above means that the actual response receiving from server is performed during WinHttpSendRequest. WinHttpReceiveResponse is not a complete no-op however. As shown by the existing tests the notifications related to receiving response are still delivered during WinHttpReceiveResponse (albeit in the same thread). Also WinHttpReceiveResponse affects request state: querying headers or upgrading to websocket without calling WinHttpReceiveResponse does not succeed.
When redirect is involved, all the WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED and WINHTTP_CALLBACK_STATUS_REDIRECT notifications are delivered synchronously from the calling thread. Then, the new request send notifications and response receiving notifications are delivered from the new thread.
An interesting case is when WinHttpReceiveResponse is called from SendRequest callbacks in async mode. If WinHttpReceiveResponse is called from WINHTTP_CALLBACK_STATUS_SENDING_REQUEST or WINHTTP_CALLBACK_STATUS_REQUEST_SENT (i. e., when request is not complete yet), calling WinHttpReceiveResponse() suddenly succeeds an shows the following message sequence (that is partially reflected in the tests I am adding):
- calling WinHttpReceiveResponse from WINHTTP_CALLBACK_STATUS_SENDING_REQUEST (which is already called on the async thread on Win10, thread A). Win8 queues WINHTTP_CALLBACK_STATUS_SENDING_REQUEST synchronously and goes async a bit later.
- WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, thread A;
- WinHttpReceiveResponse() returns to the caller WINHTTP_CALLBACK_STATUS_REQUEST_SENT callback; returning from user callback;
- WINHTTP_CALLBACK_STATUS_REQUEST_SENT, thread A;
- WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE (another thread, although the sequence is probably synced; I am not implementing this part and calling this callback from the same thread A);
- WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED in thread A;
- WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE in thread A.
So the receive_response() state RECEIVE_RESPONSE_SEND_INCOMPLETE is primarily needed to handle this case.
--
v3: winhttp/tests: Test calling WinHttpReceiveResponse() recursively from various send callbacks.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1582
The glMapBuffer and al. functions are all duplicated between EXT/ARB and
core functions, and we reduced code duplication by redirecting the EXT
to the core functions.
The internal function table is only filled as the functions are queried,
and it causes crahes when games are using the EXT functions without
querying the core function first.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53990
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1760
--
v8: mfmediaengine: Add a fallback when the set engine format cannot be used to init samplegrabber.
mfmediaengine/tests: Test possible engine and output texture formats.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1046
We are still using exported string functions internally,
and that caused mismatches after recent incomplete switching to crt functions.
There is also no evidence that crt functions are used at all there,
so for now switch back to fix mismatching calls.
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1758
This is called a huge number of time every time the module is loaded. The function does a lot of things, which I believe aren't necessary for uxtheme string comparison. The impact on process startup is noticeable, and this saves ~1min on the Gitlab CI test run.
Instead, convert strings to uppercase beforehand in a locale-independent way, and compare with wcscmp.
--
v2: uxtheme: Use bsearch and CompareStringOrdinal in MSSTYLES_LookupProperty.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1681
This is called a huge number of time every time the module is loaded. The function does a lot of things, which I believe aren't necessary for uxtheme string comparison. The impact on process startup is noticeable, and this saves ~1min on the Gitlab CI test run.
Instead, convert strings to uppercase beforehand in a locale-independent way, and compare with wcscmp.
--
v3: uxtheme: Use bsearch and CompareStringOrdinal in MSSTYLES_LookupProperty.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1681
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53176
1) The async test is broken on Windows 10 1507. This appears to be a trend among WinRT dlls. I'm thinking that we can add macro definitions for each testbot VM to avoid having to skip tests that would otherwise be working fine, and just greater control over tests in general.
2) The provider file that contains `interface IWineAsyncInfoImpl` is likely going to be reused again in the future. Perhaps a new file can be added in the include/wine folder to prevent duplicate code? I can do this in a separate merge request and cleanup the existing provider files.
3) All the check_bool_async tests return a random async_id so I skipped them. Testbot example: https://testbot.winehq.org/JobDetails.pl?Key=127232&f208=exe32.report#k208
--
v5: cryptowinrt/tests: Add IKeyCredentialManagerStatics_IsSupportedAsync tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1714
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53176
1) The async test is broken on Windows 10 1507. This appears to be a trend among WinRT dlls. I'm thinking that we can add macro definitions for each testbot VM to avoid having to skip tests that would otherwise be working fine, and just greater control over tests in general.
2) The provider file that contains `interface IWineAsyncInfoImpl` is likely going to be reused again in the future. Perhaps a new file can be added in the include/wine folder to prevent duplicate code? I can do this in a separate merge request and cleanup the existing provider files.
3) All the check_bool_async tests return a random async_id so I skipped them. Testbot example: https://testbot.winehq.org/JobDetails.pl?Key=127232&f208=exe32.report#k208
--
v4: cryptowinrt/tests: Add IKeyCredentialManagerStatics_IsSupportedAsync tests.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1714