From 8b6b8e21a40856edb0be2daa851a6a226b7afb75 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 2 Sep 2005 17:30:31 +0000 Subject: [PATCH] corrected error code for http responses with no content-length indicated (from READ_ERROR to EOF) so that clients of streams can rely on getting EOF or NO_ERROR when everything is ok git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/http.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/common/http.cpp b/src/common/http.cpp index cc6ea854b9..6f4aacf052 100644 --- a/src/common/http.cpp +++ b/src/common/http.cpp @@ -335,6 +335,15 @@ size_t wxHTTPStream::OnSysRead(void *buffer, size_t bufsize) size_t ret = wxSocketInputStream::OnSysRead(buffer, bufsize); m_read_bytes += ret; + if (m_httpsize==(size_t)-1 && m_lasterror == wxSTREAM_READ_ERROR ) + { + // if m_httpsize is (size_t) -1 this means read until connection closed + // which is equivalent to getting a READ_ERROR, for clients however this + // must be translated into EOF, as it is the expected way of signalling + // end end of the content + m_lasterror = wxSTREAM_EOF ; + } + return ret; } -- 2.45.2