From: Hans Lehnert hans.lehnert@gmail.com
Add tests for using 0 in header length passed to HttpSendRequestA and HttpSendRequestW --- dlls/wininet/tests/http.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 6edab2141ae..08ae8b9e91d 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -6574,6 +6574,29 @@ static void test_large_content(int port) close_connection(); }
+static void test_header_length(int port) +{ + test_request_t req; + BOOL ret; + char buf[1000]; + char header[] = "Test-Header: winetest"; + + open_simple_request(&req, "localhost", port, "GET", "/echo_request"); + + ret = HttpSendRequestA(req.request, header, 0, NULL, 0); + ok(ret == FALSE, "HttpSendRequestA should have failed\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER\n"); + + ret = HttpSendRequestW(req.request, L"Test-Header: winetest", 0, NULL, 0); + ok(ret, "HttpSendRequestW failed: %lu\n", GetLastError()); + test_status_code(req.request, 200); + + receive_simple_request(req.request, buf, sizeof(buf)); + ok(strstr(buf, header) != NULL, "custom header was not sent: %s\n", buf); + + close_request(&req); +} + static void test_http_connection(void) { struct server_info si; @@ -6640,6 +6663,7 @@ static void test_http_connection(void) test_persistent_connection(si.port); test_remove_dot_segments(si.port); test_large_content(si.port); + test_header_length(si.port);
/* send the basic request again to shutdown the server thread */ test_basic_request(si.port, "GET", "/quit");