diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-03-07 10:36:42 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-03-07 10:36:42 +0000 |
| commit | b0f180c99c83be511b32c2a22e4e7d701c69a3d9 (patch) | |
| tree | 1e8cc5e0a99d67d64b86c49b8d1f68d11fed6244 /src | |
| parent | 6ce44b001de112ee1fb08ea77ed9dc7f045cf4c8 (diff) | |
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
url -> uri in Request class.
* src/AbstractCommand.cc
* src/AdaptiveURISelector.cc
* src/DefaultBtAnnounce.cc
* src/FeedbackURISelector.cc
* src/FileEntry.cc
* src/FileEntry.h
* src/HttpRequest.h
* src/HttpResponse.cc
* src/InitiateConnectionCommandFactory.cc
* src/Metalink2RequestGroup.cc
* src/OptionHandlerImpl.h
* src/ProtocolDetector.cc
* src/Request.cc
* src/Request.h
* src/XmlRpcMethodImpl.cc
* test/AuthConfigFactoryTest.cc
* test/FtpConnectionTest.cc
* test/HttpRequestTest.cc
* test/HttpResponseTest.cc
* test/RequestTest.cc
Diffstat (limited to 'src')
| -rw-r--r-- | src/AbstractCommand.cc | 32 | ||||
| -rw-r--r-- | src/AdaptiveURISelector.cc | 2 | ||||
| -rw-r--r-- | src/DefaultBtAnnounce.cc | 58 | ||||
| -rw-r--r-- | src/FeedbackURISelector.cc | 4 | ||||
| -rw-r--r-- | src/FileEntry.cc | 6 | ||||
| -rw-r--r-- | src/FileEntry.h | 4 | ||||
| -rw-r--r-- | src/HttpRequest.h | 6 | ||||
| -rw-r--r-- | src/HttpResponse.cc | 6 | ||||
| -rw-r--r-- | src/InitiateConnectionCommandFactory.cc | 4 | ||||
| -rw-r--r-- | src/Metalink2RequestGroup.cc | 18 | ||||
| -rw-r--r-- | src/OptionHandlerImpl.h | 10 | ||||
| -rw-r--r-- | src/ProtocolDetector.cc | 2 | ||||
| -rw-r--r-- | src/Request.cc | 66 | ||||
| -rw-r--r-- | src/Request.h | 32 | ||||
| -rw-r--r-- | src/XmlRpcMethodImpl.cc | 4 |
15 files changed, 127 insertions, 127 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index 9678ac68..05f491cb 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -111,7 +111,7 @@ bool AbstractCommand::execute() { if(logger->debug()) { logger->debug ("CUID#%d - Discard original URI=%s because it is requested.", - cuid, req->getUrl().c_str()); + cuid, req->getUri().c_str()); } return prepareForRetry(0); } @@ -208,10 +208,10 @@ bool AbstractCommand::execute() { } else { logger->error(MSG_DOWNLOAD_ABORTED, DL_ABORT_EX2(StringFormat - ("URI=%s", req->getCurrentUrl().c_str()).str(),err), - cuid, req->getUrl().c_str()); - _fileEntry->addURIResult(req->getUrl(), err.getCode()); - _requestGroup->setLastUriResult(req->getUrl(), err.getCode()); + ("URI=%s", req->getCurrentUri().c_str()).str(),err), + cuid, req->getUri().c_str()); + _fileEntry->addURIResult(req->getUri(), err.getCode()); + _requestGroup->setLastUriResult(req->getUri(), err.getCode()); } onAbort(); tryReserved(); @@ -220,8 +220,8 @@ bool AbstractCommand::execute() { assert(!req.isNull()); logger->info(MSG_RESTARTING_DOWNLOAD, DL_RETRY_EX2(StringFormat - ("URI=%s", req->getCurrentUrl().c_str()).str(),err), - cuid, req->getUrl().c_str()); + ("URI=%s", req->getCurrentUri().c_str()).str(),err), + cuid, req->getUri().c_str()); req->addTryCount(); req->resetRedirectCount(); const unsigned int maxTries = getOption()->getAsInt(PREF_MAX_TRIES); @@ -229,9 +229,9 @@ bool AbstractCommand::execute() { if(isAbort) { onAbort(); logger->info(MSG_MAX_TRY, cuid, req->getTryCount()); - logger->error(MSG_DOWNLOAD_ABORTED, err, cuid, req->getUrl().c_str()); - _fileEntry->addURIResult(req->getUrl(), err.getCode()); - _requestGroup->setLastUriResult(req->getUrl(), err.getCode()); + logger->error(MSG_DOWNLOAD_ABORTED, err, cuid, req->getUri().c_str()); + _fileEntry->addURIResult(req->getUri(), err.getCode()); + _requestGroup->setLastUriResult(req->getUri(), err.getCode()); tryReserved(); return true; } else { @@ -240,8 +240,8 @@ bool AbstractCommand::execute() { } catch(DownloadFailureException& err) { logger->error(EX_EXCEPTION_CAUGHT, err); if(!req.isNull()) { - _fileEntry->addURIResult(req->getUrl(), err.getCode()); - _requestGroup->setLastUriResult(req->getUrl(), err.getCode()); + _fileEntry->addURIResult(req->getUri(), err.getCode()); + _requestGroup->setLastUriResult(req->getUri(), err.getCode()); } _requestGroup->setHaltRequested(true); return true; @@ -281,7 +281,7 @@ bool AbstractCommand::prepareForRetry(time_t wait) { _fileEntry->poolRequest(req); if(logger->debug()) { logger->debug("CUID#%d - Pooling request URI=%s", - cuid, req->getUrl().c_str()); + cuid, req->getUri().c_str()); } if(!_requestGroup->getSegmentMan().isNull()) { _requestGroup->getSegmentMan()->recognizeSegmentFor(_fileEntry); @@ -305,7 +305,7 @@ void AbstractCommand::onAbort() { // TODO This might be a problem if the failure is caused by proxy. e->_requestGroupMan->getOrCreateServerStat(req->getHost(), req->getProtocol())->setError(); - _fileEntry->removeIdenticalURI(req->getUrl()); + _fileEntry->removeIdenticalURI(req->getUri()); _fileEntry->removeRequest(req); } if(logger->debug()) { @@ -421,7 +421,7 @@ static bool isProxyRequest (const std::string& protocol, const SharedHandle<Option>& option) { const std::string& proxyUri = getProxyUri(protocol, option); - return !proxyUri.empty() && Request().setUrl(proxyUri); + return !proxyUri.empty() && Request().setUri(proxyUri); } class DomainMatch { @@ -468,7 +468,7 @@ SharedHandle<Request> AbstractCommand::createProxyRequest() const std::string proxy = getProxyUri(req->getProtocol(), getOption()); if(!proxy.empty()) { proxyRequest.reset(new Request()); - if(proxyRequest->setUrl(proxy)) { + if(proxyRequest->setUri(proxy)) { if(logger->debug()) { logger->debug("CUID#%d - Using proxy", cuid); } diff --git a/src/AdaptiveURISelector.cc b/src/AdaptiveURISelector.cc index 04c942c3..f1537429 100644 --- a/src/AdaptiveURISelector.cc +++ b/src/AdaptiveURISelector.cc @@ -341,7 +341,7 @@ SharedHandle<ServerStat> AdaptiveURISelector::getServerStats (const std::string& uri) const { Request r; - r.setUrl(uri); + r.setUri(uri); return _serverStatMan->find(r.getHost(), r.getProtocol()); } diff --git a/src/DefaultBtAnnounce.cc b/src/DefaultBtAnnounce.cc index 8c0d7783..e77550f1 100644 --- a/src/DefaultBtAnnounce.cc +++ b/src/DefaultBtAnnounce.cc @@ -108,7 +108,7 @@ bool DefaultBtAnnounce::isAnnounceReady() { static bool uriHasQuery(const std::string& uri) { Request req; - req.setUrl(uri); + req.setUri(uri); return !req.getQuery().empty(); } @@ -141,50 +141,50 @@ std::string DefaultBtAnnounce::getAnnounceUrl() { TransferStat stat = peerStorage->calculateStat(); uint64_t left = pieceStorage->getTotalLength()-pieceStorage->getCompletedLength(); - std::string url = announceList.getAnnounce(); - url += uriHasQuery(url) ? "&" : "?"; - url += "info_hash="; - url += util::torrentUrlencode(bittorrent::getInfoHash(_downloadContext), + std::string uri = announceList.getAnnounce(); + uri += uriHasQuery(uri) ? "&" : "?"; + uri += "info_hash="; + uri += util::torrentUrlencode(bittorrent::getInfoHash(_downloadContext), INFO_HASH_LENGTH); - url += "&peer_id="; - url += util::torrentUrlencode(bittorrent::getStaticPeerId(), PEER_ID_LENGTH); - url += "&uploaded="; - url += util::uitos(stat.getSessionUploadLength()); - url += "&downloaded="; - url += util::uitos(stat.getSessionDownloadLength()); - url += "&left="; - url += util::uitos(left); - url += "&compact=1"; - url += "&key="; + uri += "&peer_id="; + uri += util::torrentUrlencode(bittorrent::getStaticPeerId(), PEER_ID_LENGTH); + uri += "&uploaded="; + uri += util::uitos(stat.getSessionUploadLength()); + uri += "&downloaded="; + uri += util::uitos(stat.getSessionDownloadLength()); + uri += "&left="; + uri += util::uitos(left); + uri += "&compact=1"; + uri += "&key="; // Use last 8 bytes of peer ID as a key size_t keyLen = 8; - url += util::torrentUrlencode + uri += util::torrentUrlencode (bittorrent::getStaticPeerId()+PEER_ID_LENGTH-keyLen, keyLen); - url += "&numwant="; - url += util::uitos(numWant); - url += "&no_peer_id=1"; + uri += "&numwant="; + uri += util::uitos(numWant); + uri += "&no_peer_id=1"; if(btRuntime->getListenPort() > 0) { - url += "&port="; - url += util::uitos(btRuntime->getListenPort()); + uri += "&port="; + uri += util::uitos(btRuntime->getListenPort()); } std::string event = announceList.getEventString(); if(!event.empty()) { - url += "&event="; - url += event; + uri += "&event="; + uri += event; } if(!trackerId.empty()) { - url += "&trackerid="+util::torrentUrlencode(trackerId); + uri += "&trackerid="+util::torrentUrlencode(trackerId); } if(option->getAsBool(PREF_BT_REQUIRE_CRYPTO)) { - url += "&requirecrypto=1"; + uri += "&requirecrypto=1"; } else { - url += "&supportcrypto=1"; + uri += "&supportcrypto=1"; } if(!option->blank(PREF_BT_EXTERNAL_IP)) { - url += "&ip="; - url += option->get(PREF_BT_EXTERNAL_IP); + uri += "&ip="; + uri += option->get(PREF_BT_EXTERNAL_IP); } - return url; + return uri; } void DefaultBtAnnounce::announceStart() { diff --git a/src/FeedbackURISelector.cc b/src/FeedbackURISelector.cc index ee298e36..50535f38 100644 --- a/src/FeedbackURISelector.cc +++ b/src/FeedbackURISelector.cc @@ -76,7 +76,7 @@ std::string FeedbackURISelector::select(FileEntry* fileEntry) for(std::deque<std::string>::iterator i = uris.begin(), eoi = urisLast; i != eoi; ++i) { Request r; - r.setUrl(*i); + r.setUri(*i); SharedHandle<ServerStat> ss = _serverStatMan->find(r.getHost(), r.getProtocol()); if(!ss.isNull() && ss->isOK() && ss->getDownloadSpeed() > SPEED_THRESHOLD) { @@ -87,7 +87,7 @@ std::string FeedbackURISelector::select(FileEntry* fileEntry) for(std::deque<std::string>::iterator i = uris.begin(), eoi = uris.end(); i != eoi; ++i) { Request r; - r.setUrl(*i); + r.setUri(*i); SharedHandle<ServerStat> ss = _serverStatMan->find(r.getHost(), r.getProtocol()); // Skip ERROR state URI diff --git a/src/FileEntry.cc b/src/FileEntry.cc index db0ff1b9..78cbdde0 100644 --- a/src/FileEntry.cc +++ b/src/FileEntry.cc @@ -132,7 +132,7 @@ FileEntry::getRequest return req; } req.reset(new Request()); - if(req->setUrl(uri)) { + if(req->setUri(uri)) { if(!_singleHostMultiConnection) { if(inFlightHost(_inFlightRequests.begin(), _inFlightRequests.end(), req->getHost())) { @@ -243,7 +243,7 @@ void FileEntry::removeURIWhoseHostnameIs(const std::string& hostname) for(std::deque<std::string>::const_iterator itr = _uris.begin(), eoi = _uris.end(); itr != eoi; ++itr) { if(((*itr).find(hostname) == std::string::npos) || - (req.setUrl(*itr) && (req.getHost() != hostname))) { + (req.setUri(*itr) && (req.getHost() != hostname))) { newURIs.push_back(*itr); } } @@ -337,7 +337,7 @@ static InputIterator findRequestByUri (InputIterator first, InputIterator last, const T& uri) { for(; first != last; ++first) { - if(!(*first)->removalRequested() && (*first)->getUrl() == uri) { + if(!(*first)->removalRequested() && (*first)->getUri() == uri) { return first; } } diff --git a/src/FileEntry.h b/src/FileEntry.h index ab4b4f51..93b93802 100644 --- a/src/FileEntry.h +++ b/src/FileEntry.h @@ -149,7 +149,7 @@ public: bool addUri(const std::string& uri) { - if(Request().setUrl(uri)) { + if(Request().setUri(uri)) { _uris.push_back(uri); return true; } else { @@ -159,7 +159,7 @@ public: bool insertUri(const std::string& uri, size_t pos) { - if(Request().setUrl(uri)) { + if(Request().setUri(uri)) { pos = std::min(pos, _uris.size()); _uris.insert(_uris.begin()+pos, uri); return true; diff --git a/src/HttpRequest.h b/src/HttpRequest.h index c8a3c9e5..95afbb33 100644 --- a/src/HttpRequest.h +++ b/src/HttpRequest.h @@ -126,7 +126,7 @@ public: const std::string& getCurrentURI() const { - return request->getCurrentUrl(); + return request->getCurrentUri(); } const std::string& getDir() const @@ -146,7 +146,7 @@ public: const std::string& getPreviousURI() const { - return request->getPreviousUrl(); + return request->getPreviousUri(); } std::string getURIHost() const @@ -217,7 +217,7 @@ public: (const SharedHandle<AuthConfigFactory>& factory, const Option* option); /* - * To use proxy, pass proxy string to Request::setUrl() and set it this + * To use proxy, pass proxy string to Request::setUri() and set it this * object. */ void setProxyRequest(const SharedHandle<Request>& proxyRequest); diff --git a/src/HttpResponse.cc b/src/HttpResponse.cc index d1728a2a..b7a4f413 100644 --- a/src/HttpResponse.cc +++ b/src/HttpResponse.cc @@ -132,14 +132,14 @@ bool HttpResponse::isRedirect() const void HttpResponse::processRedirect() { - if(httpRequest->getRequest()->redirectUrl(getRedirectURI())) { + if(httpRequest->getRequest()->redirectUri(getRedirectURI())) { logger->info(MSG_REDIRECT, cuid, - httpRequest->getRequest()->getCurrentUrl().c_str()); + httpRequest->getRequest()->getCurrentUri().c_str()); } else { throw DL_RETRY_EX (StringFormat("CUID#%d - Redirect to %s failed. It may not be a valid" " URI.", cuid, - httpRequest->getRequest()->getCurrentUrl().c_str()).str()); + httpRequest->getRequest()->getCurrentUri().c_str()).str()); } } diff --git a/src/InitiateConnectionCommandFactory.cc b/src/InitiateConnectionCommandFactory.cc index 5170fcbb..d9512197 100644 --- a/src/InitiateConnectionCommandFactory.cc +++ b/src/InitiateConnectionCommandFactory.cc @@ -74,8 +74,8 @@ InitiateConnectionCommandFactory::createInitiateConnectionCommand } else if(req->getProtocol() == Request::PROTO_FTP) { if(req->getFile().empty()) { throw DL_ABORT_EX - (StringFormat("FTP URL %s doesn't contain file path.", - req->getUrl().c_str()).str()); + (StringFormat("FTP URI %s doesn't contain file path.", + req->getUri().c_str()).str()); } return new FtpInitiateConnectionCommand(cuid, req, fileEntry, requestGroup, e); diff --git a/src/Metalink2RequestGroup.cc b/src/Metalink2RequestGroup.cc index 517851e1..2fbceee7 100644 --- a/src/Metalink2RequestGroup.cc +++ b/src/Metalink2RequestGroup.cc @@ -69,19 +69,19 @@ namespace aria2 { Metalink2RequestGroup::Metalink2RequestGroup(): _logger(LogFactory::getInstance()) {} -class AccumulateNonP2PUrl { +class AccumulateNonP2PUri { private: - std::vector<std::string>& urlsPtr; + std::vector<std::string>& urisPtr; public: - AccumulateNonP2PUrl(std::vector<std::string>& urlsPtr) - :urlsPtr(urlsPtr) {} + AccumulateNonP2PUri(std::vector<std::string>& urisPtr) + :urisPtr(urisPtr) {} void operator()(const SharedHandle<MetalinkResource>& resource) { switch(resource->type) { case MetalinkResource::TYPE_HTTP: case MetalinkResource::TYPE_HTTPS: case MetalinkResource::TYPE_FTP: - urlsPtr.push_back(resource->url); + urisPtr.push_back(resource->url); break; default: break; @@ -89,9 +89,9 @@ public: } }; -class FindBitTorrentUrl { +class FindBitTorrentUri { public: - FindBitTorrentUrl() {} + FindBitTorrentUri() {} bool operator()(const SharedHandle<MetalinkResource>& resource) { if(resource->type == MetalinkResource::TYPE_BITTORRENT) { @@ -232,7 +232,7 @@ Metalink2RequestGroup::createRequestGroup entry->reorderResourcesByPriority(); std::vector<std::string> uris; std::for_each(entry->resources.begin(), entry->resources.end(), - AccumulateNonP2PUrl(uris)); + AccumulateNonP2PUri(uris)); // If piece hash is specified in the metalink, // make segment size equal to piece hash size. size_t pieceLength; @@ -286,7 +286,7 @@ Metalink2RequestGroup::createRequestGroup (*i)->reorderResourcesByPriority(); std::vector<std::string> uris; std::for_each((*i)->resources.begin(), (*i)->resources.end(), - AccumulateNonP2PUrl(uris)); + AccumulateNonP2PUri(uris)); SharedHandle<FileEntry> fe (new FileEntry (util::applyDir(option->get(PREF_DIR), diff --git a/src/OptionHandlerImpl.h b/src/OptionHandlerImpl.h index 1447ae91..965888dc 100644 --- a/src/OptionHandlerImpl.h +++ b/src/OptionHandlerImpl.h @@ -562,14 +562,14 @@ public: option.put(_optName, optarg); } else { Request req; - std::string url; + std::string uri; if(util::startsWith(optarg, "http://")) { - url = optarg; + uri = optarg; } else { - url = "http://"+optarg; + uri = "http://"+optarg; } - if(req.setUrl(url)) { - option.put(_optName, url); + if(req.setUri(uri)) { + option.put(_optName, uri); } else { throw DL_ABORT_EX(_("unrecognized proxy format")); } diff --git a/src/ProtocolDetector.cc b/src/ProtocolDetector.cc index fea523b1..99c71161 100644 --- a/src/ProtocolDetector.cc +++ b/src/ProtocolDetector.cc @@ -53,7 +53,7 @@ ProtocolDetector::~ProtocolDetector() {} bool ProtocolDetector::isStreamProtocol(const std::string& uri) const { - return Request().setUrl(uri); + return Request().setUri(uri); } bool ProtocolDetector::guessTorrentFile(const std::string& uri) const diff --git a/src/Request.cc b/src/Request.cc index 22b49ced..fa2f650e 100644 --- a/src/Request.cc +++ b/src/Request.cc @@ -67,13 +67,13 @@ Request::Request(): _removalRequested(false) {} -static std::string removeFragment(const std::string& url) +static std::string removeFragment(const std::string& uri) { - std::string::size_type sharpIndex = url.find("#"); + std::string::size_type sharpIndex = uri.find("#"); if(sharpIndex == std::string::npos) { - return url; + return uri; } else { - return url.substr(0, sharpIndex); + return uri.substr(0, sharpIndex); } } @@ -83,7 +83,7 @@ static bool isHexNumber(const char c) ('a' <= c && c <= 'f'); } -static std::string urlencode(const std::string& src) +static std::string percentEncode(const std::string& src) { std::string result = src; if(src.empty()) { @@ -92,7 +92,7 @@ static std::string urlencode(const std::string& src) result += " "; for(int index = src.size()-1; index >= 0; --index) { const unsigned char c = result[index]; - // '/' is not urlencoded because src is expected to be a path. + // '/' is not percent encoded because src is expected to be a path. if(!util::inRFC3986ReservedChars(c) && !util::inRFC3986UnreservedChars(c)) { if(c == '%') { if(!isHexNumber(result[index+1]) || !isHexNumber(result[index+2])) { @@ -107,47 +107,47 @@ static std::string urlencode(const std::string& src) return result; } -bool Request::setUrl(const std::string& url) { +bool Request::setUri(const std::string& uri) { _supportsPersistentConnection = true; - _url = url; - return parseUrl(_url); + _uri = uri; + return parseUri(_uri); } -bool Request::resetUrl() { - _previousUrl = _referer; +bool Request::resetUri() { + _previousUri = _referer; _supportsPersistentConnection = true; - return parseUrl(_url); + return parseUri(_uri); } -void Request::setReferer(const std::string& url) +void Request::setReferer(const std::string& uri) { - _referer = _previousUrl = urlencode(removeFragment(url)); + _referer = _previousUri = percentEncode(removeFragment(uri)); } -bool Request::redirectUrl(const std::string& url) { - _previousUrl = A2STR::NIL; +bool Request::redirectUri(const std::string& uri) { + _previousUri = A2STR::NIL; _supportsPersistentConnection = true; ++_redirectCount; - std::string redirectedUrl; - if(url.find("://") == std::string::npos) { + std::string redirectedUri; + if(uri.find("://") == std::string::npos) { // rfc2616 requires absolute URI should be provided by Location header // field, but some servers don't obey this rule. - if(util::startsWith(url, "/")) { + if(util::startsWith(uri, "/")) { // abosulute path - redirectedUrl = strconcat(_protocol, "://", _host, url); + redirectedUri = strconcat(_protocol, "://", _host, uri); } else { // relative path - redirectedUrl = strconcat(_protocol, "://", _host, _dir, "/", url); + redirectedUri = strconcat(_protocol, "://", _host, _dir, "/", uri); } } else { - redirectedUrl = url; + redirectedUri = uri; } - return parseUrl(redirectedUrl); + return parseUri(redirectedUri); } -bool Request::parseUrl(const std::string& srcUrl) { - const std::string url = urlencode(removeFragment(srcUrl)); - _currentUrl = url; +bool Request::parseUri(const std::string& srcUri) { + const std::string uri = percentEncode(removeFragment(srcUri)); + _currentUri = uri; _host = A2STR::NIL; _port = 0; _dir = A2STR::NIL; @@ -173,21 +173,21 @@ bool Request::parseUrl(const std::string& srcUrl) { // queryFirst // find query part - std::string::const_iterator queryFirst = url.begin(); - for(; queryFirst != url.end(); ++queryFirst) { + std::string::const_iterator queryFirst = uri.begin(); + for(; queryFirst != uri.end(); ++queryFirst) { if(*queryFirst == '?') break; } - _query = std::string(queryFirst, url.end()); + _query = std::string(queryFirst, uri.end()); // find protocol - std::string::size_type protocolOffset = url.find("://"); + std::string::size_type protocolOffset = uri.find("://"); if(protocolOffset == std::string::npos) return false; - _protocol = std::string(url.begin(), url.begin()+protocolOffset); + _protocol = std::string(uri.begin(), uri.begin()+protocolOffset); uint16_t defPort; if((defPort = FeatureConfig::getInstance()->getDefaultPort(_protocol)) == 0) { return false; } // find authority - std::string::const_iterator authorityFirst = url.begin()+protocolOffset+3; + std::string::const_iterator authorityFirst = uri.begin()+protocolOffset+3; std::string::const_iterator authorityLast = authorityFirst; for(; authorityLast != queryFirst; ++authorityLast) { if(*authorityLast == '/') break; @@ -318,7 +318,7 @@ const SharedHandle<PeerStat>& Request::initPeerStat() // Use host and protocol in original URI, because URI selector // selects URI based on original URI, not redirected one. Request origReq; - origReq.setUrl(_url); + origReq.setUri(_uri); _peerStat.reset(new PeerStat(0, origReq.getHost(), origReq.getProtocol())); return _peerStat; } diff --git a/src/Request.h b/src/Request.h index 916237c4..db9b9f5c 100644 --- a/src/Request.h +++ b/src/Request.h @@ -46,14 +46,14 @@ namespace aria2 { class Request { private: - std::string _url; - std::string _currentUrl; + std::string _uri; + std::string _currentUri; /** - * URL previously requested to the server. This is used as Referer + * URI previously requested to the server. This is used as Referer */ - std::string _previousUrl; + std::string _previousUri; /** - * URL used as Referer in the initial request + * URI used as Referer in the initial request */ std::string _referer; std::string _protocol; @@ -90,17 +90,17 @@ private: bool _removalRequested; - bool parseUrl(const std::string& url); + bool parseUri(const std::string& uri); public: Request(); - // Sets url to _url and parses URL. Returns true if parsing goes + // Sets uri to _uri and parses URI. Returns true if parsing goes // successful, otherwise returns false. - bool setUrl(const std::string& url); - // Parses URL. _url field are not altered by this method. Returns + bool setUri(const std::string& uri); + // Parses URI. _uri field are not altered by this method. Returns // true if parsing goes successful, otherwise returns false. - bool redirectUrl(const std::string& url); - bool resetUrl(); + bool redirectUri(const std::string& uri); + bool resetUri(); void resetTryCount() { _tryCount = 0; } void addTryCount() { ++_tryCount; } unsigned int getTryCount() const { return _tryCount; } @@ -112,12 +112,12 @@ public: return _redirectCount; } - // Returns URI passed by setUrl() - const std::string& getUrl() const { return _url; } - const std::string& getCurrentUrl() const { return _currentUrl; } - const std::string& getPreviousUrl() const { return _previousUrl; } + // Returns URI passed by setUri() + const std::string& getUri() const { return _uri; } + const std::string& getCurrentUri() const { return _currentUri; } + const std::string& getPreviousUri() const { return _previousUri; } const std::string& getReferer() const { return _referer; } - void setReferer(const std::string& url); + void setReferer(const std::string& uri); const std::string& getProtocol() const { return _protocol; } const std::string& getHost() const { return _host; } // Same as getHost(), but for IPv6 literal addresses, enclose them diff --git a/src/XmlRpcMethodImpl.cc b/src/XmlRpcMethodImpl.cc index a2663ce8..dd49d87a 100644 --- a/src/XmlRpcMethodImpl.cc +++ b/src/XmlRpcMethodImpl.cc @@ -912,8 +912,8 @@ BDE GetServersXmlRpcMethod::process SharedHandle<PeerStat> ps = (*ri)->getPeerStat(); if(!ps.isNull()) { BDE serverEntry = BDE::dict(); - serverEntry[KEY_URI] = (*ri)->getUrl(); - serverEntry[KEY_CURRENT_URI] = (*ri)->getCurrentUrl(); + serverEntry[KEY_URI] = (*ri)->getUri(); + serverEntry[KEY_CURRENT_URI] = (*ri)->getCurrentUri(); serverEntry[KEY_DOWNLOAD_SPEED] = util::uitos(ps->calculateDownloadSpeed()); servers << serverEntry; |
