extend http_connection unit test to cover no keep-alive
This commit is contained in:
parent
a462f58372
commit
c2e5df57b5
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue