cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Beast: a new HTTP library

From: Vinnie Falco <vinnie.falco_at_gmail.com>
Date: Sat, 4 Jun 2016 13:22:24 -0400

On Sat, Jun 4, 2016 at 12:08 PM, K. Frank <kfrank29.c_at_gmail.com> wrote:
> Hello Vinnie!

Greetings, nice to meet you!

> Because of history and the ecology, there is much greater
> cross-compiler ABI compatibility for c than for c++. That
> means that you don''t have to rebuild libcurl as often, and
> you're more likely to be able to download a pre-built version
> of libcurl that meets your needs than would be the case
> with a c++ implementation.

I totally agree. In fact, you have to "rebuild" Beast every single
time you compile your program, because Beast is header-only, like much
of Boost. Beast isn't looking to replace libcurl. The standard library
is sorely lacking a robust implementation of the HTTP protocol that
follows C++ best practices, and Beast aims to fill that niche. libcurl
goes way beyond the basics of the HTTP protocol and that's great if
you need it.

> Beast's dependence on boost is a concern.

A lot of developers object to Boost for various reasons. Its big,
almost always has more than you actually need, it can be hard to
understand the implementation, and some compilation errors from boost
misuse take up several pages. If there were many libraries like this,
then I agree it would be a pretty big problem.

However, there is no other library like Boost. Nothing even comes in a
close second place. In fact, parts of Boost often become part of the
C++ standard library. Or Boost offers replacements for C++ standard
library interfaces that are not yet available on particular compiler
platforms. So I have accepted a Boost dependency. Its very easy to
download and install, and for most systems there's a "package" or
whatever its called that gets you boost with just one command line.
The barrier to entry for using boost is practically non-existent.

And consider that Beast has been submitted to the Boost incubator for
an eventual review with the hopes of being included as PART of Boost,
I think that the Boost dependency is likely a non-issue :-)

> So, there is a lot to be said for Daniel's 20th-century
> c-hacker-ish software philosophy.

Definitely. A lot of people still program in C and don't need the
expressive power or customization of templates. They just want to
fetch a resource from a server and get on with their domain specific
problem. libcurl is great for that. Beast does not try to compete in
that space. Instead, Beast is a low level building block intended for
writers of other libraries or for building new interfaces.

For example, Beast's WebSocket implementation uses the HTTP
implementation to handle the initial HTTP Upgrade handshake. Is
libcurl well suited for receiving a HTTP request, building a HTTP
response, and sending the HTTP response back? I'm not so sure. Is
libcurl an improvement over the method that Beast uses to process the
HTTP WebSocket Upgrade request (lines 306, 307):
https://github.com/vinniefalco/Beast/blob/999e2fa0318b5982736d3ea01a418770ea802671/include/beast/websocket/impl/stream.ipp#L300

Beast's HTTP interfaces are symmetric - you can build a server as well
as a client using the same message model. So there's also that.

Thanks!
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-04