diff options
author | mbroshi <michael.broshi@mathworks.com> | 2019-04-09 22:46:13 +0300 |
---|---|---|
committer | mbroshi <michael.broshi@mathworks.com> | 2019-04-09 22:46:13 +0300 |
commit | 5949e758ef896013e7068986a501dc50a7dfa829 (patch) | |
tree | 29491d48cde570eb9609fc2bdafec9f587dcdf0c | |
parent | 24962ff97c674b48decde2821b7cbe0fdba631b8 (diff) |
Allocate correct amount of additional capacity on buffer
-rw-r--r-- | client_ws.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/client_ws.hpp b/client_ws.hpp index 948b3d4..29a1cbb 100644 --- a/client_ws.hpp +++ b/client_ws.hpp @@ -234,8 +234,9 @@ namespace SimpleWeb { mask[c] = static_cast<unsigned char>(dist(rd)); std::size_t length = out_message->size(); - - auto out_header_and_message = std::make_shared<OutMessage>(length + 12); // at most 12 header bytes added + + std::size_t max_additional_bytes = 14; // ws protocol adds at most 14 bytes + auto out_header_and_message = std::make_shared<OutMessage>(length + max_additional_bytes); out_header_and_message->put(static_cast<char>(fin_rsv_opcode)); // Masked (first length byte>=128) |