summaryrefslogtreecommitdiff
path: root/src/AbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-02-07 13:46:08 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-02-07 13:46:08 +0000
commit997a0c29d151e778444b3c796555e415a51b8c41 (patch)
treee81b7d556a8aa2a4b28d7d849f171695fce5a891 /src/AbstractCommand.cc
parent1b854afe44b9706ee45cf667fd2076de1a3a6832 (diff)
2009-02-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Changed the default value of --proxy-method option from 'tunnel' to 'get'. Use 'tunnel' for HTTPS regardless of --proxy-method option. * src/AbstractCommand.cc * src/AbstractCommand.h * src/FtpInitiateConnectionCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpInitiateConnectionCommand.h * src/OptionHandlerFactory.cc
Diffstat (limited to 'src/AbstractCommand.cc')
-rw-r--r--src/AbstractCommand.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index c2d440b1..361c4bdd 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -323,14 +323,6 @@ static bool isProxyRequest(const std::string& protocol, const Option* option)
(protocol == Request::PROTO_FTP && isProxyUsed(PREF_FTP_PROXY, option));
}
-static bool isProxyGETRequest(const std::string& protocol, const Option* option)
-{
- if(option->get(PREF_PROXY_METHOD) != V_GET) {
- return false;
- }
- return isProxyRequest(protocol, option);
-}
-
class DomainMatch {
private:
std::string _hostname;
@@ -478,7 +470,8 @@ void AbstractCommand::checkIfConnectionEstablished
std::string error = socket->getSocketError();
if(!error.empty()) {
// Don't set error if proxy server is used and its method is GET.
- if(!isProxyGETRequest(req->getProtocol(), e->option)) {
+ if(resolveProxyMethod(req->getProtocol()) != V_GET ||
+ !isProxyRequest(req->getProtocol(), e->option)) {
e->_requestGroupMan->getOrCreateServerStat
(req->getHost(), req->getProtocol())->setError();
}
@@ -488,4 +481,15 @@ void AbstractCommand::checkIfConnectionEstablished
}
}
+const std::string& AbstractCommand::resolveProxyMethod
+(const std::string& protocol) const
+{
+ if(e->option->get(PREF_PROXY_METHOD) == V_TUNNEL ||
+ Request::PROTO_HTTPS == protocol) {
+ return V_TUNNEL;
+ } else {
+ return V_GET;
+ }
+}
+
} // namespace aria2