mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 20:18:28 +00:00
wininet: Canonicalize URL in HttpOpenRequest.
Signed-off-by: Daniel Lehman <dlehman@esri.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4eac6e84ba
commit
b3d12a16ce
2 changed files with 23 additions and 3 deletions
|
@ -3401,13 +3401,14 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
|
|||
|
||||
if (lpszObjectName && *lpszObjectName) {
|
||||
HRESULT rc;
|
||||
WCHAR dummy;
|
||||
|
||||
len = 0;
|
||||
rc = UrlEscapeW(lpszObjectName, NULL, &len, URL_ESCAPE_SPACES_ONLY);
|
||||
len = 1;
|
||||
rc = UrlCanonicalizeW(lpszObjectName, &dummy, &len, URL_ESCAPE_SPACES_ONLY);
|
||||
if (rc != E_POINTER)
|
||||
len = strlenW(lpszObjectName)+1;
|
||||
request->path = heap_alloc(len*sizeof(WCHAR));
|
||||
rc = UrlEscapeW(lpszObjectName, request->path, &len,
|
||||
rc = UrlCanonicalizeW(lpszObjectName, request->path, &len,
|
||||
URL_ESCAPE_SPACES_ONLY);
|
||||
if (rc != S_OK)
|
||||
{
|
||||
|
|
|
@ -2402,6 +2402,10 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
|||
send(c, okmsg, sizeof(okmsg)-1, 0);
|
||||
send(c, buffer, strlen(buffer), 0);
|
||||
}
|
||||
if (strstr(buffer, "GET /test_remove_dot_segments"))
|
||||
{
|
||||
send(c, okmsg, sizeof(okmsg)-1, 0);
|
||||
}
|
||||
shutdown(c, 2);
|
||||
closesocket(c);
|
||||
c = -1;
|
||||
|
@ -4851,6 +4855,20 @@ static void test_long_url(int port)
|
|||
close_request(&req);
|
||||
}
|
||||
|
||||
static void test_remove_dot_segments(int port)
|
||||
{
|
||||
test_request_t req;
|
||||
BOOL ret;
|
||||
|
||||
open_simple_request(&req, "localhost", port, NULL, "/A/../B/./C/../../test_remove_dot_segments");
|
||||
|
||||
ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
|
||||
ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
|
||||
test_status_code(req.request, 200);
|
||||
|
||||
close_request(&req);
|
||||
}
|
||||
|
||||
static void test_http_connection(void)
|
||||
{
|
||||
struct server_info si;
|
||||
|
@ -4902,6 +4920,7 @@ static void test_http_connection(void)
|
|||
test_async_read(si.port);
|
||||
test_http_read(si.port);
|
||||
test_long_url(si.port);
|
||||
test_remove_dot_segments(si.port);
|
||||
|
||||
/* send the basic request again to shutdown the server thread */
|
||||
test_basic_request(si.port, "GET", "/quit");
|
||||
|
|
Loading…
Reference in a new issue