From f8590aa5b9d146d6e3e875036f6fb5e14e99dd5a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 12 Jun 2010 09:44:10 +0000 Subject: [PATCH] 2010-06-12 Tatsuhiro Tsujikawa Renamed member variables. Removed unused member variable. * src/AbstractProxyRequestCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/HttpConnection.cc * src/HttpConnection.h * src/HttpInitiateConnectionCommand.cc --- ChangeLog | 10 +++++ src/AbstractProxyRequestCommand.cc | 2 +- src/FtpInitiateConnectionCommand.cc | 4 +- src/FtpNegotiationCommand.cc | 2 +- src/HttpConnection.cc | 58 ++++++++++++++-------------- src/HttpConnection.h | 14 +++---- src/HttpInitiateConnectionCommand.cc | 6 +-- 7 files changed, 51 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93178c86..2d286ce7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-06-12 Tatsuhiro Tsujikawa + + Renamed member variables. Removed unused member variable. + * src/AbstractProxyRequestCommand.cc + * src/FtpInitiateConnectionCommand.cc + * src/FtpNegotiationCommand.cc + * src/HttpConnection.cc + * src/HttpConnection.h + * src/HttpInitiateConnectionCommand.cc + 2010-06-12 Tatsuhiro Tsujikawa Removed HandleRegistry diff --git a/src/AbstractProxyRequestCommand.cc b/src/AbstractProxyRequestCommand.cc index 02b1850f..76771360 100644 --- a/src/AbstractProxyRequestCommand.cc +++ b/src/AbstractProxyRequestCommand.cc @@ -64,7 +64,7 @@ AbstractProxyRequestCommand::AbstractProxyRequestCommand : AbstractCommand(cuid, req, fileEntry, requestGroup, e, s), _proxyRequest(proxyRequest), - _httpConnection(new HttpConnection(cuid, s, getOption().get())) + _httpConnection(new HttpConnection(cuid, s)) { setTimeout(getOption()->getAsInt(PREF_CONNECT_TIMEOUT)); disableReadCheckSocket(); diff --git a/src/FtpInitiateConnectionCommand.cc b/src/FtpInitiateConnectionCommand.cc index bbd6503d..8a1d5b44 100644 --- a/src/FtpInitiateConnectionCommand.cc +++ b/src/FtpInitiateConnectionCommand.cc @@ -104,7 +104,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand // Use GET for FTP via HTTP proxy. getRequest()->setMethod(Request::METHOD_GET); SharedHandle hc - (new HttpConnection(getCuid(), getSocket(), getOption().get())); + (new HttpConnection(getCuid(), getSocket())); HttpRequestCommand* c = new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(), @@ -136,7 +136,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand // Use GET for FTP via HTTP proxy. getRequest()->setMethod(Request::METHOD_GET); SharedHandle hc - (new HttpConnection(getCuid(), pooledSocket, getOption().get())); + (new HttpConnection(getCuid(), pooledSocket)); HttpRequestCommand* c = new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(), diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index aecd0e1e..c7fb87d4 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -598,7 +598,7 @@ bool FtpNegotiationCommand::resolveProxy() _dataSocket->establishConnection(_proxyAddr, proxyReq->getPort()); disableReadCheckSocket(); setWriteCheckSocket(_dataSocket); - _http.reset(new HttpConnection(getCuid(), _dataSocket, getOption().get())); + _http.reset(new HttpConnection(getCuid(), _dataSocket)); _sequence = SEQ_SEND_TUNNEL_REQUEST; return false; } diff --git a/src/HttpConnection.cc b/src/HttpConnection.cc index 6b257f64..336a7941 100644 --- a/src/HttpConnection.cc +++ b/src/HttpConnection.cc @@ -65,12 +65,10 @@ HttpRequestEntry::HttpRequestEntry HttpRequestEntry::~HttpRequestEntry() {} -HttpConnection::HttpConnection(cuid_t cuid, - const SocketHandle& socket, - const Option* op): - cuid(cuid), socket(socket), +HttpConnection::HttpConnection(cuid_t cuid, const SocketHandle& socket): + _cuid(cuid), _socket(socket), _socketBuffer(socket), - option(op), logger(LogFactory::getInstance()) + _logger(LogFactory::getInstance()) {} std::string HttpConnection::eraseConfidentialInfo(const std::string& request) @@ -95,45 +93,45 @@ std::string HttpConnection::eraseConfidentialInfo(const std::string& request) void HttpConnection::sendRequest(const SharedHandle& httpRequest) { std::string request = httpRequest->createRequest(); - if(logger->info()) { - logger->info(MSG_SENDING_REQUEST, - util::itos(cuid).c_str(), - eraseConfidentialInfo(request).c_str()); + if(_logger->info()) { + _logger->info(MSG_SENDING_REQUEST, + util::itos(_cuid).c_str(), + eraseConfidentialInfo(request).c_str()); } _socketBuffer.pushStr(request); _socketBuffer.send(); SharedHandle entry(new HttpRequestEntry(httpRequest)); - outstandingHttpRequests.push_back(entry); + _outstandingHttpRequests.push_back(entry); } void HttpConnection::sendProxyRequest (const SharedHandle& httpRequest) { std::string request = httpRequest->createProxyRequest(); - if(logger->info()) { - logger->info(MSG_SENDING_REQUEST, - util::itos(cuid).c_str(), - eraseConfidentialInfo(request).c_str()); + if(_logger->info()) { + _logger->info(MSG_SENDING_REQUEST, + util::itos(_cuid).c_str(), + eraseConfidentialInfo(request).c_str()); } _socketBuffer.pushStr(request); _socketBuffer.send(); SharedHandle entry(new HttpRequestEntry(httpRequest)); - outstandingHttpRequests.push_back(entry); + _outstandingHttpRequests.push_back(entry); } SharedHandle HttpConnection::receiveResponse() { - if(outstandingHttpRequests.empty()) { + if(_outstandingHttpRequests.empty()) { throw DL_ABORT_EX(EX_NO_HTTP_REQUEST_ENTRY_FOUND); } - HttpRequestEntryHandle entry = outstandingHttpRequests.front(); + HttpRequestEntryHandle entry = _outstandingHttpRequests.front(); HttpHeaderProcessorHandle proc = entry->getHttpHeaderProcessor(); unsigned char buf[512]; size_t size = sizeof(buf); - socket->peekData(buf, size); + _socket->peekData(buf, size); if(size == 0) { - if(socket->wantRead() || socket->wantWrite()) { + if(_socket->wantRead() || _socket->wantWrite()) { return SharedHandle(); } else { throw DL_RETRY_EX(EX_INVALID_RESPONSE); @@ -141,31 +139,31 @@ SharedHandle HttpConnection::receiveResponse() } proc->update(buf, size); if(!proc->eoh()) { - socket->readData(buf, size); + _socket->readData(buf, size); return SharedHandle(); } size_t putbackDataLength = proc->getPutBackDataLength(); size -= putbackDataLength; - socket->readData(buf, size); - if(logger->info()) { - logger->info(MSG_RECEIVE_RESPONSE, - util::itos(cuid).c_str(), proc->getHeaderString().c_str()); + _socket->readData(buf, size); + if(_logger->info()) { + _logger->info(MSG_RECEIVE_RESPONSE, + util::itos(_cuid).c_str(), proc->getHeaderString().c_str()); } SharedHandle httpHeader = proc->getHttpResponseHeader(); SharedHandle httpResponse(new HttpResponse()); - httpResponse->setCuid(cuid); + httpResponse->setCuid(_cuid); httpResponse->setHttpHeader(httpHeader); httpResponse->setHttpRequest(entry->getHttpRequest()); - outstandingHttpRequests.pop_front(); + _outstandingHttpRequests.pop_front(); return httpResponse; } bool HttpConnection::isIssued(const SharedHandle& segment) const { - for(HttpRequestEntries::const_iterator itr = outstandingHttpRequests.begin(), - eoi = outstandingHttpRequests.end(); itr != eoi; ++itr) { + for(HttpRequestEntries::const_iterator itr = _outstandingHttpRequests.begin(), + eoi = _outstandingHttpRequests.end(); itr != eoi; ++itr) { SharedHandle httpRequest = (*itr)->getHttpRequest(); if(httpRequest->getSegment() == segment) { return true; @@ -176,10 +174,10 @@ bool HttpConnection::isIssued(const SharedHandle& segment) const SharedHandle HttpConnection::getFirstHttpRequest() const { - if(outstandingHttpRequests.empty()) { + if(_outstandingHttpRequests.empty()) { return SharedHandle(); } else { - return outstandingHttpRequests.front()->getHttpRequest(); + return _outstandingHttpRequests.front()->getHttpRequest(); } } diff --git a/src/HttpConnection.h b/src/HttpConnection.h index 33f33839..f9f6af16 100644 --- a/src/HttpConnection.h +++ b/src/HttpConnection.h @@ -79,19 +79,17 @@ typedef std::deque HttpRequestEntries; class HttpConnection { private: - cuid_t cuid; - SharedHandle socket; + cuid_t _cuid; + SharedHandle _socket; SocketBuffer _socketBuffer; - const Option* option; - Logger* logger; + const Option* _option; + Logger* _logger; - HttpRequestEntries outstandingHttpRequests; + HttpRequestEntries _outstandingHttpRequests; std::string eraseConfidentialInfo(const std::string& request); public: - HttpConnection(cuid_t cuid, - const SharedHandle& socket, - const Option* op); + HttpConnection(cuid_t cuid, const SharedHandle& socket); /** * Sends Http request. diff --git a/src/HttpInitiateConnectionCommand.cc b/src/HttpInitiateConnectionCommand.cc index 822e6c24..9d62fbc2 100644 --- a/src/HttpInitiateConnectionCommand.cc +++ b/src/HttpInitiateConnectionCommand.cc @@ -98,7 +98,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand command = c; } else if(proxyMethod == V_GET) { SharedHandle httpConnection - (new HttpConnection(getCuid(), getSocket(), getOption().get())); + (new HttpConnection(getCuid(), getSocket())); HttpRequestCommand* c = new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(), @@ -115,7 +115,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand } } else { SharedHandle httpConnection - (new HttpConnection(getCuid(), pooledSocket, getOption().get())); + (new HttpConnection(getCuid(), pooledSocket)); HttpRequestCommand* c = new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(), @@ -143,7 +143,7 @@ Command* HttpInitiateConnectionCommand::createNextCommand setSocket(pooledSocket); } SharedHandle httpConnection - (new HttpConnection(getCuid(), getSocket(), getOption().get())); + (new HttpConnection(getCuid(), getSocket())); HttpRequestCommand* c = new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(), getRequestGroup(),