From 33d006df99bd9da73b5114b1d3d71f574c301329 Mon Sep 17 00:00:00 2001 From: arvidn Date: Tue, 19 Nov 2019 09:39:19 +0100 Subject: [PATCH] add unit tests for http_connection over plain HTTP proxy --- test/test_http_connection.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/test_http_connection.cpp b/test/test_http_connection.cpp index 0009c56d8..fa9b1c958 100644 --- a/test/test_http_connection.cpp +++ b/test/test_http_connection.cpp @@ -217,7 +217,12 @@ void run_suite(std::string const& protocol , static_cast(h), h_errno); if (h == nullptr && h_errno == HOST_NOT_FOUND) { - run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 0, err(), ps); + // if we have a proxy, we'll be able to connect to it, we will just get an + // error from the proxy saying it failed to connect to the final target + if (protocol == "http" && (ps.type == settings_pack::http || ps.type == settings_pack::http_pw)) + run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 1, err(), ps); + else + run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 0, err(), ps); } if (ps.type != settings_pack::none) stop_proxy(ps.port); @@ -230,8 +235,15 @@ void run_suite(std::string const& protocol TORRENT_TEST(no_proxy_ssl) { run_suite("https", settings_pack::none); } TORRENT_TEST(http_ssl) { run_suite("https", settings_pack::http); } TORRENT_TEST(http_pw_ssl) { run_suite("https", settings_pack::http_pw); } +TORRENT_TEST(socks5_proxy_ssl) { run_suite("https", settings_pack::socks5); } +TORRENT_TEST(socks5_pw_proxy_ssl) { run_suite("https", settings_pack::socks5_pw); } #endif // USE_OPENSSL +TORRENT_TEST(http_proxy) { run_suite("http", settings_pack::http); } +TORRENT_TEST(http__pwproxy) { run_suite("http", settings_pack::http_pw); } +TORRENT_TEST(socks5_proxy) { run_suite("http", settings_pack::socks5); } +TORRENT_TEST(socks5_pw_proxy) { run_suite("http", settings_pack::socks5_pw); } + TORRENT_TEST(no_keepalive) { run_suite("http", settings_pack::none, 0);