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>
This commit is contained in:
Andrew Eikum 2016-08-31 14:21:05 -05:00 committed by Alexandre Julliard
parent 668d4299b0
commit c8b166e3bf
2 changed files with 32 additions and 3 deletions

View File

@ -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 );

View File

@ -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_ */