[beast] Version 80: code review opportunity
Beast version 80 is sitting in the pull request queue if anyone is interested in providing a code review. This contains changes motivated by Bjorne's desire for more control over chunk-encoded output. https://github.com/vinniefalco/Beast/pull/641 List of changes since beginning of the formal review: -------------------------------------------------------------------------------- * Javadoc tidying * Add basic_dynamic_body.hpp * Shrink buffer_prefix_view * Remove unused file_path * Add basic_file_body.hpp * buffers_ref is Assignable * Shrink chunk header buffer sequence size * Refactor chunked-encoding serialization * Remove spurious fallthrough guidance * Add span * Documentation work * Use make_unique_noinit * Fix warning in zlib * Header file tidying * Tidy up FieldsReader doc * Add Boost.Locale utf8 benchmark comparison * Tidy up dstream for existing Boost versions * Tidy up file_posix unused variable * Fix warning in root ca declaration * Tidy up basic_string_body * Add vector_body * span, string, vector bodies are public * Fix spurious uninitialized warning * fields temp string uses allocator * Add message::keep_alive() * Add message::chunked() and message::content_length() * Remove string_view_body * file_posix works without large file support * Always go through write_some * Use Boost.Config * BodyReader may construct from a non-const message * Add serializer::get * Add serializer::chunked * Serializer members are not const * serializing file_body is not const * Add file_body_win32 * Fix parse illegal characters in obs-fold * Disable SSE4.2 optimizations * Rename to serializer::keep_alive * BodyReader, BodyWriter use two-phase init * Use file_body for valid requests, string_body otherwise. * Construct buffer_prefix_view in-place * Shrink serializer buffers using buffers_ref * Tidy up BEAST_NO_BIG_VARIANTS * Shrink serializer buffers using buffers_ref * Add serializer::limit * file_body tests * Using SSE4.2 intrinsics in basic_parser if available * Add file_stdio and File concept * Add file_win32 * Add file_body * Remove common/file_body.hpp * Add file_posix * Fix Beast include directories for cmake targets * remove redundant flush() from example * Jamroot tweak * Verify certificates in SSL clients * Adjust benchmarks * Initialize local variable in basic_parser * Fixes for gcc-4.8 * basic_parser optimizations * Add basic_parser tests * Refactor header and message constructors * serializer::next replaces serializer::get * Tidy up set payload in http-server-fast * Refine Body::size specification * Newly constructed responses have a 200 OK result * Refactor file_body for best practices * Add http-server-threaded example * Documentation tidying * Various improvements to http_server_fast.cpp * Add websocket-server-async example * Fix extra ; warning * Documentation revision * Fix spurious on_chunk invocation * Call prepare_payload in HTTP example * Check trailers in test * Fix buffer overflow handling for string_body and mutable_body * Concept check in basic_dynamic_body * Tidy up http_sync_port error check * Tidy up Jamroot /permissive- * Fine tune websocket op asserts * Refactor websocket composed ops * Allow close, ping, and write to happen concurrently * Fix race in websocket read op * Fix websocket write op * Add cmake options for examples and tests * Return `std::size_t` from `Body::writer::put` Thanks
-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Vinnie Falco via Boost Sent: 12 July 2017 19:58 To: Boost Cc: Vinnie Falco Subject: [boost] [beast] Version 80: code review opportunity
Beast version 80 is sitting in the pull request queue if anyone is interested in providing a code review. This contains changes motivated by Bjorne's desire for more control over chunk-encoded output.
https://github.com/vinniefalco/Beast/pull/641
List of changes since beginning of the formal review:
--------------------------------------------------------------------------------
* Javadoc tidying * Add basic_dynamic_body.hpp * Shrink buffer_prefix_view * Remove unused file_path * Add basic_file_body.hpp * buffers_ref is Assignable * Shrink chunk header buffer sequence size * Refactor chunked-encoding serialization * Remove spurious fallthrough guidance * Add span * Documentation work * Use make_unique_noinit * Fix warning in zlib * Header file tidying * Tidy up FieldsReader doc * Add Boost.Locale utf8 benchmark comparison * Tidy up dstream for existing Boost versions * Tidy up file_posix unused variable * Fix warning in root ca declaration * Tidy up basic_string_body * Add vector_body * span, string, vector bodies are public * Fix spurious uninitialized warning * fields temp string uses allocator * Add message::keep_alive() * Add message::chunked() and message::content_length() * Remove string_view_body * file_posix works without large file support * Always go through write_some * Use Boost.Config * BodyReader may construct from a non-const message * Add serializer::get * Add serializer::chunked * Serializer members are not const * serializing file_body is not const * Add file_body_win32 * Fix parse illegal characters in obs-fold * Disable SSE4.2 optimizations * Rename to serializer::keep_alive * BodyReader, BodyWriter use two-phase init * Use file_body for valid requests, string_body otherwise. * Construct buffer_prefix_view in-place * Shrink serializer buffers using buffers_ref * Tidy up BEAST_NO_BIG_VARIANTS * Shrink serializer buffers using buffers_ref * Add serializer::limit * file_body tests * Using SSE4.2 intrinsics in basic_parser if available * Add file_stdio and File concept * Add file_win32 * Add file_body * Remove common/file_body.hpp * Add file_posix * Fix Beast include directories for cmake targets * remove redundant flush() from example * Jamroot tweak * Verify certificates in SSL clients * Adjust benchmarks * Initialize local variable in basic_parser * Fixes for gcc-4.8 * basic_parser optimizations * Add basic_parser tests * Refactor header and message constructors * serializer::next replaces serializer::get * Tidy up set payload in http-server-fast * Refine Body::size specification * Newly constructed responses have a 200 OK result * Refactor file_body for best practices * Add http-server-threaded example * Documentation tidying * Various improvements to http_server_fast.cpp * Add websocket-server-async example * Fix extra ; warning * Documentation revision * Fix spurious on_chunk invocation * Call prepare_payload in HTTP example * Check trailers in test * Fix buffer overflow handling for string_body and mutable_body * Concept check in basic_dynamic_body * Tidy up http_sync_port error check * Tidy up Jamroot /permissive- * Fine tune websocket op asserts * Refactor websocket composed ops * Allow close, ping, and write to happen concurrently * Fix race in websocket read op * Fix websocket write op * Add cmake options for examples and tests * Return `std::size_t` from `Body::writer::put`
I think Vinnie deserves some sort of medal ;-) Paul
On Thu, Jul 13, 2017 at 4:09 AM, Paul A. Bristow via Boost
I think Vinnie deserves some sort of medal ;-)
Version 81 is now in the pull request queue, it contains version 80 with the chunk serialization changes motivated by Bjorn, and also contains a refactoring of chunked parsing similarly motivated by Bjorn's use-cases: https://github.com/vinniefalco/Beast/pull/649 This documentation page explains everything and provides step by step example to achieve all the contemplated goals: http://vinniefalco.github.io/stage/beast/v81/beast/using_http/chunked_encodi... Feedback welcomed!
Den 13-07-2017 kl. 13:09 skrev Paul A. Bristow via Boost:
[snip]
I think Vinnie deserves some sort of medal ;-)
It is certainly unusual to make so much work during a review! :-) I have not time for making a review, but I will just note that we moved away from a custom Boost.Asio-based server. We now use POCO's http server. The amount of code I had to write was very low. Basically I only had to implement a request handler: class XmlRequestHandler : public Poco::Net::HTTPRequestHandler { void handleRequest( Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response ) { std::istream& is = request.stream(); response.setChunkedTransferEncoding( true ); response.setContentType( "text/html" ); String responseData; generateResponse( is, responseData ); std::ostream& ostr = response.send(); ostr << responseData; } ); Now I don't like the OO'pattern that fores me to new handlers, but otherwise the shortness of it is pretty sweet. Perhaps beast could consider to have such high-level functionality. kind regards Thorsten
On Fri, Jul 14, 2017 at 2:19 AM, Thorsten Ottosen via Boost
It is certainly unusual to make so much work during a review! :-)
This is just the normal pace of Beast development.
We now use POCO's http server. The amount of code I had to write was very low. Basically I only had to implement a request handler: ... Now I don't like the OO'pattern that fores me to new handlers, but otherwise the shortness of it is pretty sweet. Perhaps beast could consider to have such high-level functionality.
That's definitely a future plan although it might appear in a different library rather than Beast.
participants (3)
-
Paul A. Bristow
-
Thorsten Ottosen
-
Vinnie Falco