Jacek Caban : wininet: Use compose_request_url in INTERNET_OPTION_URL implementation.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu May 19 10:32:06 CDT 2016
Module: wine
Branch: master
Commit: 216474c24e65e886d980426280ea52e591a95ada
URL: http://source.winehq.org/git/wine.git/?a=commit;h=216474c24e65e886d980426280ea52e591a95ada
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed May 18 18:02:30 2016 +0200
wininet: Use compose_request_url in INTERNET_OPTION_URL implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wininet/http.c | 15 ++++++++-------
dlls/wininet/tests/http.c | 12 +++++++++++-
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 14d4d1e..d1becf8 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2116,17 +2116,18 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
return ERROR_SUCCESS;
case INTERNET_OPTION_URL: {
- static const WCHAR httpW[] = {'h','t','t','p',':','/','/',0};
- WCHAR url[INTERNET_MAX_URL_LENGTH];
+ WCHAR *url;
+ DWORD res;
TRACE("INTERNET_OPTION_URL\n");
- strcpyW(url, httpW);
- strcatW(url, req->server->canon_host_port);
- strcatW(url, req->path);
+ url = compose_request_url(req);
+ if(!url)
+ return ERROR_OUTOFMEMORY;
- TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
- return str_to_buffer(url, buffer, size, unicode);
+ res = str_to_buffer(url, buffer, size, unicode);
+ heap_free(url);
+ return res;
}
case INTERNET_OPTION_USER_AGENT:
return str_to_buffer(req->session->appInfo->agent, buffer, size, unicode);
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 29dd965..f27db62 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -4720,8 +4720,9 @@ static void test_http_read(int port)
static void test_long_url(int port)
{
char long_path[INTERNET_MAX_PATH_LENGTH*2] = "/echo_request?";
- char buf[sizeof(long_path)*2];
+ char buf[sizeof(long_path)*2], url[sizeof(buf)];
test_request_t req;
+ DWORD size, len;
BOOL ret;
memset(long_path+strlen(long_path), 'x', sizeof(long_path)-strlen(long_path));
@@ -4735,6 +4736,15 @@ static void test_long_url(int port)
receive_simple_request(req.request, buf, sizeof(buf));
ok(strstr(buf, long_path) != NULL, "long pathnot found in %s\n", buf);
+ sprintf(url, "http://localhost:%u%s", port, long_path);
+
+ size = sizeof(buf);
+ ret = InternetQueryOptionA(req.request, INTERNET_OPTION_URL, buf, &size);
+ ok(ret, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
+ len = strlen(url);
+ ok(size == len, "size = %u, expected %u\n", size, len);
+ ok(!strcmp(buf, url), "Wrong URL %s, expected %s\n", buf, url);
+
close_request(&req);
}
More information about the wine-cvs
mailing list