2

I am planning to build a small crawler in C++ for my projects. I chose the Boost.Asio library to achieve networking functionality. But then, I came across Boost.Beast library and I am confused as of which library to use. I have 2 doubts:

Question 1:

Does Boost.Asio support HTTPS and HTTP/2 connections?

Question 2:

What is the difference between Boost.Asio and Boost.Beast?

I have searched some documents and couldn't find useful information. Also, there are only a handful of articles about Boost libraries.

Thanks.

Joseph D.
  • 11,804
  • 3
  • 34
  • 67
Panther Coder
  • 1,058
  • 1
  • 16
  • 43

1 Answers1

2

Q1:

No, it will only do TCP for you.

Q2:

Asio:

Boost.Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. https://www.boost.org/doc/libs/1_67_0/doc/html/boost_asio.html

Beast:

Beast is a C++ header-only library serving as a foundation for writing interoperable networking libraries by providing low-level HTTP/1, WebSocket, and networking protocol vocabulary types and algorithms using the consistent asynchronous model of Boost.Asio. https://www.boost.org/doc/libs/1_67_0/libs/beast/doc/html/index.html

In a nutshell, Asio is lower level, helps you with building asynchronous programs, helps with I/O and on the network side is limited to transport layer mostly. It has some support for SSL.

Beast is higher level and helps you when you need HTTP, Websockets etc. It is interoperable with Asio.

f4.
  • 3,814
  • 1
  • 23
  • 30
  • So, I wont be able to make any HTTPS request using `Boost.Asio`? – Panther Coder Jun 23 '18 at 13:41
  • 6
    You can make HTTPS requests with Asio but you will need to serialize the HTTP message yourself, and parse the HTTP response from the server yourself. Beast does these things for you, so unless you have a really great reason for why you want to implement it yourself you are probably better off with using Beast. – Vinnie Falco Jun 23 '18 at 21:33