diff options
7 files changed, 148 insertions, 838 deletions
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0001-Fix-issue-599.patch b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0001-Fix-issue-599.patch deleted file mode 100644 index 2a9ea74cd0..0000000000 --- a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0001-Fix-issue-599.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From 1dd07113f2a7489444a8990a95be42e035f8e9df Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kurt Roeckx <kroeckx@debian.org> | ||
| 3 | Date: Tue, 1 Nov 2016 12:57:35 +0100 | ||
| 4 | Subject: [PATCH] Fix issue #599 | ||
| 5 | Forwarded: https://github.com/zaphoyd/websocketpp/pull/600 | ||
| 6 | |||
| 7 | --- | ||
| 8 | websocketpp/transport/asio/security/tls.hpp | 4 ---- | ||
| 9 | 1 file changed, 4 deletions(-) | ||
| 10 | |||
| 11 | diff --git a/websocketpp/transport/asio/security/tls.hpp b/websocketpp/transport/asio/security/tls.hpp | ||
| 12 | index 7b32db8..a8aafec 100644 | ||
| 13 | --- a/websocketpp/transport/asio/security/tls.hpp | ||
| 14 | +++ b/websocketpp/transport/asio/security/tls.hpp | ||
| 15 | @@ -355,13 +355,9 @@ protected: | ||
| 16 | template <typename ErrorCodeType> | ||
| 17 | lib::error_code translate_ec(ErrorCodeType ec) { | ||
| 18 | if (ec.category() == lib::asio::error::get_ssl_category()) { | ||
| 19 | - if (ERR_GET_REASON(ec.value()) == SSL_R_SHORT_READ) { | ||
| 20 | - return make_error_code(transport::error::tls_short_read); | ||
| 21 | - } else { | ||
| 22 | // We know it is a TLS related error, but otherwise don't know | ||
| 23 | // more. Pass through as TLS generic. | ||
| 24 | return make_error_code(transport::error::tls_error); | ||
| 25 | - } | ||
| 26 | } else { | ||
| 27 | // We don't know any more information about this error so pass | ||
| 28 | // through | ||
| 29 | -- | ||
| 30 | 2.7.4 | ||
| 31 | |||
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0001-Replace-make_shared-with-new-in-some-cases.patch b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0001-Replace-make_shared-with-new-in-some-cases.patch new file mode 100644 index 0000000000..0c8285df98 --- /dev/null +++ b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0001-Replace-make_shared-with-new-in-some-cases.patch | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | From 080fc37949114184d4832f7acffe2613745833f3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Stefan Floeren <42731906+stefan-floeren@users.noreply.github.com> | ||
| 3 | Date: Tue, 16 Apr 2019 08:38:01 +0200 | ||
| 4 | Subject: [PATCH 1/2] Replace make_shared with new in some cases | ||
| 5 | |||
| 6 | Replace make_shared for asio types that take a lib::ref as a parameter. | ||
| 7 | This should fix the ASIO change (boostorg/asio@59066d8) for 1.70, | ||
| 8 | while keeping it backwards compatible to older boost versions. | ||
| 9 | --- | ||
| 10 | websocketpp/transport/asio/connection.hpp | 7 ++++--- | ||
| 11 | websocketpp/transport/asio/endpoint.hpp | 3 +-- | ||
| 12 | websocketpp/transport/asio/security/none.hpp | 3 +-- | ||
| 13 | websocketpp/transport/asio/security/tls.hpp | 3 +-- | ||
| 14 | 4 files changed, 7 insertions(+), 9 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/websocketpp/transport/asio/connection.hpp b/websocketpp/transport/asio/connection.hpp | ||
| 17 | index 60f88a7..1ccda8f 100644 | ||
| 18 | --- a/websocketpp/transport/asio/connection.hpp | ||
| 19 | +++ b/websocketpp/transport/asio/connection.hpp | ||
| 20 | @@ -311,9 +311,10 @@ public: | ||
| 21 | * needed. | ||
| 22 | */ | ||
| 23 | timer_ptr set_timer(long duration, timer_handler callback) { | ||
| 24 | - timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>( | ||
| 25 | - lib::ref(*m_io_service), | ||
| 26 | - lib::asio::milliseconds(duration) | ||
| 27 | + timer_ptr new_timer( | ||
| 28 | + new lib::asio::steady_timer( | ||
| 29 | + *m_io_service, | ||
| 30 | + lib::asio::milliseconds(duration)) | ||
| 31 | ); | ||
| 32 | |||
| 33 | if (config::enable_multithreading) { | ||
| 34 | diff --git a/websocketpp/transport/asio/endpoint.hpp b/websocketpp/transport/asio/endpoint.hpp | ||
| 35 | index ddab2c7..4b719a9 100644 | ||
| 36 | --- a/websocketpp/transport/asio/endpoint.hpp | ||
| 37 | +++ b/websocketpp/transport/asio/endpoint.hpp | ||
| 38 | @@ -195,8 +195,7 @@ public: | ||
| 39 | |||
| 40 | m_io_service = ptr; | ||
| 41 | m_external_io_service = true; | ||
| 42 | - m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>( | ||
| 43 | - lib::ref(*m_io_service)); | ||
| 44 | + m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service)); | ||
| 45 | |||
| 46 | m_state = READY; | ||
| 47 | ec = lib::error_code(); | ||
| 48 | diff --git a/websocketpp/transport/asio/security/none.hpp b/websocketpp/transport/asio/security/none.hpp | ||
| 49 | index 5c8293d..6c7d352 100644 | ||
| 50 | --- a/websocketpp/transport/asio/security/none.hpp | ||
| 51 | +++ b/websocketpp/transport/asio/security/none.hpp | ||
| 52 | @@ -168,8 +168,7 @@ protected: | ||
| 53 | return socket::make_error_code(socket::error::invalid_state); | ||
| 54 | } | ||
| 55 | |||
| 56 | - m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( | ||
| 57 | - lib::ref(*service)); | ||
| 58 | + m_socket.reset(new lib::asio::ip::tcp::socket(*service)); | ||
| 59 | |||
| 60 | if (m_socket_init_handler) { | ||
| 61 | m_socket_init_handler(m_hdl, *m_socket); | ||
| 62 | diff --git a/websocketpp/transport/asio/security/tls.hpp b/websocketpp/transport/asio/security/tls.hpp | ||
| 63 | index c76fd9a..04ac379 100644 | ||
| 64 | --- a/websocketpp/transport/asio/security/tls.hpp | ||
| 65 | +++ b/websocketpp/transport/asio/security/tls.hpp | ||
| 66 | @@ -193,8 +193,7 @@ protected: | ||
| 67 | if (!m_context) { | ||
| 68 | return socket::make_error_code(socket::error::invalid_tls_context); | ||
| 69 | } | ||
| 70 | - m_socket = lib::make_shared<socket_type>( | ||
| 71 | - _WEBSOCKETPP_REF(*service),lib::ref(*m_context)); | ||
| 72 | + m_socket.reset(new socket_type(*service, *m_context)); | ||
| 73 | |||
| 74 | if (m_socket_init_handler) { | ||
| 75 | m_socket_init_handler(m_hdl, get_socket()); | ||
| 76 | -- | ||
| 77 | 2.23.0 | ||
| 78 | |||
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0002-Fix-missed-entries-fix-testing.patch b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0002-Fix-missed-entries-fix-testing.patch new file mode 100644 index 0000000000..962d089679 --- /dev/null +++ b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/0002-Fix-missed-entries-fix-testing.patch | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | From 12ab603ca962e83591985a585451d33544d75d56 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Stefan Floeren <42731906+stefan-floeren@users.noreply.github.com> | ||
| 3 | Date: Wed, 17 Apr 2019 10:06:18 +0000 | ||
| 4 | Subject: [PATCH 2/2] Fix missed entries; fix testing | ||
| 5 | |||
| 6 | --- | ||
| 7 | CMakeLists.txt | 2 +- | ||
| 8 | websocketpp/transport/asio/connection.hpp | 3 +-- | ||
| 9 | websocketpp/transport/asio/endpoint.hpp | 7 ++----- | ||
| 10 | 3 files changed, 4 insertions(+), 8 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 13 | index 2786aba..951de97 100644 | ||
| 14 | --- a/CMakeLists.txt | ||
| 15 | +++ b/CMakeLists.txt | ||
| 16 | @@ -202,7 +202,7 @@ if (BUILD_TESTS OR BUILD_EXAMPLES) | ||
| 17 | endif () | ||
| 18 | |||
| 19 | if (NOT Boost_USE_STATIC_LIBS) | ||
| 20 | - add_definitions (/DBOOST_TEST_DYN_LINK) | ||
| 21 | + add_definitions (-DBOOST_TEST_DYN_LINK) | ||
| 22 | endif () | ||
| 23 | |||
| 24 | set (Boost_FIND_REQUIRED TRUE) | ||
| 25 | diff --git a/websocketpp/transport/asio/connection.hpp b/websocketpp/transport/asio/connection.hpp | ||
| 26 | index 1ccda8f..57dda74 100644 | ||
| 27 | --- a/websocketpp/transport/asio/connection.hpp | ||
| 28 | +++ b/websocketpp/transport/asio/connection.hpp | ||
| 29 | @@ -462,8 +462,7 @@ protected: | ||
| 30 | m_io_service = io_service; | ||
| 31 | |||
| 32 | if (config::enable_multithreading) { | ||
| 33 | - m_strand = lib::make_shared<lib::asio::io_service::strand>( | ||
| 34 | - lib::ref(*io_service)); | ||
| 35 | + m_strand.reset(new lib::asio::io_service::strand(*io_service)); | ||
| 36 | } | ||
| 37 | |||
| 38 | lib::error_code ec = socket_con_type::init_asio(io_service, m_strand, | ||
| 39 | diff --git a/websocketpp/transport/asio/endpoint.hpp b/websocketpp/transport/asio/endpoint.hpp | ||
| 40 | index 4b719a9..94509ad 100644 | ||
| 41 | --- a/websocketpp/transport/asio/endpoint.hpp | ||
| 42 | +++ b/websocketpp/transport/asio/endpoint.hpp | ||
| 43 | @@ -687,9 +687,7 @@ public: | ||
| 44 | * @since 0.3.0 | ||
| 45 | */ | ||
| 46 | void start_perpetual() { | ||
| 47 | - m_work = lib::make_shared<lib::asio::io_service::work>( | ||
| 48 | - lib::ref(*m_io_service) | ||
| 49 | - ); | ||
| 50 | + m_work.reset(new lib::asio::io_service::work(*m_io_service)); | ||
| 51 | } | ||
| 52 | |||
| 53 | /// Clears the endpoint's perpetual flag, allowing it to exit when empty | ||
| 54 | @@ -853,8 +851,7 @@ protected: | ||
| 55 | |||
| 56 | // Create a resolver | ||
| 57 | if (!m_resolver) { | ||
| 58 | - m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>( | ||
| 59 | - lib::ref(*m_io_service)); | ||
| 60 | + m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service)); | ||
| 61 | } | ||
| 62 | |||
| 63 | tcon->set_uri(u); | ||
| 64 | -- | ||
| 65 | 2.23.0 | ||
| 66 | |||
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/4cab5e5c0c5f19fcee7d37b4a38b156d63a150d4.patch b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/4cab5e5c0c5f19fcee7d37b4a38b156d63a150d4.patch deleted file mode 100644 index 530c960ce5..0000000000 --- a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/4cab5e5c0c5f19fcee7d37b4a38b156d63a150d4.patch +++ /dev/null | |||
| @@ -1,155 +0,0 @@ | |||
| 1 | From 4cab5e5c0c5f19fcee7d37b4a38b156d63a150d4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Peter Thorson <git@zaphoyd.com> | ||
| 3 | Date: Sun, 11 Jun 2017 16:13:25 -0500 | ||
| 4 | Subject: [PATCH] minor adjustments to recent extension negotiation related | ||
| 5 | fixes, refactor a bit more extension negotiation code to be simpler | ||
| 6 | |||
| 7 | --- | ||
| 8 | websocketpp/impl/connection_impl.hpp | 6 +-- | ||
| 9 | websocketpp/processors/hybi13.hpp | 92 ++++++++++++++++++------------------ | ||
| 10 | 2 files changed, 49 insertions(+), 49 deletions(-) | ||
| 11 | |||
| 12 | Index: websocketpp-0.7.0/websocketpp/impl/connection_impl.hpp | ||
| 13 | =================================================================== | ||
| 14 | --- websocketpp-0.7.0.orig/websocketpp/impl/connection_impl.hpp | ||
| 15 | +++ websocketpp-0.7.0/websocketpp/impl/connection_impl.hpp | ||
| 16 | @@ -1222,17 +1222,17 @@ | ||
| 17 | std::pair<lib::error_code,std::string> neg_results; | ||
| 18 | neg_results = m_processor->negotiate_extensions(m_request); | ||
| 19 | |||
| 20 | - if (neg_results.first == error::make_error_code(error::extension_parse_error)) { | ||
| 21 | + if (neg_results.first == processor::error::make_error_code(processor::error::extension_parse_error)) { | ||
| 22 | // There was a fatal error in extension parsing that should result in | ||
| 23 | // a failed connection attempt. | ||
| 24 | - m_alog.write(log::alevel::info, "Bad request: " + neg_results.first.message()); | ||
| 25 | + m_elog.write(log::elevel::info, "Bad request: " + neg_results.first.message()); | ||
| 26 | m_response.set_status(http::status_code::bad_request); | ||
| 27 | return neg_results.first; | ||
| 28 | } else if (neg_results.first) { | ||
| 29 | // There was a fatal error in extension processing that is probably our | ||
| 30 | // fault. Consider extension negotiation to have failed and continue as | ||
| 31 | // if extensions were not supported | ||
| 32 | - m_alog.write(log::alevel::info, | ||
| 33 | + m_elog.write(log::elevel::info, | ||
| 34 | "Extension negotiation failed: " + neg_results.first.message()); | ||
| 35 | } else { | ||
| 36 | // extension negotiation succeeded, set response header accordingly | ||
| 37 | Index: websocketpp-0.7.0/websocketpp/processors/hybi13.hpp | ||
| 38 | =================================================================== | ||
| 39 | --- websocketpp-0.7.0.orig/websocketpp/processors/hybi13.hpp | ||
| 40 | +++ websocketpp-0.7.0/websocketpp/processors/hybi13.hpp | ||
| 41 | @@ -97,11 +97,6 @@ | ||
| 42 | /** | ||
| 43 | * This exists mostly because the code for requests and responses is | ||
| 44 | * identical and I can't have virtual template methods. | ||
| 45 | - * | ||
| 46 | - * NOTE: this method makes assumptions that the permessage-deflate | ||
| 47 | - * extension is the only one supported. If additional extensions are | ||
| 48 | - * ever supported it should be reviewed carefully. Most cases where | ||
| 49 | - * that assumption is made are explicitly noted. | ||
| 50 | */ | ||
| 51 | template <typename header_type> | ||
| 52 | err_str_pair negotiate_extensions_helper(header_type const & header) { | ||
| 53 | @@ -130,55 +125,60 @@ | ||
| 54 | |||
| 55 | http::parameter_list::const_iterator it; | ||
| 56 | |||
| 57 | + // look through the list of extension requests to find the first | ||
| 58 | + // one that we can accept. | ||
| 59 | if (m_permessage_deflate.is_implemented()) { | ||
| 60 | err_str_pair neg_ret; | ||
| 61 | for (it = p.begin(); it != p.end(); ++it) { | ||
| 62 | - // look through each extension, if the key is permessage-deflate | ||
| 63 | - if (it->first == "permessage-deflate") { | ||
| 64 | - // if we have already successfully negotiated this extension | ||
| 65 | - // then skip any other requests to negotiate the same one | ||
| 66 | - // with different parameters | ||
| 67 | - if (m_permessage_deflate.is_enabled()) { | ||
| 68 | - continue; | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - | ||
| 72 | - neg_ret = m_permessage_deflate.negotiate(it->second); | ||
| 73 | - | ||
| 74 | - if (neg_ret.first) { | ||
| 75 | - // Figure out if this is an error that should halt all | ||
| 76 | - // extension negotiations or simply cause negotiation of | ||
| 77 | - // this specific extension to fail. | ||
| 78 | - //std::cout << "permessage-compress negotiation failed: " | ||
| 79 | - // << neg_ret.first.message() << std::endl; | ||
| 80 | - } else { | ||
| 81 | - // Note: this list will need commas if WebSocket++ ever | ||
| 82 | - // supports more than one extension | ||
| 83 | - | ||
| 84 | - // Actually try to initialize the extension before we | ||
| 85 | - // deem negotiation complete | ||
| 86 | - ret.first = m_permessage_deflate.init(base::m_server); | ||
| 87 | - if (!ret.first) { | ||
| 88 | - | ||
| 89 | - // TODO: support multiple extensions. | ||
| 90 | - // right now, because there is only one extension | ||
| 91 | - // supported, it failing to negotiate means we are | ||
| 92 | - // done with all negotiating. In the future if more | ||
| 93 | - // extensions are supported a better solution will | ||
| 94 | - // be needed here. | ||
| 95 | - break; | ||
| 96 | - } else { | ||
| 97 | - ret.second += neg_ret.second; | ||
| 98 | - | ||
| 99 | - // continue looking for more extensions | ||
| 100 | - continue; | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - } | ||
| 104 | + // not a permessage-deflate extension request, ignore | ||
| 105 | + if (it->first != "permessage-deflate") { | ||
| 106 | + continue; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + // if we have already successfully negotiated this extension | ||
| 110 | + // then skip any other requests to negotiate the same one | ||
| 111 | + // with different parameters | ||
| 112 | + if (m_permessage_deflate.is_enabled()) { | ||
| 113 | + continue; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + // attempt to negotiate this offer | ||
| 117 | + neg_ret = m_permessage_deflate.negotiate(it->second); | ||
| 118 | + | ||
| 119 | + if (neg_ret.first) { | ||
| 120 | + // negotiation offer failed. Do nothing. We will continue | ||
| 121 | + // searching for a permessage-deflate config that succeeds | ||
| 122 | + continue; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + // Negotiation tentatively succeeded | ||
| 126 | + | ||
| 127 | + // Actually try to initialize the extension before we | ||
| 128 | + // deem negotiation complete | ||
| 129 | + lib::error_code ec = m_permessage_deflate.init(base::m_server); | ||
| 130 | + | ||
| 131 | + if (ec) { | ||
| 132 | + // Negotiation succeeded but initialization failed this is | ||
| 133 | + // an error that should stop negotiation of permessage | ||
| 134 | + // deflate. Return the reason for the init failure | ||
| 135 | + | ||
| 136 | + ret.first = ec; | ||
| 137 | + break; | ||
| 138 | + } else { | ||
| 139 | + // Successfully initialized, push the negotiated response into | ||
| 140 | + // the reply and stop looking for additional permessage-deflate | ||
| 141 | + // extensions | ||
| 142 | + ret.second += neg_ret.second; | ||
| 143 | + break; | ||
| 144 | } | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 148 | + // support for future extensions would go here. Should check the value of | ||
| 149 | + // ret.first before continuing. Might need to consider whether failure of | ||
| 150 | + // negotiation of an earlier extension should stop negotiation of subsequent | ||
| 151 | + // ones | ||
| 152 | + | ||
| 153 | return ret; | ||
| 154 | } | ||
| 155 | |||
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/9ddb300d874a30db35e3ad58f188944bef0bf31b.patch b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/9ddb300d874a30db35e3ad58f188944bef0bf31b.patch deleted file mode 100644 index 94bfeb2fd4..0000000000 --- a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/9ddb300d874a30db35e3ad58f188944bef0bf31b.patch +++ /dev/null | |||
| @@ -1,600 +0,0 @@ | |||
| 1 | ## Description: add some description | ||
| 2 | ## Origin/Author: add some origin or author | ||
| 3 | ## Bug: bug URL | ||
| 4 | From 9ddb300d874a30db35e3ad58f188944bef0bf31b Mon Sep 17 00:00:00 2001 | ||
| 5 | From: Peter Thorson <git@zaphoyd.com> | ||
| 6 | Date: Sun, 11 Jun 2017 15:24:43 -0500 | ||
| 7 | Subject: [PATCH] Update permessage-deflate support to reflect that zlib | ||
| 8 | doesn't support a 256 bit window. Improve extension negotiation error | ||
| 9 | checking and documentation. fixes #596 fixes #653 | ||
| 10 | |||
| 11 | --- | ||
| 12 | changelog.md | 8 ++ | ||
| 13 | test/extension/permessage_deflate.cpp | 153 +++++++++++++++++---- | ||
| 14 | .../extensions/permessage_deflate/enabled.hpp | 94 ++++++++++--- | ||
| 15 | websocketpp/impl/connection_impl.hpp | 10 +- | ||
| 16 | websocketpp/processors/hybi13.hpp | 28 +++- | ||
| 17 | 5 files changed, 247 insertions(+), 46 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/changelog.md b/changelog.md | ||
| 20 | index bba753cb..de98edd2 100644 | ||
| 21 | #--- a/changelog.md | ||
| 22 | #+++ b/changelog.md | ||
| 23 | #@@ -17,6 +17,14 @@ HEAD | ||
| 24 | # - Compatibility: Update `telemetry_client` to use a slightly more cross platform | ||
| 25 | # method of sleeping. Should work on windows now. Thank you Meir Yanovich for | ||
| 26 | # reporting. | ||
| 27 | #+- Compatibility: Updated permessage-deflate support to reflect that the zlib | ||
| 28 | #+ library does not actually support a sliding window size of 256 bits. | ||
| 29 | #+ WebSocket++ will no longer negotiate 256 bit deflate windows. If the user | ||
| 30 | #+ of the library tries to request a 256 bit window a 512 bit window will be | ||
| 31 | #+ specified instead (This was the previous behavior). #596 #653 Thank you | ||
| 32 | #+ Vinnie Falco and Gianfranco Costamagna for reporting. | ||
| 33 | #+- Compatibility: Better error handling and logging in cases where extension | ||
| 34 | #+ requests parse correctly but negotiation fails. | ||
| 35 | # - Bug: Store loggers in shared pointers to avoid crashes related to connections | ||
| 36 | # trying to write logs entries after their respective endpoint has been | ||
| 37 | # deallocated. Thank you Thalhammer for reporting and Jupp Müller for the | ||
| 38 | diff --git a/test/extension/permessage_deflate.cpp b/test/extension/permessage_deflate.cpp | ||
| 39 | index 4cd3e7b6..805afcc3 100644 | ||
| 40 | --- a/test/extension/permessage_deflate.cpp | ||
| 41 | +++ b/test/extension/permessage_deflate.cpp | ||
| 42 | @@ -186,15 +186,22 @@ BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_invalid ) { | ||
| 43 | |||
| 44 | BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_valid ) { | ||
| 45 | ext_vars v; | ||
| 46 | + | ||
| 47 | + // confirm that a request for a value of 8 is interpreted as 9 | ||
| 48 | v.attr["server_max_window_bits"] = "8"; | ||
| 49 | + v.esp = v.exts.negotiate(v.attr); | ||
| 50 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 51 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 52 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 53 | |||
| 54 | + v.attr["server_max_window_bits"] = "9"; | ||
| 55 | v.esp = v.exts.negotiate(v.attr); | ||
| 56 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 57 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 58 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=8"); | ||
| 59 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 60 | |||
| 61 | - v.attr["server_max_window_bits"] = "15"; | ||
| 62 | |||
| 63 | + v.attr["server_max_window_bits"] = "15"; | ||
| 64 | v.esp = v.exts.negotiate(v.attr); | ||
| 65 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 66 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 67 | @@ -213,7 +220,7 @@ BOOST_AUTO_TEST_CASE( invalid_set_server_max_window_bits ) { | ||
| 68 | |||
| 69 | BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_decline ) { | ||
| 70 | ext_vars v; | ||
| 71 | - v.attr["server_max_window_bits"] = "8"; | ||
| 72 | + v.attr["server_max_window_bits"] = "9"; | ||
| 73 | |||
| 74 | v.ec = v.exts.set_server_max_window_bits(15,pmd_mode::decline); | ||
| 75 | v.esp = v.exts.negotiate(v.attr); | ||
| 76 | @@ -223,7 +230,7 @@ BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_decline ) { | ||
| 77 | BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate"); | ||
| 78 | } | ||
| 79 | |||
| 80 | -BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_accept ) { | ||
| 81 | +BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_accept_8 ) { | ||
| 82 | ext_vars v; | ||
| 83 | v.attr["server_max_window_bits"] = "8"; | ||
| 84 | |||
| 85 | @@ -232,10 +239,22 @@ BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_accept ) { | ||
| 86 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 87 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 88 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 89 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=8"); | ||
| 90 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 91 | } | ||
| 92 | |||
| 93 | -BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_largest ) { | ||
| 94 | +BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_accept ) { | ||
| 95 | + ext_vars v; | ||
| 96 | + v.attr["server_max_window_bits"] = "9"; | ||
| 97 | + | ||
| 98 | + v.ec = v.exts.set_server_max_window_bits(15,pmd_mode::accept); | ||
| 99 | + v.esp = v.exts.negotiate(v.attr); | ||
| 100 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 101 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 102 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 103 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_largest_8 ) { | ||
| 107 | ext_vars v; | ||
| 108 | v.attr["server_max_window_bits"] = "8"; | ||
| 109 | |||
| 110 | @@ -244,10 +263,22 @@ BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_largest ) { | ||
| 111 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 112 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 113 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 114 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=8"); | ||
| 115 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 116 | } | ||
| 117 | |||
| 118 | -BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_smallest ) { | ||
| 119 | +BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_largest ) { | ||
| 120 | + ext_vars v; | ||
| 121 | + v.attr["server_max_window_bits"] = "9"; | ||
| 122 | + | ||
| 123 | + v.ec = v.exts.set_server_max_window_bits(15,pmd_mode::largest); | ||
| 124 | + v.esp = v.exts.negotiate(v.attr); | ||
| 125 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 126 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 127 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 128 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_smallest_8 ) { | ||
| 132 | ext_vars v; | ||
| 133 | v.attr["server_max_window_bits"] = "8"; | ||
| 134 | |||
| 135 | @@ -256,7 +287,19 @@ BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_smallest ) { | ||
| 136 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 137 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 138 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 139 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=8"); | ||
| 140 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +BOOST_AUTO_TEST_CASE( negotiate_server_max_window_bits_smallest ) { | ||
| 144 | + ext_vars v; | ||
| 145 | + v.attr["server_max_window_bits"] = "9"; | ||
| 146 | + | ||
| 147 | + v.ec = v.exts.set_server_max_window_bits(15,pmd_mode::smallest); | ||
| 148 | + v.esp = v.exts.negotiate(v.attr); | ||
| 149 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 150 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 151 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 152 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; server_max_window_bits=9"); | ||
| 153 | } | ||
| 154 | |||
| 155 | // Negotiate server_max_window_bits | ||
| 156 | @@ -292,7 +335,13 @@ BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_valid ) { | ||
| 157 | v.esp = v.exts.negotiate(v.attr); | ||
| 158 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 159 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 160 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=8"); | ||
| 161 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 162 | + | ||
| 163 | + v.attr["client_max_window_bits"] = "9"; | ||
| 164 | + v.esp = v.exts.negotiate(v.attr); | ||
| 165 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 166 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 167 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 168 | |||
| 169 | v.attr["client_max_window_bits"] = "15"; | ||
| 170 | v.esp = v.exts.negotiate(v.attr); | ||
| 171 | @@ -311,7 +360,7 @@ BOOST_AUTO_TEST_CASE( invalid_set_client_max_window_bits ) { | ||
| 172 | BOOST_CHECK_EQUAL(v.ec,pmde::make_error_code(pmde::invalid_max_window_bits)); | ||
| 173 | } | ||
| 174 | |||
| 175 | -BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_decline ) { | ||
| 176 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_decline_8 ) { | ||
| 177 | ext_vars v; | ||
| 178 | v.attr["client_max_window_bits"] = "8"; | ||
| 179 | |||
| 180 | @@ -323,7 +372,19 @@ BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_decline ) { | ||
| 181 | BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate"); | ||
| 182 | } | ||
| 183 | |||
| 184 | -BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_accept ) { | ||
| 185 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_decline ) { | ||
| 186 | + ext_vars v; | ||
| 187 | + v.attr["client_max_window_bits"] = "9"; | ||
| 188 | + | ||
| 189 | + v.ec = v.exts.set_client_max_window_bits(9,pmd_mode::decline); | ||
| 190 | + v.esp = v.exts.negotiate(v.attr); | ||
| 191 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 192 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 193 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 194 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate"); | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_accept_8 ) { | ||
| 198 | ext_vars v; | ||
| 199 | v.attr["client_max_window_bits"] = "8"; | ||
| 200 | |||
| 201 | @@ -332,10 +393,22 @@ BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_accept ) { | ||
| 202 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 203 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 204 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 205 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=8"); | ||
| 206 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 207 | } | ||
| 208 | |||
| 209 | -BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_largest ) { | ||
| 210 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_accept ) { | ||
| 211 | + ext_vars v; | ||
| 212 | + v.attr["client_max_window_bits"] = "9"; | ||
| 213 | + | ||
| 214 | + v.ec = v.exts.set_client_max_window_bits(15,pmd_mode::accept); | ||
| 215 | + v.esp = v.exts.negotiate(v.attr); | ||
| 216 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 217 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 218 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 219 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 220 | +} | ||
| 221 | + | ||
| 222 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_largest_8 ) { | ||
| 223 | ext_vars v; | ||
| 224 | v.attr["client_max_window_bits"] = "8"; | ||
| 225 | |||
| 226 | @@ -344,10 +417,22 @@ BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_largest ) { | ||
| 227 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 228 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 229 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 230 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=8"); | ||
| 231 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 232 | } | ||
| 233 | |||
| 234 | -BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_smallest ) { | ||
| 235 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_largest ) { | ||
| 236 | + ext_vars v; | ||
| 237 | + v.attr["client_max_window_bits"] = "9"; | ||
| 238 | + | ||
| 239 | + v.ec = v.exts.set_client_max_window_bits(15,pmd_mode::largest); | ||
| 240 | + v.esp = v.exts.negotiate(v.attr); | ||
| 241 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 242 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 243 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 244 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_smallest_8 ) { | ||
| 248 | ext_vars v; | ||
| 249 | v.attr["client_max_window_bits"] = "8"; | ||
| 250 | |||
| 251 | @@ -356,7 +441,19 @@ BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_smallest ) { | ||
| 252 | BOOST_CHECK( v.exts.is_enabled() ); | ||
| 253 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 254 | BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 255 | - BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=8"); | ||
| 256 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 257 | +} | ||
| 258 | + | ||
| 259 | +BOOST_AUTO_TEST_CASE( negotiate_client_max_window_bits_smallest ) { | ||
| 260 | + ext_vars v; | ||
| 261 | + v.attr["client_max_window_bits"] = "9"; | ||
| 262 | + | ||
| 263 | + v.ec = v.exts.set_client_max_window_bits(15,pmd_mode::smallest); | ||
| 264 | + v.esp = v.exts.negotiate(v.attr); | ||
| 265 | + BOOST_CHECK( v.exts.is_enabled() ); | ||
| 266 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 267 | + BOOST_CHECK_EQUAL( v.esp.first, websocketpp::lib::error_code() ); | ||
| 268 | + BOOST_CHECK_EQUAL( v.esp.second, "permessage-deflate; client_max_window_bits=9"); | ||
| 269 | } | ||
| 270 | |||
| 271 | |||
| 272 | @@ -507,7 +604,8 @@ BOOST_AUTO_TEST_CASE( compress_data ) { | ||
| 273 | std::string compress_out; | ||
| 274 | std::string decompress_out; | ||
| 275 | |||
| 276 | - v.exts.init(true); | ||
| 277 | + v.ec = v.exts.init(true); | ||
| 278 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 279 | |||
| 280 | v.ec = v.exts.compress(compress_in,compress_out); | ||
| 281 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 282 | @@ -520,7 +618,8 @@ BOOST_AUTO_TEST_CASE( compress_data ) { | ||
| 283 | BOOST_AUTO_TEST_CASE( compress_data_multiple ) { | ||
| 284 | ext_vars v; | ||
| 285 | |||
| 286 | - v.exts.init(true); | ||
| 287 | + v.ec = v.exts.init(true); | ||
| 288 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 289 | |||
| 290 | for (int i = 0; i < 2; i++) { | ||
| 291 | std::string compress_in = "Hello"; | ||
| 292 | @@ -545,11 +644,12 @@ BOOST_AUTO_TEST_CASE( compress_data_large ) { | ||
| 293 | |||
| 294 | websocketpp::http::attribute_list alist; | ||
| 295 | |||
| 296 | - alist["server_max_window_bits"] = "8"; | ||
| 297 | - v.exts.set_server_max_window_bits(8,websocketpp::extensions::permessage_deflate::mode::smallest); | ||
| 298 | + alist["server_max_window_bits"] = "9"; | ||
| 299 | + v.exts.set_server_max_window_bits(9,websocketpp::extensions::permessage_deflate::mode::smallest); | ||
| 300 | |||
| 301 | v.exts.negotiate(alist); | ||
| 302 | - v.exts.init(true); | ||
| 303 | + v.ec = v.exts.init(true); | ||
| 304 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 305 | |||
| 306 | v.ec = v.exts.compress(compress_in,compress_out); | ||
| 307 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 308 | @@ -573,7 +673,8 @@ BOOST_AUTO_TEST_CASE( compress_data_no_context_takeover ) { | ||
| 309 | v.exts.enable_server_no_context_takeover(); | ||
| 310 | |||
| 311 | v.exts.negotiate(alist); | ||
| 312 | - v.exts.init(true); | ||
| 313 | + v.ec = v.exts.init(true); | ||
| 314 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 315 | |||
| 316 | v.ec = v.exts.compress(compress_in,compress_out1); | ||
| 317 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 318 | @@ -609,7 +710,8 @@ BOOST_AUTO_TEST_CASE( compress_empty ) { | ||
| 319 | std::string compress_out; | ||
| 320 | std::string decompress_out; | ||
| 321 | |||
| 322 | - v.exts.init(true); | ||
| 323 | + v.ec = v.exts.init(true); | ||
| 324 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 325 | |||
| 326 | v.ec = v.exts.compress(compress_in,compress_out); | ||
| 327 | BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 328 | @@ -640,7 +742,8 @@ BOOST_AUTO_TEST_CASE( decompress_data ) { | ||
| 329 | std::string out; | ||
| 330 | std::string reference = "Hello"; | ||
| 331 | |||
| 332 | - v.exts.init(true); | ||
| 333 | + v.ec = v.exts.init(true); | ||
| 334 | + BOOST_CHECK_EQUAL( v.ec, websocketpp::lib::error_code() ); | ||
| 335 | |||
| 336 | v.ec = v.exts.decompress(in,11,out); | ||
| 337 | |||
| 338 | diff --git a/websocketpp/extensions/permessage_deflate/enabled.hpp b/websocketpp/extensions/permessage_deflate/enabled.hpp | ||
| 339 | index 1581f14c..f20a1b1d 100644 | ||
| 340 | --- a/websocketpp/extensions/permessage_deflate/enabled.hpp | ||
| 341 | +++ b/websocketpp/extensions/permessage_deflate/enabled.hpp | ||
| 342 | @@ -46,7 +46,7 @@ | ||
| 343 | namespace websocketpp { | ||
| 344 | namespace extensions { | ||
| 345 | |||
| 346 | -/// Implementation of the draft permessage-deflate WebSocket extension | ||
| 347 | +/// Implementation of RFC 7692, the permessage-deflate WebSocket extension | ||
| 348 | /** | ||
| 349 | * ### permessage-deflate interface | ||
| 350 | * | ||
| 351 | @@ -174,18 +174,30 @@ namespace websocketpp { | ||
| 352 | namespace extensions { | ||
| 353 | namespace permessage_deflate { | ||
| 354 | |||
| 355 | -/// Default value for server_max_window_bits as defined by draft 17 | ||
| 356 | +/// Default value for server_max_window_bits as defined by RFC 7692 | ||
| 357 | static uint8_t const default_server_max_window_bits = 15; | ||
| 358 | -/// Minimum value for server_max_window_bits as defined by draft 17 | ||
| 359 | +/// Minimum value for server_max_window_bits as defined by RFC 7692 | ||
| 360 | +/** | ||
| 361 | + * NOTE: A value of 8 is not actually supported by zlib, the deflate | ||
| 362 | + * library that WebSocket++ uses. To preserve backwards compatibility | ||
| 363 | + * with RFC 7692 and previous versions of the library a value of 8 | ||
| 364 | + * is accepted by the library but will always be negotiated as 9. | ||
| 365 | + */ | ||
| 366 | static uint8_t const min_server_max_window_bits = 8; | ||
| 367 | -/// Maximum value for server_max_window_bits as defined by draft 17 | ||
| 368 | +/// Maximum value for server_max_window_bits as defined by RFC 7692 | ||
| 369 | static uint8_t const max_server_max_window_bits = 15; | ||
| 370 | |||
| 371 | -/// Default value for client_max_window_bits as defined by draft 17 | ||
| 372 | +/// Default value for client_max_window_bits as defined by RFC 7692 | ||
| 373 | static uint8_t const default_client_max_window_bits = 15; | ||
| 374 | -/// Minimum value for client_max_window_bits as defined by draft 17 | ||
| 375 | +/// Minimum value for client_max_window_bits as defined by RFC 7692 | ||
| 376 | +/** | ||
| 377 | + * NOTE: A value of 8 is not actually supported by zlib, the deflate | ||
| 378 | + * library that WebSocket++ uses. To preserve backwards compatibility | ||
| 379 | + * with RFC 7692 and previous versions of the library a value of 8 | ||
| 380 | + * is accepted by the library but will always be negotiated as 9. | ||
| 381 | + */ | ||
| 382 | static uint8_t const min_client_max_window_bits = 8; | ||
| 383 | -/// Maximum value for client_max_window_bits as defined by draft 17 | ||
| 384 | +/// Maximum value for client_max_window_bits as defined by RFC 7692 | ||
| 385 | static uint8_t const max_client_max_window_bits = 15; | ||
| 386 | |||
| 387 | namespace mode { | ||
| 388 | @@ -372,7 +384,7 @@ class enabled { | ||
| 389 | /** | ||
| 390 | * The bits setting is the base 2 logarithm of the maximum window size that | ||
| 391 | * the server must use to compress outgoing messages. The permitted range | ||
| 392 | - * is 8 to 15 inclusive. 8 represents a 256 byte window and 15 a 32KiB | ||
| 393 | + * is 9 to 15 inclusive. 9 represents a 512 byte window and 15 a 32KiB | ||
| 394 | * window. The default setting is 15. | ||
| 395 | * | ||
| 396 | * Mode Options: | ||
| 397 | @@ -386,6 +398,14 @@ class enabled { | ||
| 398 | * adjusted by the server. A server may unilaterally set this value without | ||
| 399 | * client support. | ||
| 400 | * | ||
| 401 | + * NOTE: The permessage-deflate spec specifies that a value of 8 is allowed. | ||
| 402 | + * Prior to version 0.8.0 a value of 8 was also allowed by this library. | ||
| 403 | + * zlib, the deflate compression library that WebSocket++ uses has always | ||
| 404 | + * silently adjusted a value of 8 to 9. In recent versions of zlib (1.2.9 | ||
| 405 | + * and greater) a value of 8 is now explicitly rejected. WebSocket++ 0.8.0 | ||
| 406 | + * continues to perform the 8->9 conversion for backwards compatibility | ||
| 407 | + * purposes but this should be considered deprecated functionality. | ||
| 408 | + * | ||
| 409 | * @param bits The size to request for the outgoing window size | ||
| 410 | * @param mode The mode to use for negotiating this parameter | ||
| 411 | * @return A status code | ||
| 412 | @@ -394,6 +414,12 @@ class enabled { | ||
| 413 | if (bits < min_server_max_window_bits || bits > max_server_max_window_bits) { | ||
| 414 | return error::make_error_code(error::invalid_max_window_bits); | ||
| 415 | } | ||
| 416 | + | ||
| 417 | + // See note in doc comment above about what is happening here | ||
| 418 | + if (bits == 8) { | ||
| 419 | + bits = 9; | ||
| 420 | + } | ||
| 421 | + | ||
| 422 | m_server_max_window_bits = bits; | ||
| 423 | m_server_max_window_bits_mode = mode; | ||
| 424 | |||
| 425 | @@ -403,8 +429,8 @@ class enabled { | ||
| 426 | /// Limit client LZ77 sliding window size | ||
| 427 | /** | ||
| 428 | * The bits setting is the base 2 logarithm of the window size that the | ||
| 429 | - * client must use to compress outgoing messages. The permitted range is 8 | ||
| 430 | - * to 15 inclusive. 8 represents a 256 byte window and 15 a 32KiB window. | ||
| 431 | + * client must use to compress outgoing messages. The permitted range is 9 | ||
| 432 | + * to 15 inclusive. 9 represents a 512 byte window and 15 a 32KiB window. | ||
| 433 | * The default setting is 15. | ||
| 434 | * | ||
| 435 | * Mode Options: | ||
| 436 | @@ -417,6 +443,14 @@ class enabled { | ||
| 437 | * outgoing window size unilaterally. A server may only limit the client's | ||
| 438 | * window size if the remote client supports that feature. | ||
| 439 | * | ||
| 440 | + * NOTE: The permessage-deflate spec specifies that a value of 8 is allowed. | ||
| 441 | + * Prior to version 0.8.0 a value of 8 was also allowed by this library. | ||
| 442 | + * zlib, the deflate compression library that WebSocket++ uses has always | ||
| 443 | + * silently adjusted a value of 8 to 9. In recent versions of zlib (1.2.9 | ||
| 444 | + * and greater) a value of 8 is now explicitly rejected. WebSocket++ 0.8.0 | ||
| 445 | + * continues to perform the 8->9 conversion for backwards compatibility | ||
| 446 | + * purposes but this should be considered deprecated functionality. | ||
| 447 | + * | ||
| 448 | * @param bits The size to request for the outgoing window size | ||
| 449 | * @param mode The mode to use for negotiating this parameter | ||
| 450 | * @return A status code | ||
| 451 | @@ -425,6 +459,12 @@ class enabled { | ||
| 452 | if (bits < min_client_max_window_bits || bits > max_client_max_window_bits) { | ||
| 453 | return error::make_error_code(error::invalid_max_window_bits); | ||
| 454 | } | ||
| 455 | + | ||
| 456 | + // See note in doc comment above about what is happening here | ||
| 457 | + if (bits == 8) { | ||
| 458 | + bits = 9; | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | m_client_max_window_bits = bits; | ||
| 462 | m_client_max_window_bits_mode = mode; | ||
| 463 | |||
| 464 | @@ -642,11 +682,17 @@ class enabled { | ||
| 465 | * client requested that we use. | ||
| 466 | * | ||
| 467 | * options: | ||
| 468 | - * - decline (refuse to use the attribute) | ||
| 469 | - * - accept (use whatever the client says) | ||
| 470 | - * - largest (use largest possible value) | ||
| 471 | + * - decline (ignore value, offer our default instead) | ||
| 472 | + * - accept (use the value requested by the client) | ||
| 473 | + * - largest (use largest value acceptable to both) | ||
| 474 | * - smallest (use smallest possible value) | ||
| 475 | * | ||
| 476 | + * NOTE: As a value of 8 is no longer explicitly supported by zlib but might | ||
| 477 | + * be requested for negotiation by an older client/server, if the result of | ||
| 478 | + * the negotiation would be to send a value of 8, a value of 9 is offered | ||
| 479 | + * instead. This ensures that WebSocket++ will only ever negotiate connections | ||
| 480 | + * with compression settings explicitly supported by zlib. | ||
| 481 | + * | ||
| 482 | * @param [in] value The value of the attribute from the offer | ||
| 483 | * @param [out] ec A reference to the error code to return errors via | ||
| 484 | */ | ||
| 485 | @@ -678,6 +724,11 @@ class enabled { | ||
| 486 | ec = make_error_code(error::invalid_mode); | ||
| 487 | m_server_max_window_bits = default_server_max_window_bits; | ||
| 488 | } | ||
| 489 | + | ||
| 490 | + // See note in doc comment | ||
| 491 | + if (m_server_max_window_bits == 8) { | ||
| 492 | + m_server_max_window_bits = 9; | ||
| 493 | + } | ||
| 494 | } | ||
| 495 | |||
| 496 | /// Negotiate client_max_window_bits attribute | ||
| 497 | @@ -687,11 +738,17 @@ class enabled { | ||
| 498 | * negotiation mode. | ||
| 499 | * | ||
| 500 | * options: | ||
| 501 | - * - decline (refuse to use the attribute) | ||
| 502 | - * - accept (use whatever the client says) | ||
| 503 | - * - largest (use largest possible value) | ||
| 504 | + * - decline (ignore value, offer our default instead) | ||
| 505 | + * - accept (use the value requested by the client) | ||
| 506 | + * - largest (use largest value acceptable to both) | ||
| 507 | * - smallest (use smallest possible value) | ||
| 508 | * | ||
| 509 | + * NOTE: As a value of 8 is no longer explicitly supported by zlib but might | ||
| 510 | + * be requested for negotiation by an older client/server, if the result of | ||
| 511 | + * the negotiation would be to send a value of 8, a value of 9 is offered | ||
| 512 | + * instead. This ensures that WebSocket++ will only ever negotiate connections | ||
| 513 | + * with compression settings explicitly supported by zlib. | ||
| 514 | + * | ||
| 515 | * @param [in] value The value of the attribute from the offer | ||
| 516 | * @param [out] ec A reference to the error code to return errors via | ||
| 517 | */ | ||
| 518 | @@ -727,6 +784,11 @@ class enabled { | ||
| 519 | ec = make_error_code(error::invalid_mode); | ||
| 520 | m_client_max_window_bits = default_client_max_window_bits; | ||
| 521 | } | ||
| 522 | + | ||
| 523 | + // See note in doc comment | ||
| 524 | + if (m_client_max_window_bits == 8) { | ||
| 525 | + m_client_max_window_bits = 9; | ||
| 526 | + } | ||
| 527 | } | ||
| 528 | |||
| 529 | bool m_enabled; | ||
| 530 | diff --git a/websocketpp/impl/connection_impl.hpp b/websocketpp/impl/connection_impl.hpp | ||
| 531 | index 105911db..ae55c338 100644 | ||
| 532 | --- a/websocketpp/impl/connection_impl.hpp | ||
| 533 | +++ b/websocketpp/impl/connection_impl.hpp | ||
| 534 | @@ -1222,12 +1222,18 @@ lib::error_code connection<config>::process_handshake_request() { | ||
| 535 | std::pair<lib::error_code,std::string> neg_results; | ||
| 536 | neg_results = m_processor->negotiate_extensions(m_request); | ||
| 537 | |||
| 538 | - if (neg_results.first) { | ||
| 539 | + if (neg_results.first == error::make_error_code(error::extension_parse_error)) { | ||
| 540 | // There was a fatal error in extension parsing that should result in | ||
| 541 | // a failed connection attempt. | ||
| 542 | - m_alog.write(log::alevel::devel, "Bad request: " + neg_results.first.message()); | ||
| 543 | + m_alog.write(log::alevel::info, "Bad request: " + neg_results.first.message()); | ||
| 544 | m_response.set_status(http::status_code::bad_request); | ||
| 545 | return neg_results.first; | ||
| 546 | + } else if (neg_results.first) { | ||
| 547 | + // There was a fatal error in extension processing that is probably our | ||
| 548 | + // fault. Consider extension negotiation to have failed and continue as | ||
| 549 | + // if extensions were not supported | ||
| 550 | + m_alog.write(log::alevel::info, | ||
| 551 | + "Extension negotiation failed: " + neg_results.first.message()); | ||
| 552 | } else { | ||
| 553 | // extension negotiation succeeded, set response header accordingly | ||
| 554 | // we don't send an empty extensions header because it breaks many | ||
| 555 | diff --git a/websocketpp/processors/hybi13.hpp b/websocketpp/processors/hybi13.hpp | ||
| 556 | index 79486654..a95bc649 100644 | ||
| 557 | --- a/websocketpp/processors/hybi13.hpp | ||
| 558 | +++ b/websocketpp/processors/hybi13.hpp | ||
| 559 | @@ -97,6 +97,11 @@ class hybi13 : public processor<config> { | ||
| 560 | /** | ||
| 561 | * This exists mostly because the code for requests and responses is | ||
| 562 | * identical and I can't have virtual template methods. | ||
| 563 | + * | ||
| 564 | + * NOTE: this method makes assumptions that the permessage-deflate | ||
| 565 | + * extension is the only one supported. If additional extensions are | ||
| 566 | + * ever supported it should be reviewed carefully. Most cases where | ||
| 567 | + * that assumption is made are explicitly noted. | ||
| 568 | */ | ||
| 569 | template <typename header_type> | ||
| 570 | err_str_pair negotiate_extensions_helper(header_type const & header) { | ||
| 571 | @@ -149,9 +154,26 @@ class hybi13 : public processor<config> { | ||
| 572 | } else { | ||
| 573 | // Note: this list will need commas if WebSocket++ ever | ||
| 574 | // supports more than one extension | ||
| 575 | - ret.second += neg_ret.second; | ||
| 576 | - m_permessage_deflate.init(base::m_server); | ||
| 577 | - continue; | ||
| 578 | + | ||
| 579 | + // Actually try to initialize the extension before we | ||
| 580 | + // deem negotiation complete | ||
| 581 | + ret.first = m_permessage_deflate.init(base::m_server); | ||
| 582 | + if (!ret.first) { | ||
| 583 | + | ||
| 584 | + // TODO: support multiple extensions. | ||
| 585 | + // right now, because there is only one extension | ||
| 586 | + // supported, it failing to negotiate means we are | ||
| 587 | + // done with all negotiating. In the future if more | ||
| 588 | + // extensions are supported a better solution will | ||
| 589 | + // be needed here. | ||
| 590 | + break; | ||
| 591 | + } else { | ||
| 592 | + ret.second += neg_ret.second; | ||
| 593 | + | ||
| 594 | + // continue looking for more extensions | ||
| 595 | + continue; | ||
| 596 | + } | ||
| 597 | + | ||
| 598 | } | ||
| 599 | } | ||
| 600 | } | ||
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/disable-tests.patch b/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/disable-tests.patch deleted file mode 100644 index 342981d4db..0000000000 --- a/meta-oe/recipes-support/websocketpp/websocketpp-0.8.1/disable-tests.patch +++ /dev/null | |||
| @@ -1,51 +0,0 @@ | |||
| 1 | Description: Disable failing test_transport_asio_timers. | ||
| 2 | Because of "address already in use" error | ||
| 3 | /«PKGBUILDDIR»/test/transport/asio/timers.cpp(129): error in "tls_handshake_timeout": check ec == make_error_code(tls_handshake_timeout) failed [websocketpp.transport.asio.socket:8 != websocketpp.transport.asio.socket:5] | ||
| 4 | Author: Gianfranco Costamagna <locutusofborg@debian.org> | ||
| 5 | |||
| 6 | --- websocketpp-0.7.0.orig/test/transport/CMakeLists.txt | ||
| 7 | +++ websocketpp-0.7.0/test/transport/CMakeLists.txt | ||
| 8 | @@ -1,24 +1,24 @@ | ||
| 9 | if (OPENSSL_FOUND) | ||
| 10 | |||
| 11 | -# Test transport integration | ||
| 12 | -file (GLOB SOURCE integration.cpp) | ||
| 13 | - | ||
| 14 | -init_target (test_transport) | ||
| 15 | -build_test (${TARGET_NAME} ${SOURCE}) | ||
| 16 | -link_boost () | ||
| 17 | -link_openssl() | ||
| 18 | -final_target () | ||
| 19 | -set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "test") | ||
| 20 | - | ||
| 21 | -# Test transport asio timers | ||
| 22 | -file (GLOB SOURCE asio/timers.cpp) | ||
| 23 | - | ||
| 24 | -init_target (test_transport_asio_timers) | ||
| 25 | -build_test (${TARGET_NAME} ${SOURCE}) | ||
| 26 | -link_boost () | ||
| 27 | -link_openssl() | ||
| 28 | -final_target () | ||
| 29 | -set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "test") | ||
| 30 | +## Test transport integration | ||
| 31 | +#file (GLOB SOURCE integration.cpp) | ||
| 32 | +# | ||
| 33 | +#init_target (test_transport) | ||
| 34 | +#build_test (${TARGET_NAME} ${SOURCE}) | ||
| 35 | +#link_boost () | ||
| 36 | +#link_openssl() | ||
| 37 | +#final_target () | ||
| 38 | +#set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "test") | ||
| 39 | +# | ||
| 40 | +## Test transport asio timers | ||
| 41 | +#file (GLOB SOURCE asio/timers.cpp) | ||
| 42 | +# | ||
| 43 | +#init_target (test_transport_asio_timers) | ||
| 44 | +#build_test (${TARGET_NAME} ${SOURCE}) | ||
| 45 | +#link_boost () | ||
| 46 | +#link_openssl() | ||
| 47 | +#final_target () | ||
| 48 | +#set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "test") | ||
| 49 | |||
| 50 | # Test transport asio security | ||
| 51 | file (GLOB SOURCE asio/security.cpp) | ||
diff --git a/meta-oe/recipes-support/websocketpp/websocketpp_0.8.1.bb b/meta-oe/recipes-support/websocketpp/websocketpp_0.8.1.bb index 75a5f886ad..551621708c 100644 --- a/meta-oe/recipes-support/websocketpp/websocketpp_0.8.1.bb +++ b/meta-oe/recipes-support/websocketpp/websocketpp_0.8.1.bb | |||
| @@ -5,7 +5,10 @@ LICENSE = "BSD-3-Clause" | |||
| 5 | LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=4d168d763c111f4ffc62249870e4e0ea" | 5 | LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=4d168d763c111f4ffc62249870e4e0ea" |
| 6 | DEPENDS = "openssl boost zlib" | 6 | DEPENDS = "openssl boost zlib" |
| 7 | 7 | ||
| 8 | SRC_URI = "git://github.com/zaphoyd/websocketpp.git;protocol=https;branch=master" | 8 | SRC_URI = "git://github.com/zaphoyd/websocketpp.git;protocol=https \ |
| 9 | file://0001-Replace-make_shared-with-new-in-some-cases.patch \ | ||
| 10 | file://0002-Fix-missed-entries-fix-testing.patch \ | ||
| 11 | " | ||
| 9 | 12 | ||
| 10 | # tag 0.8.1 | 13 | # tag 0.8.1 |
| 11 | SRCREV= "c6d7e295bf5a0ab9b5f896720cc1a0e0fdc397a7" | 14 | SRCREV= "c6d7e295bf5a0ab9b5f896720cc1a0e0fdc397a7" |
