forked from premiere/premiere-libtorrent
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
|
#endif
|
||||||
|
|
||||||
// test chunked encoding
|
// test chunked encoding
|
||||||
|
fprintf(stderr, "\ntest chunked encoding\n\n");
|
||||||
port = start_web_server(false, true);
|
port = start_web_server(false, true);
|
||||||
ps.type = settings_pack::none;
|
ps.type = settings_pack::none;
|
||||||
run_suite("http", ps, port);
|
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();
|
stop_web_server();
|
||||||
std::remove("test_file");
|
std::remove("test_file");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -124,6 +124,10 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
s.send_header('Content-Encoding', 'gzip')
|
s.send_header('Content-Encoding', 'gzip')
|
||||||
if not keepalive:
|
if not keepalive:
|
||||||
s.send_header("Connection", "close")
|
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()
|
s.end_headers()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue