mirror of https://github.com/aria2/aria2
2010-09-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that error occurs when downloading zero-length file. * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.ccpull/1/head
parent
5bf8a53b3f
commit
97953dd1ae
|
@ -1,3 +1,9 @@
|
||||||
|
2010-09-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Fixed the bug that error occurs when downloading zero-length file.
|
||||||
|
* src/FtpNegotiationCommand.cc
|
||||||
|
* src/HttpResponseCommand.cc
|
||||||
|
|
||||||
2010-09-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-09-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed compile error without OpenSSL/GnuTLS.
|
Fixed compile error without OpenSSL/GnuTLS.
|
||||||
|
|
|
@ -403,7 +403,8 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getRequestGroup()->downloadFinishedByFileLength()) {
|
if(getDownloadContext()->knowsTotalLength() &&
|
||||||
|
getRequestGroup()->downloadFinishedByFileLength()) {
|
||||||
getRequestGroup()->initPieceStorage();
|
getRequestGroup()->initPieceStorage();
|
||||||
getPieceStorage()->markAllPiecesDone();
|
getPieceStorage()->markAllPiecesDone();
|
||||||
// TODO It would be good to issue ChecksumCheckIntegrity here
|
// TODO It would be good to issue ChecksumCheckIntegrity here
|
||||||
|
@ -425,6 +426,7 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
|
||||||
|
|
||||||
if(getDownloadContext()->knowsTotalLength()) {
|
if(getDownloadContext()->knowsTotalLength()) {
|
||||||
sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
|
sequence_ = SEQ_DOWNLOAD_ALREADY_COMPLETED;
|
||||||
|
getPieceStorage()->markAllPiecesDone();
|
||||||
poolConnection();
|
poolConnection();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,8 +375,21 @@ bool HttpResponseCommand::handleOtherEncoding
|
||||||
return prepareForRetry(0);
|
return prepareForRetry(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In this context, knowsTotalLength() is true only when the file is
|
||||||
|
// really zero-length.
|
||||||
|
|
||||||
|
SharedHandle<StreamFilter> streamFilter =
|
||||||
|
getTransferEncodingStreamFilter
|
||||||
|
(httpResponse,
|
||||||
|
getContentEncodingStreamFilter(httpResponse));
|
||||||
|
// If chunked transfer-encoding is specified, we have to read end of
|
||||||
|
// chunk markers(0\r\n\r\n, for example).
|
||||||
|
bool chunkedUsed = !streamFilter.isNull() &&
|
||||||
|
streamFilter->getName() == ChunkedDecodingStreamFilter::NAME;
|
||||||
|
|
||||||
// For zero-length file, check existing file comparing its size
|
// For zero-length file, check existing file comparing its size
|
||||||
if(getRequestGroup()->downloadFinishedByFileLength()) {
|
if(!chunkedUsed && getDownloadContext()->knowsTotalLength() &&
|
||||||
|
getRequestGroup()->downloadFinishedByFileLength()) {
|
||||||
getRequestGroup()->initPieceStorage();
|
getRequestGroup()->initPieceStorage();
|
||||||
getPieceStorage()->markAllPiecesDone();
|
getPieceStorage()->markAllPiecesDone();
|
||||||
// This is zero-size file, so hash check is no use.
|
// This is zero-size file, so hash check is no use.
|
||||||
|
@ -392,19 +405,11 @@ bool HttpResponseCommand::handleOtherEncoding
|
||||||
getRequestGroup()->initPieceStorage();
|
getRequestGroup()->initPieceStorage();
|
||||||
getPieceStorage()->getDiskAdaptor()->initAndOpenFile();
|
getPieceStorage()->getDiskAdaptor()->initAndOpenFile();
|
||||||
|
|
||||||
SharedHandle<StreamFilter> streamFilter =
|
// Local file size becomes zero when DiskAdaptor::initAndOpenFile()
|
||||||
getTransferEncodingStreamFilter
|
// is called. So zero-length file is complete if chunked encoding is
|
||||||
(httpResponse,
|
// not used.
|
||||||
getContentEncodingStreamFilter(httpResponse));
|
if(!chunkedUsed && getDownloadContext()->knowsTotalLength()) {
|
||||||
|
getRequestGroup()->getPieceStorage()->markAllPiecesDone();
|
||||||
// In this context, knowsTotalLength() is true only when the file is
|
|
||||||
// really zero-length.
|
|
||||||
if(getDownloadContext()->knowsTotalLength() &&
|
|
||||||
(streamFilter.isNull() ||
|
|
||||||
streamFilter->getName() != ChunkedDecodingStreamFilter::NAME)) {
|
|
||||||
// If chunked transfer-encoding is specified, we have to read end
|
|
||||||
// of chunk markers(0\r\n\r\n, for example), so cannot pool
|
|
||||||
// connection here.
|
|
||||||
poolConnection();
|
poolConnection();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue