Commit cee99826 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Return an error on redirect with no host name specified.

Inspired by Michael Müller's patch. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 61e28c01
......@@ -4058,6 +4058,9 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, WCHAR *url)
urlComponents.dwUrlPathLength = 1;
if(!InternetCrackUrlW(url, url_len, 0, &urlComponents))
return INTERNET_GetLastError();
if(!urlComponents.dwHostNameLength)
return ERROR_INTERNET_INVALID_URL;
}
INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REDIRECT,
......
......@@ -5269,6 +5269,31 @@ static void test_redirect(int port)
close_connection();
close_async_handle(req.session, 2);
trace("Test redirect to http URL with no host name...\n");
open_socket_request(port, &req);
SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
server_send_string("HTTP/1.1 302 Found\r\n"
"Server: winetest\r\n"
"Location: http:///nohost\r\n"
"Connection: keep-alive\r\n"
"Content-Length: 0\r\n"
"\r\n");
WaitForSingleObject(complete_event, INFINITE);
CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
ok(req_error == ERROR_INTERNET_INVALID_URL, "expected ERROR_INTERNET_INVALID_URL, got %u\n", req_error);
sprintf(expect_url, "http://localhost:%u/socket", port);
test_request_url(req.request, expect_url);
test_status_code(req.request, 302);
close_connection();
close_async_handle(req.session, 2);
skip_receive_notification_tests = FALSE;
}
......
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