Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
OS: Windows XP SP3. Application should download the picture from the website via https protocol. As a result, WinHttpSendRequest returns an error -2146893018. Here is the code snippet:

What I have tried:

C++
hRequest = WinHttpOpenRequest(hConnect, L"GET", Path, Protocol, 0, 0, WINHTTP_FLAG_SECURE);

    if(hRequest){
        bResults = WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0,
                                      WINHTTP_NO_REQUEST_DATA, 0, 0, 0);
    ...
    }

This problem is only on WinXP. On Windows 7 - everything works fine.

But if try to download another image from another website via http protocol (replacing WINHTTP_FLAG_SECURE with 0), then everything works fine. What's wrong?
Posted
Updated 11-Feb-19 6:59am
Comments
Richard MacCutchan 11-Feb-19 6:38am    
The error code is actually 80090326: see error 80090326 - Google Search[^] for potential causes.
Igor-84 11-Feb-19 6:49am    
Described as: "The message received was unexpected or badly formatted". What should I fix in my code?
Richard MacCutchan 11-Feb-19 6:56am    
You need to look at the data being passed between your client and server. No one here can guess what is wrong with it.
Igor-84 11-Feb-19 7:05am    
And how to do it?
P.S. picture downloads from google images
Richard MacCutchan 11-Feb-19 7:25am    
Use your debugger, or add some logging code. Debugging your applications is an essential part of being a developer. It is a skill you need to work on.

The "problem" is that you are "expecting" both XP and Windows 7 to "act the same".

The fact that Windows 7 still gets updates and not XP probably means there are "differences".

The fact that you found a method that works but still wonder "why" the other method doesn't shouldn't be a concern at this point.
 
Share this answer
 
It is looks like I found explanation why WinHttpSendRequest() returned an error -2146893018 or 2148074278 on Windows XP SP3.
The problem is the version of the TLS encryption protocol that WinXP system uses is TLS 1.0.
Some websites that works on https don't support TLS version 1.0. Highly likely, such websites reject connection if client tries to communicate with them.
Therefore, Windows 7 uses TLS version 1.1 and 1.2. Thus and so such websites work with clients correctly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900