Commit 216474c2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Use compose_request_url in INTERNET_OPTION_URL implementation.

parent 453e0e11
......@@ -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);
......
......@@ -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);
}
......
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