Commit 13ba609b authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Use default values when empty strings are passed for verb, object and version parameters.

parent f732065c
......@@ -272,9 +272,9 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
if (!netconn_init( &request->netconn, request->hdr.flags & WINHTTP_FLAG_SECURE )) goto end;
if (!verb) verb = get;
if (!object) object = slash;
if (!version) version = http1_1;
if (!verb || !*verb) verb = get;
if (!object || !*object) object = slash;
if (!version || !*version) version = http1_1;
if (!(request->verb = strdupW( verb ))) goto end;
if (!(request->path = strdupW( object ))) goto end;
......
......@@ -573,6 +573,45 @@ static void test_secure_connection(void)
WinHttpCloseHandle(ses);
}
static void test_request_parameter_defaults(void)
{
static const WCHAR empty[] = {0};
static const WCHAR codeweavers[] = {'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
HANDLE ses, con, req;
BOOL ret;
ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
ok(ses != NULL, "failed to open session %u\n", GetLastError());
con = WinHttpConnect(ses, codeweavers, 0, 0);
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
ok(req != NULL, "failed to open a request %u\n", GetLastError());
ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
ok(ret, "failed to send request %u\n", GetLastError());
ret = WinHttpReceiveResponse(req, NULL);
ok(ret, "failed to receive response %u\n", GetLastError());
WinHttpCloseHandle(req);
req = WinHttpOpenRequest(con, empty, empty, empty, NULL, NULL, 0);
ok(req != NULL, "failed to open a request %u\n", GetLastError());
ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
ok(ret, "failed to send request %u\n", GetLastError());
ret = WinHttpReceiveResponse(req, NULL);
ok(ret, "failed to receive response %u\n", GetLastError());
WinHttpCloseHandle(req);
WinHttpCloseHandle(con);
WinHttpCloseHandle(ses);
}
START_TEST (winhttp)
{
test_OpenRequest();
......@@ -581,4 +620,5 @@ START_TEST (winhttp)
test_WinHttpTimeToSystemTime();
test_WinHttpAddHeaders();
test_secure_connection();
test_request_parameter_defaults();
}
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