diff --git a/changelog.md b/changelog.md index 067fe33..f2d420c 100644 --- a/changelog.md +++ b/changelog.md @@ -36,6 +36,8 @@ HEAD long response before their HTTP handler ends would result in a second set of HTTP headers being injected into the output. Thank you Kevin Smith for reporting and providing test case details. #443 +- Compatibility: Removes non-standards compliant masking behavior. Fixes #469, + Fixes #395 0.6.0 - MINOR BREAKING TRANSPORT POLICY CHANGE: Custom transport policies will now be diff --git a/websocketpp/processors/hybi13.hpp b/websocketpp/processors/hybi13.hpp index b18dd15..7948665 100644 --- a/websocketpp/processors/hybi13.hpp +++ b/websocketpp/processors/hybi13.hpp @@ -574,19 +574,6 @@ public: * Performs validation, masking, compression, etc. will return an error if * there was an error, otherwise msg will be ready to be written * - * By default WebSocket++ performs block masking/unmasking in a manner that - * makes assumptions about the nature of the machine and STL library used. - * In particular the assumption is either a 32 or 64 bit word size and an - * STL with std::string::data returning a contiguous char array. - * - * This method improves masking performance by 3-8x depending on the ratio - * of small to large messages and the availability of a 64 bit processor. - * - * To disable this optimization (for use with alternative STL - * implementations or processors) define WEBSOCKETPP_STRICT_MASKING when - * compiling the library. This will force the library to perform masking in - * single byte chunks. - * * TODO: tests * * @param in An unprepared message to prepare @@ -791,19 +778,9 @@ protected: { // unmask if masked if (frame::get_masked(m_basic_header)) { - #ifdef WEBSOCKETPP_STRICT_MASKING - m_current_msg->prepared_key = frame::byte_mask_circ( - buf, - len, - m_current_msg->prepared_key - ); - #else - m_current_msg->prepared_key = frame::word_mask_circ( - buf, - len, - m_current_msg->prepared_key - ); - #endif + m_current_msg->prepared_key = frame::byte_mask_circ( + buf, len, m_current_msg->prepared_key); + // TODO: SIMD masking } std::string & out = m_current_msg->msg_ptr->get_raw_payload(); @@ -962,16 +939,8 @@ protected: void masked_copy (std::string const & i, std::string & o, frame::masking_key_type key) const { - #ifdef WEBSOCKETPP_STRICT_MASKING - frame::byte_mask(i.begin(),i.end(),o.begin(),key); - #else - websocketpp::frame::word_mask_exact( - reinterpret_cast(const_cast(i.data())), - reinterpret_cast(const_cast(o.data())), - i.size(), - key - ); - #endif + frame::byte_mask(i.begin(),i.end(),o.begin(),key); + // TODO: SIMD masking } /// Generic prepare control frame with opcode and payload.