Commit 5fb49243 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Use processed string from server_t for constructing proxy path.

parent 3cf2838a
......@@ -1679,41 +1679,25 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
return TRUE;
}
static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
static WCHAR *build_proxy_path_url(http_request_t *req)
{
static const WCHAR slash[] = { '/',0 };
static const WCHAR format[] = { 'h','t','t','p',':','/','/','%','s',':','%','u',0 };
static const WCHAR formatSSL[] = { 'h','t','t','p','s',':','/','/','%','s',':','%','u',0 };
http_session_t *session = req->session;
WCHAR new_location[INTERNET_MAX_URL_LENGTH], *url;
DWORD size;
size = sizeof(new_location);
if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_LOCATION, new_location, &size, NULL) == ERROR_SUCCESS)
{
URL_COMPONENTSW UrlComponents;
if (!(url = heap_alloc(size + sizeof(WCHAR)))) return NULL;
strcpyW( url, new_location );
DWORD size, len;
WCHAR *url;
ZeroMemory(&UrlComponents,sizeof(URL_COMPONENTSW));
if(InternetCrackUrlW(url, 0, 0, &UrlComponents)) goto done;
heap_free(url);
}
len = strlenW(req->server->scheme_host_port);
size = len + strlenW(req->path) + 1;
if(*req->path != '/')
size++;
url = heap_alloc(size * sizeof(WCHAR));
if(!url)
return NULL;
size = 16; /* "https://" + sizeof(port#) + ":/\0" */
size += strlenW( session->hostName ) + strlenW( req->path );
memcpy(url, req->server->scheme_host_port, len*sizeof(WCHAR));
if(*req->path != '/')
url[len++] = '/';
if (!(url = heap_alloc(size * sizeof(WCHAR)))) return NULL;
strcpyW(url+len, req->path);
if (req->hdr.dwFlags & INTERNET_FLAG_SECURE)
sprintfW( url, formatSSL, session->hostName, session->hostPort );
else
sprintfW( url, format, session->hostName, session->hostPort );
if (req->path[0] != '/') strcatW( url, slash );
strcatW( url, req->path );
done:
TRACE("url=%s\n", debugstr_w(url));
return url;
}
......@@ -4856,7 +4840,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if (request->session->appInfo->proxy && request->session->appInfo->proxy[0])
{
WCHAR *url = HTTP_BuildProxyRequestUrl(request);
WCHAR *url = build_proxy_path_url(request);
requestString = HTTP_BuildHeaderRequestString(request, request->verb, url, request->version);
heap_free(url);
}
......
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