Boost logo

Boost :

Subject: Re: [boost] [beast] Request for Discussion
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2016-10-02 11:29:28


On Sun, Oct 2, 2016 at 10:31 AM, Bjorn Reese <breese_at_[hidden]> wrote:
> On 09/25/2016 02:26 PM, Vinnie Falco wrote:
>> Beast provides low level HTTP protocol functionality while Boost.Http offers
>> a turn-key HTTP server.

Beast originally started with a WebSocket implementation. In the
WebSocket protocol, every session starts out with a HTTP
request/response sequence. The client sends a HTTP Upgrade request and
upon success the server sends a 101 Switching Protocols response. See:
https://en.wikipedia.org/wiki/HTTP/1.1_Upgrade_header#Use_with_WebSockets

I went looking for a suitable low-level HTTP library to use as a
modular component in building beast::websocket::stream. I wanted users
of Beast to be able to customize the initial handshake, including the
ability to write servers that support not only WebSocket but also HTTP
(features not present in websocketpp). I surveyed these libraries:

Boost.Http
https://github.com/BoostGSoC14/boost.http

cpp-netlib:
https://github.com/cpp-netlib/cpp-netlib

Microsoft/cpprestsdk
https://github.com/Microsoft/cpprestsdk

POCO
https://github.com/pocoproject/poco

I found that all existing libraries were unsuitable for use as a
building block for a WebSocket implementation to use for the HTTP
handshake portion of session establishment. All of them forced callers
to use a particular container concept for storing message bodies. Most
of them did not have a correct separation of concerns (for example, by
declaring the message object to also include the socket or remote IP).
There was missing client functionality (e.g. parsing responses or
sending requests). And incorrect usage of Boost.Asio idioms (for
example std::function<> instead of completion tokens). I can offer to
review those libraries publicly if any parties are interested...

This is just my opinion, but a library that claims to offer low-level
HTTP functionality should offer a good message model that includes
requests and responses, and a clean, well factored interface to send
and receive those messages. I did not find that functionality in any
of the libraries that I reviewed.

On Sun, Oct 2, 2016 at 10:31 AM, Bjorn Reese <breese_at_[hidden]> wrote:
> ...
> That is a mischaracterization of the differences between Boost.Http
> and Beast. Both provide low-level HTTP functionality.

The description on https://github.com/BoostGSoC14/boost.http reads:

"Boost.Http"
"Embeddable C++ HTTP server"
"This library implements a core HTTP server for Boost that can be used
from resource-constrained devices to powerful machines that have
plenty of resources to make use of and can speed up the server (such
as extra ram available to pools and extra cpus available to
multithreaded servers)."

It seems we are using different definitions of low-level here. Is
there another definition that I should be using instead?

Regards


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk