From 5a9184543e94a5ec07a025e31359ad8649ddc654 Mon Sep 17 00:00:00 2001 From: upstream svn Date: Thu, 25 Jun 2009 19:38:04 +0200 Subject: [PATCH] Upstream tarball 9676 --- .svn-revision | 2 +- docs/Changelog | 1 + src/HTTPDownload.cpp | 12 ++++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.svn-revision b/.svn-revision index e2003e33..6935308d 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -9675 +9676 diff --git a/docs/Changelog b/docs/Changelog index eb6ccaf2..c8219f82 100644 --- a/docs/Changelog +++ b/docs/Changelog @@ -74,6 +74,7 @@ Version 2.3.0 - The river knows. * Fixed client information in remote gui * Don't kick friend upload, don't kick release prio uploads (unless they take more than half of the slots), and don't kick anybody else unless necessary (with GonoszTopi) + * Fixed HTTP download if server transmits no content-length Vollstrecker: * Unify copyright lines diff --git a/src/HTTPDownload.cpp b/src/HTTPDownload.cpp index d3823284..f8b633c1 100644 --- a/src/HTTPDownload.cpp +++ b/src/HTTPDownload.cpp @@ -196,7 +196,11 @@ CMuleThread::ExitCode CHTTPDownloadThread::Entry() } int download_size = url_read_stream->GetSize(); - AddLogLineNS(CFormat(_("Download size: %i")) % download_size); + if (download_size == -1) { + AddLogLineNS(_("Download size not received, downloading until connection is closed")); + } else { + AddLogLineNS(CFormat(_("Download size: %i")) % download_size); + } // Here is our read buffer // Still, I'm sure 4092 is probably a better size. @@ -227,7 +231,11 @@ CMuleThread::ExitCode CHTTPDownloadThread::Entry() } while (current_read && !TestDestroy()); if (current_read == 0) { - if (total_read != download_size) { + if (download_size == -1) { + // Download was probably succesful. + AddLogLineNS(CFormat(_("Downloaded %d bytes")) % total_read); + m_result = 1; + } else if (total_read != download_size) { throw wxString(CFormat(_("Expected %d bytes, but downloaded %d bytes")) % download_size % total_read); } else { // Download was succesful. -- 2.11.4.GIT