summaryrefslogtreecommitdiff
path: root/src/HttpDownloadCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-06-09 12:43:44 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-06-09 12:43:44 +0000
commit970e7f95a65b1b8940c9131a76372b7d7abffdf1 (patch)
treec3a9b7b51a97a01160a7b37989406b78041d9115 /src/HttpDownloadCommand.cc
parent9afc36152a1ce428243a3ace608d0508716a2efb (diff)
2010-06-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Made protected member variable private. Added accessor funcs. * src/AbstractCommand.cc * src/AbstractCommand.h * src/AbstractProxyRequestCommand.cc * src/AbstractProxyRequestCommand.h * src/AbstractProxyResponseCommand.cc * src/AbstractProxyResponseCommand.h * src/CreateRequestCommand.cc * src/DownloadCommand.cc * src/DownloadCommand.h * src/FtpDownloadCommand.cc * src/FtpDownloadCommand.h * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/FtpNegotiationCommand.h * src/FtpTunnelRequestCommand.cc * src/FtpTunnelResponseCommand.cc * src/HttpDownloadCommand.cc * src/HttpInitiateConnectionCommand.cc * src/HttpProxyRequestCommand.cc * src/HttpProxyResponseCommand.cc * src/HttpRequestCommand.cc * src/HttpResponseCommand.cc * src/HttpResponseCommand.h * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommand.cc
Diffstat (limited to 'src/HttpDownloadCommand.cc')
-rw-r--r--src/HttpDownloadCommand.cc45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/HttpDownloadCommand.cc b/src/HttpDownloadCommand.cc
index 3121da3f..7ff66769 100644
--- a/src/HttpDownloadCommand.cc
+++ b/src/HttpDownloadCommand.cc
@@ -71,29 +71,29 @@ HttpDownloadCommand::HttpDownloadCommand
HttpDownloadCommand::~HttpDownloadCommand() {}
bool HttpDownloadCommand::prepareForNextSegment() {
- bool downloadFinished = _requestGroup->downloadFinished();
- if(req->isPipeliningEnabled() && !downloadFinished) {
+ bool downloadFinished = getRequestGroup()->downloadFinished();
+ if(getRequest()->isPipeliningEnabled() && !downloadFinished) {
HttpRequestCommand* command =
- new HttpRequestCommand(getCuid(), req, _fileEntry,
- _requestGroup, _httpConnection, e,
- socket);
+ new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(),
+ getRequestGroup(), _httpConnection,
+ getDownloadEngine(), getSocket());
// Set proxy request here. aria2 sends the HTTP request specialized for
// proxy.
- if(resolveProxyMethod(req->getProtocol()) == V_GET) {
+ if(resolveProxyMethod(getRequest()->getProtocol()) == V_GET) {
command->setProxyRequest(createProxyRequest());
}
- e->addCommand(command);
+ getDownloadEngine()->addCommand(command);
return true;
} else {
- if(req->isPipeliningEnabled() ||
- (req->isKeepAliveEnabled() &&
+ if(getRequest()->isPipeliningEnabled() ||
+ (getRequest()->isKeepAliveEnabled() &&
(
- ((!_transferEncodingDecoder.isNull() &&
- _transferEncodingDecoder->finished()) ||
- (!_contentEncodingDecoder.isNull() &&
- _contentEncodingDecoder->finished())) ||
- _fileEntry->getLastOffset() ==
- _segments.front()->getPositionToWrite()
+ ((!getTransferEncodingDecoder().isNull() &&
+ getTransferEncodingDecoder()->finished()) ||
+ (!getContentEncodingDecoder().isNull() &&
+ getContentEncodingDecoder()->finished())) ||
+ getFileEntry()->getLastOffset() ==
+ getSegments().front()->getPositionToWrite()
)
)
) {
@@ -102,20 +102,23 @@ bool HttpDownloadCommand::prepareForNextSegment() {
// pool terminated socket. In HTTP/1.1, keep-alive is default,
// so closing connection without Connection: close header means
// that server is broken or not configured properly.
- e->poolSocket(req, createProxyRequest(), socket);
+ getDownloadEngine()->poolSocket
+ (getRequest(), createProxyRequest(), getSocket());
}
// The request was sent assuming that server supported pipelining, but
// it turned out that server didn't support it.
// We detect this situation by comparing the end byte in range header
// of the response with the end byte of segment.
// If it is the same, HTTP negotiation is necessary for the next request.
- if(!req->isPipeliningEnabled() && req->isPipeliningHint() &&
+ if(!getRequest()->isPipeliningEnabled() &&
+ getRequest()->isPipeliningHint() &&
!downloadFinished) {
- const SharedHandle<Segment>& segment = _segments.front();
+ const SharedHandle<Segment>& segment = getSegments().front();
- off_t lastOffset =_fileEntry->gtoloff
- (std::min(static_cast<off_t>(segment->getPosition()+segment->getLength()),
- _fileEntry->getLastOffset()));
+ off_t lastOffset =getFileEntry()->gtoloff
+ (std::min(static_cast<off_t>
+ (segment->getPosition()+segment->getLength()),
+ getFileEntry()->getLastOffset()));
if(lastOffset ==
_httpResponse->getHttpHeader()->getRange()->getEndByte()+1) {