Simple http lib server

What is a good choice for a simple http server library? It does not require high performance. I'm rather looking for something simple for some REST / JSON ("API") messages.

It should be able to work in a multi-threaded environment and should be able to handle a large POST request.

Any suggestions? I already tried cpp-netlib, but it seems too complicated for such an easy task ...

Edit: I'm looking for something really light and simple. For instance. like Sinatra in the world of Ruby. Poco is another example of a library that is too heavy.

+6
source share
4 answers

The first thing that comes to mind is the Poco library ( http://pocoproject.org/ )

Cross-platform, stable, well-documented. Although the library itself offers more than you probably need, you can create and omit parts that you do not plan to use to reduce bloating.

They have a fully featured Net library, which includes several important classes and utilities.

Here are pdf slides from this library, of particular interest is the HTTPServer class: http://pocoproject.org/slides/200-Network.pdf

+10
source

I would advise you to start with the http server samples in boost.asio. They are so simple and straightforward that you should be able to easily expand them as needed.

However, if you want to switch to something more polished than just a code sample, I know 3 C ++ http servers that you can try:

  • "x0 - The structure of the HTTP web server" for me personally, this seems the most promising, because it is light and simple
  • "highpower / xiva" is a simple web server infrastructure for delivering notifications to browsers.
  • "Peony, Atomic Labs Project" is part of a complex structure for processing large amounts of data.
+3
source

Not sure about the big POST data, but I previously used mongoose: https://github.com/cesanta/mongoose/ .

If the LGPL license is undesirable, there is a MIT plug when the project was MIT, which also adds the C ++ API https://github.com/bel2125/civetweb

+3
source

Personally, I will go for Arachnid (http://arachnida.sf.net), but maybe because I wrote it.

0
source

Source: https://habr.com/ru/post/906002/


All Articles