[Libreoffice-commits] online.git: loolwsd/test

Tor Lillqvist tml at collabora.com
Tue Apr 26 05:24:51 UTC 2016


 loolwsd/test/httpwstest.cpp |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 42dcd6ea9934ee61dae7c92a0a80936bc71bbef9
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Apr 26 08:15:40 2016 +0300

    Why log a string that we even expect to be junk?
    
    WebSocket::receiveFrame() does not null-terminate the buffer even when
    it successfully reads something into it, even less when it
    doesn't. (Why would it, as it is perferctly fine to transmit WebSocket
    (binary) frames that contain zero bytes.) So the 'received' string was
    always full of random bytes.

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 42aa396..492ebf1 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -317,8 +317,7 @@ void HTTPWSTest::testCloseAfterClose()
 
         // no more messages is received.
         bytes = socket.receiveFrame(buffer, sizeof(buffer), flags);
-        std::string received(buffer);
-        std::cout << received << "received " << bytes << " flags "<< flags << std::endl;
+        std::cout << "Received " << bytes << " bytes, flags: "<< std::hex << flags << std::dec << std::endl;
         CPPUNIT_ASSERT_EQUAL(0, bytes);
         CPPUNIT_ASSERT_EQUAL(0, flags);
     }


More information about the Libreoffice-commits mailing list