From 94e41538b6c064dd27938d4470808cde4f07d21f Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 16 Jul 2015 00:44:03 -0400 Subject: [PATCH] fix SSL web-seed test --- test/test_url_seed.cpp | 29 ++++++++++++++++++++++------- test/web_server.py | 4 +--- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/test/test_url_seed.cpp b/test/test_url_seed.cpp index 6defb0603..21c34406e 100644 --- a/test/test_url_seed.cpp +++ b/test/test_url_seed.cpp @@ -38,15 +38,30 @@ using namespace libtorrent; const int proxy = libtorrent::settings_pack::none; +#ifdef TORRENT_USE_OPENSSL +TORRENT_TEST(url_seed_ssl_keepalive) +{ + run_http_suite(proxy, "https", 1, 0, 0, 1); +} + +TORRENT_TEST(url_seed_ssl) +{ + run_http_suite(proxy, "https", 1, 0, 0, 0); +} +#endif + +TORRENT_TEST(url_seed_keepalive) +{ + run_http_suite(proxy, "http", 1, 0, 0, 1); +} + TORRENT_TEST(url_seed) { - for (int keepalive = 0; keepalive < 2; ++keepalive) - { -#ifdef TORRENT_USE_OPENSSL - run_http_suite(proxy, "https", 1, 0, 0, keepalive); -#endif - run_http_suite(proxy, "http", 1, 0, 0, keepalive); - } + run_http_suite(proxy, "http", 1, 0, 0, 0); +} + +TORRENT_TEST(url_seed_keepalive_rename) +{ run_http_suite(proxy, "http", 1, 0, 0, 1, 1); } diff --git a/test/web_server.py b/test/web_server.py index fd1d76208..369866ac1 100755 --- a/test/web_server.py +++ b/test/web_server.py @@ -7,7 +7,6 @@ import os import ssl import gzip import base64 -import socket chunked_encoding = False keepalive = True @@ -148,7 +147,7 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler): if not keepalive: s.send_header("Connection", "close") try: - s.request.shutdown(socket.SHUT_RD); + s.request.shutdown(); except Exception, e: print 'Failed to shutdown read-channel of socket: ', e @@ -175,7 +174,6 @@ class http_handler(SimpleHTTPServer.SimpleHTTPRequestHandler): s.send_header("Content-Length", "0") s.end_headers() - if __name__ == '__main__': port = int(sys.argv[1]) chunked_encoding = sys.argv[2] != '0'