diff --git a/CHANGELOG.md b/CHANGELOG.md index 56bdd598..95f34d89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Require Visual Studio 2015 Update 3 or later * Use fwrite return value in file_body * Add decorator unit test +* Add write_frames unit test -------------------------------------------------------------------------------- diff --git a/test/websocket/stream.cpp b/test/websocket/stream.cpp index 08895a81..47e0c833 100644 --- a/test/websocket/stream.cpp +++ b/test/websocket/stream.cpp @@ -805,6 +805,32 @@ public: } #endif + /* + https://github.com/vinniefalco/Beast/issues/300 + + Write a message as two individual frames + */ + void + testWriteFrames(endpoint_type const& ep) + { + error_code ec; + socket_type sock{ios_}; + sock.connect(ep, ec); + if(! BEAST_EXPECTS(! ec, ec.message())) + return; + stream ws{sock}; + ws.handshake("localhost", "/", ec); + if(! BEAST_EXPECTS(! ec, ec.message())) + return; + ws.write_frame(false, sbuf("u")); + ws.write_frame(true, sbuf("v")); + streambuf sb; + opcode op; + ws.read(op, sb, ec); + if(! BEAST_EXPECTS(! ec, ec.message())) + return; + } + void testAsyncWriteFrame(endpoint_type const& ep) { @@ -1281,9 +1307,14 @@ public: testBadHandshakes(); testBadResponses(); + permessage_deflate pmd; + pmd.client_enable = false; + pmd.server_enable = false; + { error_code ec; ::websocket::sync_echo_server server{nullptr}; + server.set_option(pmd); server.open(any, ec); BEAST_EXPECTS(! ec, ec.message()); auto const ep = server.local_endpoint(); @@ -1293,6 +1324,7 @@ public: testInvokable3(ep); testInvokable4(ep); //testInvokable5(ep); + testWriteFrames(ep); testAsyncWriteFrame(ep); } @@ -1340,8 +1372,6 @@ public: } }; - permessage_deflate pmd; - pmd.client_enable = false; pmd.server_enable = false; doClientTests(pmd);