Search code examples
vb6fiddlerwinhttp

Application Needs Fiddler to Execute Properly on Some PCs


I have a VB6 application that only runs under certain conditions. When it fails (on the send statement below), it generates a

Run-time error '-2147012867 (80072efd)': A connection with the server could not be established

The funny thing is that it always runs when Fiddler is running. On some machines it runs whether or not Fiddler is running, but on other machines it will only run when Fiddler is running. Fiddler doesn't even have to be capturing traffic for it to run.

The request is to an https site.

The code looks like this:

Set xhr = CreateObject("WinHttp.WinHttpRequest.5.1")
xhr.open "POST", sUrl, bAsync
xhr.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xhr.setRequestHeader "Content-Length", Len(sBody)
xhr.send sBody

I've read the Telerik article, Help! Running Fiddler Fixes My App???, but none of the suggested solutions seems to work.

Can anyone provide me with any insight on what might be wrong or how I can solve this?


Solution

  • Could you check your WinHttpSettings registry key settings?

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\WinHttpSettings

    Default value (no proxy) is enter image description here

    I suppose that Fiddler modified this configuration in order to act as proxy.

    If Fiddler is not running => no proxy => connection error.

    In WinHttpRequest, if setProxy is not explicitly called => HTTPREQUEST_PROXYSETTING_DEFAULT => HTTPREQUEST_PROXYSETTING_PRECONFIG

    HTTPREQUEST_PROXYSETTING_PRECONFIG

    Indicates that the proxy settings should be obtained from the registry.