Module: wine Branch: master Commit: 5fb49243af34c9d5ed071c4afce6436a1fb36df5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5fb49243af34c9d5ed071c4afc...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Nov 19 11:47:50 2012 +0100
wininet: Use processed string from server_t for constructing proxy path.
---
dlls/wininet/http.c | 48 ++++++++++++++++-------------------------------- 1 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index af40b6f..9df90a9 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -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); }