Module: wine Branch: master Commit: c8b166e3bf4e4a4fe865f7216340a35f5394cc96 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c8b166e3bf4e4a4fe865f72163...
Author: Andrew Eikum aeikum@codeweavers.com Date: Wed Aug 31 14:21:05 2016 -0500
winhttp: Also pass hostname to jsproxy.
Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winhttp/session.c | 20 +++++++++++++++++--- dlls/winhttp/winhttp_private.h | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 90e7946..600624c 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -1813,6 +1813,7 @@ static BOOL run_script( char *script, DWORD size, const WCHAR *url, WINHTTP_PROX char *result, *urlA; DWORD len_result; struct AUTO_PROXY_SCRIPT_BUFFER buffer; + URL_COMPONENTSW uc;
buffer.dwStructSize = sizeof(buffer); buffer.lpszScriptBuffer = script; @@ -1824,10 +1825,23 @@ static BOOL run_script( char *script, DWORD size, const WCHAR *url, WINHTTP_PROX heap_free( urlA ); return FALSE; } - if ((ret = InternetGetProxyInfo( urlA, strlen(urlA), NULL, 0, &result, &len_result ))) + + memset( &uc, 0, sizeof(uc) ); + uc.dwStructSize = sizeof(uc); + uc.dwHostNameLength = -1; + + if (WinHttpCrackUrl( url, 0, 0, &uc )) { - ret = parse_script_result( result, info ); - heap_free( result ); + char *hostnameA = strdupWA_sized( uc.lpszHostName, uc.dwHostNameLength ); + + if ((ret = InternetGetProxyInfo( urlA, strlen(urlA), + hostnameA, strlen(hostnameA), &result, &len_result ))) + { + ret = parse_script_result( result, info ); + heap_free( result ); + } + + heap_free( hostnameA ); } heap_free( urlA ); return InternetDeInitializeAutoProxyDll( NULL, 0 ); diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index b3e28d2..388fc33 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -365,4 +365,19 @@ static inline char *strdupWA( const WCHAR *src ) return dst; }
+static inline char *strdupWA_sized( const WCHAR *src, DWORD size ) +{ + char *dst = NULL; + if (src) + { + int len = WideCharToMultiByte( CP_ACP, 0, src, size, NULL, 0, NULL, NULL ) + 1; + if ((dst = heap_alloc( len ))) + { + WideCharToMultiByte( CP_ACP, 0, src, len, dst, size, NULL, NULL ); + dst[len - 1] = 0; + } + } + return dst; +} + #endif /* _WINE_WINHTTP_PRIVATE_H_ */