[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/loolnb.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Feb 20 04:38:13 UTC 2017


 net/loolnb.cpp |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit bbd231fadaf957b66e04ad745c08942a321c6cae
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Feb 19 20:53:34 2017 -0500

    nb: http request is consumed completely
    
    Change-Id: I3525840deaf3ec95b8e74634ac36f22072bdf476
    Reviewed-on: https://gerrit.libreoffice.org/34449
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/net/loolnb.cpp b/net/loolnb.cpp
index fd74964..ad7482b 100644
--- a/net/loolnb.cpp
+++ b/net/loolnb.cpp
@@ -60,11 +60,9 @@ public:
         req.read(message);
 
         // if we succeeded - remove that from our input buffer
-        size_t consumed = std::min(T::_inBuffer.size(),
-                                   std::max((size_t)message.tellg(), size_t(0)));
-        assert(consumed <= T::_inBuffer.size());
-        T::_inBuffer.erase(T::_inBuffer.begin(), T::_inBuffer.begin() + consumed);
-        std::cerr << "inBuffer has " << T::_inBuffer.size() << " remaining\n";
+        // An HTTP request is either parsed completely and successfully, or not.
+        // We can't have partial read, even though Poco seems to not report full read.
+        T::_inBuffer.clear();
 
         StringTokenizer tokens(req.getURI(), "/?");
         if (tokens.count() == 4)


More information about the Libreoffice-commits mailing list