Commit c8b166e3 authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

winhttp: Also pass hostname to jsproxy.

parent 668d4299
......@@ -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 );
......
......@@ -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_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment