Results 1 to 12 of 12

Thread: WinHTTP - a way to ignore unrecognized response error?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    WinHTTP - a way to ignore unrecognized response error?

    Is there some way which will force WinHTTP to receive response regardless of what it contains? When I trace HTTP request and response headers all is good, but sometimes when using Windows 7 right after invoking .Send command I get an error that response is invalid or unrecognized, but it seems fine in tracer. I can't do anything to solve it because I've searched the whole Internet but with no success.
    Also it may be useful to note that this never happens on my XP machine.
    Last edited by MikiSoft; Sep 22nd, 2015 at 01:08 PM.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WinHTTP - a way to ignore unrecognized response error?

    What is the Status and StatusText (the number and exact text) that you (a.) expect based on what you see in the trace, and (b.) are reported to you by the WinHttpRequest object? Also, what HTTP method is involved (GET, PUT, POST, etc.)?

    There are long-standing UrlMon/WinInet quirks regarding certain scenarios Microsoft will probably never change, and it sounds like WinHTTP might have been written to mimic them.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: WinHTTP - a way to ignore unrecognized response error?

    It's a GET request and I can't read Status, StatusText, ResponseText, etc. because the error fires immediately after invoking .Send command so the status doesn't change.
    The error message is: "The server returned an invalid or unrecognized response."
    Last edited by MikiSoft; Sep 22nd, 2015 at 02:51 PM.

  4. #4
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: WinHTTP - a way to ignore unrecognized response error?

    Are you sure, you always create a new Instance of the http-51-Class for any new request?

    If not - and you re-use an existing instance for follow-up-requests...
    do you "clean them up first (per .Abort or something)?

    Is it async-mode we talk about?

    If not - do you work through a Proxy?

    A "bad WLan-Conn" or "faulty Networkdrivers" or "overzealous VirusScanners"
    could also be at play...

    Olaf

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: WinHTTP - a way to ignore unrecognized response error?

    Quote Originally Posted by Schmidt View Post
    Are you sure, you always create a new Instance of the http-51-Class for any new request?
    I create a new instance of WinHTTP class per each request, thanks to your wrapper that you had posted earlier when I was asking about it.

    Quote Originally Posted by Schmidt View Post
    If not - and you re-use an existing instance for follow-up-requests...
    do you "clean them up first (per .Abort or something)?

    Is it async-mode we talk about?

    If not - do you work through a Proxy?

    A "bad WLan-Conn" or "faulty Networkdrivers" or "overzealous VirusScanners"
    could also be at play...
    None of that. It's weird how it can flawlessly work on XP but to fail occasionally on newer Windows. And I forgot to mention that I'm not the only one who have experienced such thing.

    I'm wondering why they decided to display the error of invalid/unrecognized response but not to allow to see its contents? If some workaround is possible which can bypass that error and show the response then I could easily fix that.
    Last edited by MikiSoft; Sep 22nd, 2015 at 06:36 PM.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WinHTTP - a way to ignore unrecognized response error?

    I don't know of any WinHttpRequest issues peculiar to supported (post-XP) versions of Windows and I use them all the time. Re-using them should not be a problem. You just need to call Abort if you interrupt one doing an async request.

    I have no idea what a wrapper is going to do for you, the object is already quite a clean wrapper around the low-level WinHTTP API. That's almost like saying you need a wrapper for a TextBox or something.


    It sounds like:

    ERROR_WINHTTP_INVALID_SERVER_RESPONSE 12152

    The server response cannot be parsed.
    Also known as 0x80072F78:The server returned an invalid or unrecognized response.

    Reason

    This error code 0x80072F78 is defined as "ERROR_WINHTTP_INVALID_SERVER_RESPONSE"

    These errors are often caused by small interruptions in communications between the client and the server.

    Sounds like either a faulty server or an erratic communication path.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: WinHTTP - a way to ignore unrecognized response error?

    I currently don't use async requests so no need for .Abort. So, my question still remains: Is there a fix for this which will show the response, regardless of that parsing error?

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WinHTTP - a way to ignore unrecognized response error?

    No, I don't think there is. Not even if you were using the low-level C++ API.

    I sure haven't run into it. Are these HTTPS URLs? Most people I see whinging on about this are using SSL and the problem started after security updates eliminated the use of older ciphers a little while back. Since XP is dead, it doesn't get such security updates anymore.

    Since you seem to be making the simplest of synchronous requests you can probably try substituting MSXML2.XMLHTTP since nearly all of the members are named the same with only some changes in the case of the names. Should be a drop-in replacement for you.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: WinHTTP - a way to ignore unrecognized response error?

    On the request where that occurs it is HTTP URL, but a site which uses both HTTP and HTTPS is with no doubt bad configured.
    Thanks for the answer. I was considering to try MSXML2.XMLHTTP but I've read that it caches pages and I don't want that. I've read that sending a "Cache-Control: no-cache" request header will work, but I don't know for cookies? There probably isn't any switch which can easily disable caching of both. Also, I don't know which version to use because I see that there are plenty of them.
    Last edited by MikiSoft; Sep 23rd, 2015 at 08:21 AM.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2011
    Posts
    461

    Re: WinHTTP - a way to ignore unrecognized response error?

    I've tested it right now and it works with MSXML2.XMLHTTP object without throwing the bogus error, now the problem is caching so I've found possible solutions here but none of them worked:
    http://stackoverflow.com/questions/5...trol-directive

    So yeah, thanks Microsoft for making my life hard where it should be easy enough.
    Last edited by MikiSoft; Sep 23rd, 2015 at 10:24 AM.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WinHTTP - a way to ignore unrecognized response error?

    Quote Originally Posted by MikiSoft View Post
    There probably isn't any switch which can easily disable caching of both. Also, I don't know which version to use because I see that there are plenty of them.
    There are things you can add to the request headers to force new pages to be retrieved but when they arrive they probably still get cached. Cookies you can't really do much about.

    All of the versions of MSXML are usable except for 5.0 which is part of Office and not for non-Office use. 4.0 is considered "dead" and was replaced by the 6.0 library. 3.0 is provided even though it lacks some XML features and has a few different XML option settings... but you aren't using the XML components so it hardly matters. 2.0 is a complete dud and should never be used. 3.0 is there because it is a viable "least-common-denominator" preinstalled in every viable versions of Windows and you'd have a hard time finding even a Win95 system that didn't have it since it got installed with IE 5.0 or earlier on those old OSs.

    So your choice is between 3.0 and 6.0, and for your purposes it doesn't matter. Since you are not using any DOM or SAX2 objects they both have identical code as far as you are concerned: just the WinInet wrapper XMLHTTP (which only has XML in its name because it is often used with DOM objects).

    All of which has been widely discussed by Microsoft for a decade, and rehashed many more times here in other threads.


    We still can't be sure why your problems with WinHTTP occur. One guess is that Windows Update Will Disable 'Broken' RC4 Encryption. In other words all versions of the MSXML libraries probably still accept "SSL" based on obsolete ciphers, while WinHTTP, BITS, etc. reject it.

    If so the problem is the server you are hitting, which is using unsafe "secure" connections and seriously needs a software update itself.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: WinHTTP - a way to ignore unrecognized response error?

    I just tried a program that uses WinHttpRequest on a Vista SP2 machine with HTTPS against 3 different servers. No problems at all, just as expected.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width