From 259da6c52a804829d718957cbe36a77ac94b6716 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 10 Sep 2003 16:38:50 +0000 Subject: [PATCH] backported wxHTTPStream EOF fix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 3 ++- src/common/http.cpp | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 6d6f5ee13f..2a653fe2b8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -185,7 +185,8 @@ All: - always NUL-terminate the log messages - wxRegEx::Compile() now calculates the number of groups correctly -- wxHTTP::GetHeader() didn't find headers which not all in upper case +- wxHTTP::GetHeader() didn't find headers which were not all in upper case +- wxHTTP input stream didn't detect EOF correctly - wxString::find_last_of() ignored "start" parameter (Robert Vazan) - a bug in wxArrayString::Shrink() fixed (Gunnar Roth) diff --git a/src/common/http.cpp b/src/common/http.cpp index 116315075e..ca8a57af2c 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -291,15 +291,16 @@ protected: size_t wxHTTPStream::OnSysRead(void *buffer, size_t bufsize) { - size_t ret; + if (m_httpsize > 0 && m_read_bytes >= m_httpsize) + { + m_lasterror = wxSTREAM_EOF; + return 0; + } - if (m_httpsize > 0 && m_read_bytes >= m_httpsize) - return 0; + size_t ret = wxSocketInputStream::OnSysRead(buffer, bufsize); + m_read_bytes += ret; - ret = wxSocketInputStream::OnSysRead(buffer, bufsize); - m_read_bytes += ret; - - return ret; + return ret; } bool wxHTTP::Abort(void)