From c2e5df57b52e28d5330bfed8a288a912d7dba9bd Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 5 Jan 2015 16:17:23 +0000 Subject: [PATCH] extend http_connection unit test to cover no keep-alive --- test/test_http_connection.cpp | 7 +++++++ test/web_server.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/test/test_http_connection.cpp b/test/test_http_connection.cpp index c17d2eddd..1159a7da0 100644 --- a/test/test_http_connection.cpp +++ b/test/test_http_connection.cpp @@ -225,10 +225,17 @@ int test_main() #endif // test chunked encoding + fprintf(stderr, "\ntest chunked encoding\n\n"); port = start_web_server(false, true); ps.type = settings_pack::none; run_suite("http", ps, port); + // test no keep-alive + fprintf(stderr, "\ntest no keep-alive\n\n"); + port = start_web_server(false, false, false); + ps.type = settings_pack::none; + run_suite("http", ps, port); + stop_web_server(); std::remove("test_file"); return 0; diff --git a/test/web_server.py b/test/web_server.py index 5c55dbb53..2baabba0a 100644 --- a/test/web_server.py +++ b/test/web_server.py @@ -124,6 +124,10 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler): s.send_header('Content-Encoding', 'gzip') if not keepalive: s.send_header("Connection", "close") + try: + s.request.shutdown(SHUT_RD); + except Exception, e: + print 'Failed to shutdown read-channel of socket: ', e s.end_headers()