NeDark
NeDark

Reputation: 1294

Lightweight HTTP/HTTPS server in C++ (not C)

I need to build a lightweight http server for my application basically it's a server which listen to a port and outputs a status information on requests, https, other functionality. But I would like to know first if something like this existe in C++, for linux and open source.

Does anyone know a program like that?

Thanks.

EDIT: It should be able to support high load.

Upvotes: 1

Views: 10889

Answers (5)

Artyom
Artyom

Reputation: 31271

If you want to handle high loads I would suggest following:

  1. Use proper web server with all goodies it comes with like Lighttpd, Nginx or Apache (in that order).

    It would do great job in serving static files and handle your application. And they are very lightweight.

  2. Write an Application in C++ using proper web framework - CppCMS - that is designed for high loads
  3. Connect Web Application to the server via FastCGI or SCGI protocol (in this order).

Disclaimer: I'm the author of CppCMS

Upvotes: 2

Joshua
Joshua

Reputation: 43327

See thttpd. Supposibly the fastest open source file server on all machines with a single CPU.

Upvotes: 0

Joshua
Joshua

Reputation: 43327

If not using HTTPS, it's about a two hour exercise to write a static file server.

Upvotes: -1

Jon Watte
Jon Watte

Reputation: 7228

A quick google search for "C++ web application framework" shows things called CppCMS and something else called WT. That might get you started.

Or, as Sam already answered: boost.asio comes with a HTTP example that may be sufficient if your needs are simple. (Real HTTP request handling is actually surprisingly complex: http://webmachine.basho.com/diagram.html )

Upvotes: 0

Sam Miller
Sam Miller

Reputation: 24174

If you can use boost, the asio library provides an http example. It does not use SSL, but asio can use OpenSSL very easily.

Upvotes: 6

Related Questions