diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-09-27 16:06:34 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-09-27 16:06:34 +0000 |
| commit | e9e215dc1f37827fabd87d6fb7ed99afa843d53a (patch) | |
| tree | 6d469623c5b8a706f835aaebef53769736523eb9 /src/DownloadCommand.cc | |
| parent | 080fcd5fb81793cf53e5b5af8193df9440196ee1 (diff) | |
2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that HTTPS download fails.
* src/AbstractCommand.cc
* src/AbstractCommand.h
* src/DownloadCommand.cc
* src/FtpConnection.cc
* src/HttpConnection.cc
* src/HttpRequestCommand.cc
* src/HttpResponseCommand.cc
* src/HttpSkipResponseCommand.cc
* src/MSEHandshake.cc
* src/PeerConnection.cc
* src/SocketCore.cc
* src/SocketCore.h
Fixed the bug that aria2 doesn't download whole content body and
cannot
reuse connection if chunked transfer encoding and gzip content
encoding
are set.
* src/DownloadCommand.cc
* src/HttpSkipResponseCommand.cc
Diffstat (limited to 'src/DownloadCommand.cc')
| -rw-r--r-- | src/DownloadCommand.cc | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/DownloadCommand.cc b/src/DownloadCommand.cc index deed4401..0ec0299a 100644 --- a/src/DownloadCommand.cc +++ b/src/DownloadCommand.cc @@ -159,24 +159,38 @@ bool DownloadCommand::executeInternal() { peerStat->updateDownloadLength(bufSize); - if(_requestGroup->getTotalLength() != 0 && bufSize == 0) { + if(_requestGroup->getTotalLength() != 0 && bufSize == 0 && + !socket->wantRead() && !socket->wantWrite()) { throw DlRetryEx(EX_GOT_EOF); } - if((!_transferEncodingDecoder.isNull() && - _transferEncodingDecoder->finished()) - || (_transferEncodingDecoder.isNull() && segment->complete()) - || (!_contentEncodingDecoder.isNull() && - _contentEncodingDecoder->finished()) - || bufSize == 0) { - logger->info(MSG_SEGMENT_DOWNLOAD_COMPLETED, cuid); - - if(!_contentEncodingDecoder.isNull() && - !_contentEncodingDecoder->finished()) { - logger->warn("CUID#%d - Transfer was completed, but inflate operation" - " have not finished. Maybe the file is broken in the server" - " side.", cuid); + bool segmentComplete = false; + if(_transferEncodingDecoder.isNull() && _contentEncodingDecoder.isNull()) { + if(segment->complete()) { + segmentComplete = true; + } else if(segment->getLength() == 0 && bufSize == 0 && + !socket->wantRead() && !socket->wantWrite()) { + segmentComplete = true; + } + } else if(!_transferEncodingDecoder.isNull() && + !_contentEncodingDecoder.isNull()) { + if(_transferEncodingDecoder->finished() && + _contentEncodingDecoder->finished()) { + segmentComplete = true; + } + } else if(!_transferEncodingDecoder.isNull() && + _contentEncodingDecoder.isNull()) { + if(_transferEncodingDecoder->finished()) { + segmentComplete = true; } + } else if(_transferEncodingDecoder.isNull() && + !_contentEncodingDecoder.isNull()) { + if(_contentEncodingDecoder->finished()) { + segmentComplete = true; + } + } + if(segmentComplete) { + logger->info(MSG_SEGMENT_DOWNLOAD_COMPLETED, cuid); #ifdef ENABLE_MESSAGE_DIGEST { @@ -211,6 +225,7 @@ bool DownloadCommand::executeInternal() { return prepareForNextSegment(); } else { checkLowestDownloadSpeed(); + setWriteCheckSocketIf(socket, socket->wantWrite()); e->commands.push_back(this); return false; } |
