http://bugs.winehq.org/show_bug.cgi?id=32438
Bug #: 32438 Summary: winhttp:winhttp conformance test WinHttpGetProxyForUrl() failure Product: Wine Version: 1.5.19 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: winhttp AssignedTo: wine-bugs@winehq.org ReportedBy: fgouget@codeweavers.com Classification: Unclassified
My laptop gets the following test failure (see the fg-acer64-* winetest results):
winhttp.c:2700: Test failed: got 12166
I looked into this and what's special about it is that its fqdn is 'hawai.free.fr'. I'm not 100% sure how this happens but I think it makes sense given that my ISP is free.fr so this is just the combination of the hostname 'hawai' and the default domain 'free.fr' (my other machines are on various private domains).
This causes WinHttpDetectAutoProxyConfigUrl() to check if wpad.free.fr is resolvable, which it is. So it succeeds and returns:
The problem is that wpad.free.fr is hosted on a virtual web host(1). That is a single web server with a single IP address hosts multiple web sites and uses the Host field in the HTTP header to determine which site is being accessed. So accessing this page by IP address fails while accessing it as http://wpad.free.fr/wpad.dat succeeds.
This error then causes WinHttpGetProxyForUrl() to fail because the string it is given to parse is an HTML HTTP 500 error page. I have confirmed that if WinHttpGetProxyForUrl() return http://wpad.free.fr/wpad.dat the test succeeds.
So why does WinHttpGetProxyForUrl() use the IP address to build the URL?
On Windows I could not get WinHttpDetectAutoProxyConfigUrl() to return anything but ERROR_WINHTTP_AUTODETECTION_FAILED. I suspect it gets a different domain name somehow.
(1) https://en.wikipedia.org/wiki/Virtual_hosting#Name-based
http://bugs.winehq.org/show_bug.cgi?id=32438
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source
http://bugs.winehq.org/show_bug.cgi?id=32438
--- Comment #1 from Hans Leidekker hans@meelstraat.net 2012-12-13 14:30:32 CST --- (In reply to comment #0) ...
So why does WinHttpGetProxyForUrl() use the IP address to build the URL?
It puzzled me too but that's what WinHttpDetectAutoProxyConfigUrl returned on the machine I tested with. Here's another person asking the same question:
http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/74b3c...
http://bugs.winehq.org/show_bug.cgi?id=32438
--- Comment #2 from François Gouget fgouget@codeweavers.com 2012-12-13 19:42:52 CST --- I have tweaked my setup so I now have a local wpad DNS entry which is an alias (CNAME) for another hostname. This lets me snoop the traffic to that host from the Windows hosts.
* On Windows XP WinHttpDetectAutoProxyConfigUrl() does use the IP address in the URL it returns. But on Windows 8 it clearly converted the IP address back to a hostname because it's using the wrong CNAME.
* With my setup trying to download the wpad.dat file always results in a 404 error instead of failing with a 500 error only if the wrong hostname is used.
* This results in WinHttpGetProxyForUrl() returning ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT on both Windows XP and Windows 8. In Wine I still get ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT instead. -> Wine should check for errors when trying to download the configuration script.
* On Windows XP and Windows 8, WinHttpGetProxyForUrl() results in two download attempts: one with the HTTP Host field set to the IP address, and one with it set to 'wpad' (no domain name), both made with the 'Wine Regression Test' user agent.
http://bugs.winehq.org/show_bug.cgi?id=32438
--- Comment #3 from Hans Leidekker hans@meelstraat.net 2012-12-19 01:45:09 CST --- This should work better with these commits: e6ab87ccfa78cffae5bcbe2c1dfc58b5ef7fb2ac 161112326734531004c38a2f17ff4f67207af64a
http://bugs.winehq.org/show_bug.cgi?id=32438
--- Comment #4 from Hans Leidekker hans@meelstraat.net 2013-03-28 04:10:25 CDT --- Is this fixed for you François?
https://bugs.winehq.org/show_bug.cgi?id=32438
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |161112326734531004c38a2f17f | |f4f67207af64a Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #5 from Hans Leidekker hans@meelstraat.net --- Should fixed by 161112326734531004c38a2f17ff4f67207af64a.
https://bugs.winehq.org/show_bug.cgi?id=32438
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.7.33.