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/HttpSkipResponseCommand.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/HttpSkipResponseCommand.cc')
| -rw-r--r-- | src/HttpSkipResponseCommand.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/HttpSkipResponseCommand.cc b/src/HttpSkipResponseCommand.cc index 8ef54269..5d63a9c0 100644 --- a/src/HttpSkipResponseCommand.cc +++ b/src/HttpSkipResponseCommand.cc @@ -96,7 +96,8 @@ bool HttpSkipResponseCommand::executeInternal() // The return value is safely ignored here. _transferEncodingDecoder->decode(buf, bufSize); } - if(_totalLength != 0 && bufSize == 0) { + if(_totalLength != 0 && bufSize == 0 && + !socket->wantRead() && !socket->wantWrite()) { throw DlRetryEx(EX_GOT_EOF); } } catch(RecoverableException& e) { @@ -104,15 +105,19 @@ bool HttpSkipResponseCommand::executeInternal() return processResponse(); } - if(bufSize == 0) { - // Since this method is called by DownloadEngine only when the socket is - // readable, bufSize == 0 means server shutdown the connection. - // So socket cannot be reused in this case. - return prepareForRetry(0); - } else if((!_transferEncodingDecoder.isNull() && - _transferEncodingDecoder->finished()) - || (_transferEncodingDecoder.isNull() && - _totalLength == _receivedBytes)) { + bool finished = false; + if(_transferEncodingDecoder.isNull()) { + if(bufSize == 0) { + if(!socket->wantRead() && !socket->wantWrite()) { + return processResponse(); + } + } else { + finished = (_totalLength == _receivedBytes); + } + } else { + finished = _transferEncodingDecoder->finished(); + } + if(finished) { if(!e->option->getAsBool(PREF_HTTP_PROXY_ENABLED) && req->supportsPersistentConnection()) { std::pair<std::string, uint16_t> peerInfo; @@ -121,6 +126,7 @@ bool HttpSkipResponseCommand::executeInternal() } return processResponse(); } else { + setWriteCheckSocketIf(socket, socket->wantWrite()); e->commands.push_back(this); return false; } |
