add unit tests for http_connection over plain HTTP proxy

This commit is contained in:
arvidn 2019-11-19 09:39:19 +01:00 committed by Arvid Norberg
parent 3019b17c90
commit 33d006df99
1 changed files with 13 additions and 1 deletions

View File

@ -217,7 +217,12 @@ void run_suite(std::string const& protocol
, static_cast<void*>(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);