summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/AbstractCommand.cc8
-rw-r--r--src/AuthConfigFactory.cc5
-rw-r--r--src/HttpRequest.cc6
-rw-r--r--src/HttpRequestCommand.cc6
-rw-r--r--src/InitiateConnectionCommandFactory.cc8
-rw-r--r--src/Request.cc6
-rw-r--r--src/Request.h7
7 files changed, 16 insertions, 30 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index 6b478bfc..2b31538a 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -590,17 +590,17 @@ std::string getProxyOptionFor
std::string getProxyUri
(const std::string& protocol, const Option* option)
{
- if(protocol == Request::PROTO_HTTP) {
+ if(protocol == "http") {
return getProxyOptionFor(PREF_HTTP_PROXY,
PREF_HTTP_PROXY_USER,
PREF_HTTP_PROXY_PASSWD,
option);
- } else if(protocol == Request::PROTO_HTTPS) {
+ } else if(protocol == "https") {
return getProxyOptionFor(PREF_HTTPS_PROXY,
PREF_HTTPS_PROXY_USER,
PREF_HTTPS_PROXY_PASSWD,
option);
- } else if(protocol == Request::PROTO_FTP) {
+ } else if(protocol == "ftp") {
return getProxyOptionFor(PREF_FTP_PROXY,
PREF_FTP_PROXY_USER,
PREF_FTP_PROXY_PASSWD,
@@ -865,7 +865,7 @@ const std::string& AbstractCommand::resolveProxyMethod
(const std::string& protocol) const
{
if(getOption()->get(PREF_PROXY_METHOD) == V_TUNNEL ||
- Request::PROTO_HTTPS == protocol) {
+ protocol == "https") {
return V_TUNNEL;
} else {
return V_GET;
diff --git a/src/AuthConfigFactory.cc b/src/AuthConfigFactory.cc
index effd1ff4..bd858e05 100644
--- a/src/AuthConfigFactory.cc
+++ b/src/AuthConfigFactory.cc
@@ -60,8 +60,7 @@ AuthConfigHandle
AuthConfigFactory::createAuthConfig
(const SharedHandle<Request>& request, const Option* op)
{
- if(request->getProtocol() == Request::PROTO_HTTP ||
- request->getProtocol() == Request::PROTO_HTTPS) {
+ if(request->getProtocol() == "http" || request->getProtocol() == "https") {
if(op->getAsBool(PREF_HTTP_AUTH_CHALLENGE)) {
if(!request->getUsername().empty()) {
@@ -89,7 +88,7 @@ AuthConfigFactory::createAuthConfig
createHttpAuthResolver(op)->resolveAuthConfig(request->getHost());
}
}
- } else if(request->getProtocol() == Request::PROTO_FTP) {
+ } else if(request->getProtocol() == "ftp") {
if(!request->getUsername().empty()) {
if(request->hasPassword()) {
return createAuthConfig(request->getUsername(), request->getPassword());
diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc
index 837f91de..d25e0f11 100644
--- a/src/HttpRequest.cc
+++ b/src/HttpRequest.cc
@@ -145,7 +145,7 @@ std::string HttpRequest::createRequest()
std::string requestLine = request_->getMethod();
requestLine += " ";
if(proxyRequest_) {
- if(getProtocol() == Request::PROTO_FTP &&
+ if(getProtocol() == "ftp" &&
request_->getUsername().empty() && authConfig_) {
// Insert user into URI, like ftp://USER@host/
std::string uri = getCurrentURI();
@@ -201,7 +201,7 @@ std::string HttpRequest::createRequest()
std::string rangeHeader(fmt("bytes=%" PRId64 "-", getStartByte()));
if(request_->isPipeliningEnabled()) {
rangeHeader += util::itos(getEndByte());
- } else if(getProtocol() != Request::PROTO_FTP && endOffsetOverride_ > 0) {
+ } else if(getProtocol() != "ftp" && endOffsetOverride_ > 0) {
// FTP via http proxy does not support endbytes
rangeHeader += util::itos(endOffsetOverride_-1);
}
@@ -231,7 +231,7 @@ std::string HttpRequest::createRequest()
std::vector<Cookie> cookies =
cookieStorage_->criteriaFind(getHost(), path,
Time().getTime(),
- getProtocol() == Request::PROTO_HTTPS);
+ getProtocol() == "https");
for(std::vector<Cookie>::const_iterator itr = cookies.begin(),
eoi = cookies.end(); itr != eoi; ++itr) {
cookiesValue += (*itr).toString();
diff --git a/src/HttpRequestCommand.cc b/src/HttpRequestCommand.cc
index 11f1fdb8..9eb9daba 100644
--- a/src/HttpRequestCommand.cc
+++ b/src/HttpRequestCommand.cc
@@ -122,7 +122,7 @@ createHttpRequest(const SharedHandle<Request>& req,
bool HttpRequestCommand::executeInternal() {
//socket->setBlockingMode();
- if(getRequest()->getProtocol() == Request::PROTO_HTTPS) {
+ if(getRequest()->getProtocol() == "https") {
getSocket()->prepareSecureConnection();
if(!getSocket()->initiateSecureConnection(getRequest()->getHost())) {
setReadCheckSocketIf(getSocket(), getSocket()->wantRead());
@@ -150,8 +150,8 @@ bool HttpRequestCommand::executeInternal() {
getDownloadEngine()->getAuthConfigFactory(),
proxyRequest_));
if(getOption()->getAsBool(PREF_CONDITIONAL_GET) &&
- (getRequest()->getProtocol() == Request::PROTO_HTTP ||
- getRequest()->getProtocol() == Request::PROTO_HTTPS)) {
+ (getRequest()->getProtocol() == "http" ||
+ getRequest()->getProtocol() == "https")) {
if(getFileEntry()->getPath().empty() &&
getRequest()->getFile().empty()) {
A2_LOG_DEBUG("Conditional-Get is disabled because file name"
diff --git a/src/InitiateConnectionCommandFactory.cc b/src/InitiateConnectionCommandFactory.cc
index 8b310a3e..9b0b9096 100644
--- a/src/InitiateConnectionCommandFactory.cc
+++ b/src/InitiateConnectionCommandFactory.cc
@@ -55,13 +55,13 @@ InitiateConnectionCommandFactory::createInitiateConnectionCommand
RequestGroup* requestGroup,
DownloadEngine* e)
{
- if(req->getProtocol() == Request::PROTO_HTTP
+ if(req->getProtocol() == "http"
#ifdef ENABLE_SSL
// for SSL
- || req->getProtocol() == Request::PROTO_HTTPS
+ || req->getProtocol() == "https"
#endif // ENABLE_SSL
) {
-
+
if(requestGroup->getOption()->getAsBool(PREF_ENABLE_HTTP_KEEP_ALIVE)) {
req->setKeepAliveHint(true);
}
@@ -71,7 +71,7 @@ InitiateConnectionCommandFactory::createInitiateConnectionCommand
return
new HttpInitiateConnectionCommand(cuid, req, fileEntry, requestGroup, e);
- } else if(req->getProtocol() == Request::PROTO_FTP) {
+ } else if(req->getProtocol() == "ftp") {
if(req->getFile().empty()) {
throw DL_ABORT_EX
(fmt("FTP URI %s doesn't contain file path.",
diff --git a/src/Request.cc b/src/Request.cc
index b3ab8a21..eeedb170 100644
--- a/src/Request.cc
+++ b/src/Request.cc
@@ -50,12 +50,6 @@ const std::string Request::METHOD_GET = "GET";
const std::string Request::METHOD_HEAD = "HEAD";
-const std::string Request::PROTO_HTTP("http");
-
-const std::string Request::PROTO_HTTPS("https");
-
-const std::string Request::PROTO_FTP("ftp");
-
Request::Request():
method_(METHOD_GET),
tryCount_(0),
diff --git a/src/Request.h b/src/Request.h
index 22f2ebc5..ebdad6b3 100644
--- a/src/Request.h
+++ b/src/Request.h
@@ -224,14 +224,7 @@ public:
static const std::string METHOD_GET;
static const std::string METHOD_HEAD;
- static const std::string PROTO_HTTP;
-
- static const std::string PROTO_HTTPS;
-
- static const std::string PROTO_FTP;
-
static const int MAX_REDIRECT = 20;
-
};
} // namespace aria2