mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 05:27:38 +03:00
2008-11-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Deprecated --http-proxy-user and --http-proxy-passwd options. Added --https-proxy, --ftp-proxy and --all-proxy options. Above 3 options and --http-proxy option can handle proxy in URL format like: http://user:passwd@host:port. If a proxy requires user/password, they must be specified in a URL. Deprecated --ftp-via-http-proxy option. Use --http-proxy-method option instead. * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyRequestCommand.h * src/AuthConfigFactory.cc * src/AuthConfigFactory.h * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpInitiateConnectionCommand.h * src/FtpNegotiationCommand.cc * src/FtpTunnelRequestCommand.cc * src/FtpTunnelRequestCommand.h * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpInitiateConnectionCommand.h * src/HttpProxyRequestCommand.cc * src/HttpProxyRequestCommand.h * src/HttpRequest.cc * src/HttpRequest.h * src/HttpRequestCommand.cc * src/HttpRequestCommand.h * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommand.cc * src/InitiateConnectionCommand.h * src/OptionHandlerFactory.cc * src/OptionHandlerImpl.h * src/Request.cc * src/option_processing.cc * src/prefs.cc * src/prefs.h * src/usage_text.h * test/AuthConfigFactoryTest.cc * test/HttpRequestTest.cc * test/OptionHandlerTest.cc
This commit is contained in:
parent
223621b5bc
commit
c7fb678e6e
35 changed files with 432 additions and 372 deletions
|
@ -328,51 +328,29 @@ void OptionHandlerTest::testFloatNumberOptionHandler_min_max()
|
|||
|
||||
void OptionHandlerTest::testHttpProxyOptionHandler()
|
||||
{
|
||||
HttpProxyOptionHandler handler(PREF_HTTP_PROXY,
|
||||
"",
|
||||
"",
|
||||
PREF_HTTP_PROXY_HOST,
|
||||
PREF_HTTP_PROXY_PORT);
|
||||
HttpProxyOptionHandler handler(PREF_HTTP_PROXY, "", "");
|
||||
CPPUNIT_ASSERT(handler.canHandle(PREF_HTTP_PROXY));
|
||||
CPPUNIT_ASSERT(!handler.canHandle("foobar"));
|
||||
Option option;
|
||||
handler.parse(&option, "bar:80");
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("bar:80"), option.get(PREF_HTTP_PROXY));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("bar"), option.get(PREF_HTTP_PROXY_HOST));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("80"), option.get(PREF_HTTP_PROXY_PORT));
|
||||
CPPUNIT_ASSERT_EQUAL(std::string(V_TRUE), option.get(PREF_HTTP_PROXY_ENABLED));
|
||||
handler.parse(&option, "proxy:65535");
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("http://proxy:65535"),
|
||||
option.get(PREF_HTTP_PROXY));
|
||||
|
||||
handler.parse(&option, "http://proxy:8080");
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("http://proxy:8080"),
|
||||
option.get(PREF_HTTP_PROXY));
|
||||
|
||||
handler.parse(&option, "ftp://proxy:8080");
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("http://ftp://proxy:8080"),
|
||||
option.get(PREF_HTTP_PROXY));
|
||||
|
||||
try {
|
||||
handler.parse(&option, "bar");
|
||||
handler.parse(&option, "http://bar:65536");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception& e) {
|
||||
std::cerr << e.stackTrace() << std::endl;
|
||||
}
|
||||
try {
|
||||
handler.parse(&option, "bar:");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception& e) {
|
||||
std::cerr << e.stackTrace() << std::endl;
|
||||
}
|
||||
try {
|
||||
handler.parse(&option, ":");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception& e) {
|
||||
std::cerr << e.stackTrace() << std::endl;
|
||||
}
|
||||
try {
|
||||
handler.parse(&option, ":80");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception& e) {
|
||||
std::cerr << e.stackTrace() << std::endl;
|
||||
}
|
||||
try {
|
||||
handler.parse(&option, "foo:bar");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception& e) {
|
||||
std::cerr << e.stackTrace() << std::endl;
|
||||
}
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("HOST:PORT"),
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("[http://][USER:PASSWORD@]HOST[:PORT]"),
|
||||
handler.createPossibleValuesString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue