From 3283f732658c5d5762b46103c41b3f7f148c0341 Mon Sep 17 00:00:00 2001 From: janbar Date: Sat, 22 Jul 2017 10:05:37 +0200 Subject: [PATCH] sync upstream lib/noson janbar-noson-d4c2ec9 --- backend/lib/noson/noson/CMakeLists.txt | 2 +- backend/lib/noson/noson/src/private/wsresponse.cpp | 8 ++++++-- backend/lib/noson/noson/src/private/wsresponse.h | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/lib/noson/noson/CMakeLists.txt b/backend/lib/noson/noson/CMakeLists.txt index 77b44d36..85bb1085 100644 --- a/backend/lib/noson/noson/CMakeLists.txt +++ b/backend/lib/noson/noson/CMakeLists.txt @@ -20,7 +20,7 @@ endif () ############################################################################### # set lib version here -set (NOSON_LIB_VERSION "1.5.0") +set (NOSON_LIB_VERSION "1.5.1") set (NOSON_LIB_SOVERSION "1") ############################################################################### diff --git a/backend/lib/noson/noson/src/private/wsresponse.cpp b/backend/lib/noson/noson/src/private/wsresponse.cpp index 709bb50e..871e4f14 100644 --- a/backend/lib/noson/noson/src/private/wsresponse.cpp +++ b/backend/lib/noson/noson/src/private/wsresponse.cpp @@ -290,9 +290,9 @@ size_t WSResponse::ReadChunk(void *buf, size_t buflen) if (m_contentChunked) { // no more pending byte in chunk buffer - if (m_chunkPtr == NULL || m_chunkPtr >= m_chunkEOR) + if (m_chunkPtr >= m_chunkEnd) { - // process next chunk if all bytes have been read from the chunk buffer + // process next chunk SAFE_DELETE_ARRAY(m_chunkBuffer); m_chunkBuffer = m_chunkPtr = m_chunkEOR = m_chunkEnd = NULL; std::string strread; @@ -310,6 +310,10 @@ size_t WSResponse::ReadChunk(void *buf, size_t buflen) } else return 0; // that's the end of chunks + } + // fill chunk buffer + if (m_chunkPtr >= m_chunkEOR) + { // ask for new data to fill in the chunk buffer // fill at last read position and until to the end m_chunkEOR += m_socket->ReceiveData(m_chunkEOR, m_chunkEnd - m_chunkEOR); diff --git a/backend/lib/noson/noson/src/private/wsresponse.h b/backend/lib/noson/noson/src/private/wsresponse.h index c2cd9c7f..2dd29e32 100644 --- a/backend/lib/noson/noson/src/private/wsresponse.h +++ b/backend/lib/noson/noson/src/private/wsresponse.h @@ -54,7 +54,7 @@ namespace NSROOT bool GetHeaderValue(const std::string& header, std::string& value); static bool ReadHeaderLine(NetSocket *socket, const char *eol, std::string& line, size_t *len); - + private: TcpSocket *m_socket; bool m_successful;