I'm wondering if it is possible with the Windows API WinHTTP to use HTTP/2 multiplexing (multiple requests over one TCP connection). If so, is there example code how to archieve this?
I found this message from Microsoft (https://docs.microsoft.com/en-us/windows/win32/winhttp/about-winhttp):
Caution
WinHTTP is not reentrant except during asynchronous completion callback. That is, while a thread has a call pending to one of the WinHTTP functions such as WinHttpSendRequest, WinHttpReceiveResponse, WinHttpQueryDataAvailable, WinHttpSendData, or WinHttpWriteData, it must never call WinHTTP a second time until the first call has completed. One scenario under which a second call could occur is as follows: If an application queues an Asynchronous Procedure Call (APC) to the thread that calls into WinHTTP, and if WinHTTP performs an alertable wait internally, the APC can run. If the APC routine happens also to call WinHTTP, it reenters the WinHTTP API, and the internal state of WinHTTP can be corrupted.
That's why I'm not sure if asynchronous calls of WinHttpReadData are possible.