tags:

views:

6748

answers:

9

I'm looking for a well-written, flexible library written in C or C++ (I'm writing my apps in C++) that can be used to embed an relatively simple HTTP server into my applications. Ultimately I will use this for application monitoring and control.

There are a number of great client-side libraries (e.g. libwww, neon, curl) but I'm struggling to find a good solution for the server-side. I'm sure other folks have done this before, so I'd love to hear what folks have done and what has worked and what hasn't.

+1  A: 

We have used this one for a while. It was OK for small load, for hundred TPS and more had to replace it with Apache module

Dmitry Khalatov
+4  A: 

I'm not aware of any such library, although there does seem to be a need. In lieu of somebody suggesting one, here's an alternate approach that I might recommend:

You might consider using a lightweight httpd daemon such as lighttpd and interfacing it with your app via FastCGI.

FastCGI is a socket mechanism where the web server will feed requests to your app, which can then answer with the content over a simple protocol. There are a number of libraries that implement FastCGI which should make it easy to use in your app.

bmdhacks
Interesting solution. Playing with FastCGI now.
Bklyn
+3  A: 

I've heard about Wt (nothing to do with Qt, I think :) ) but haven't actually used it.

Nemanja Trifunovic
A: 

We've been to both extremes on this, and not found much in the middle.

At one end we implemented our own simple server (albeit quite a few years ago now), which I wouldn't recommend.

At the other extreme we've embedded IIS, which isn't exactly light-weight (especially if you're not .net to start with) but provides a tremendous amount of flexibility and actually isn't all that difficult.

Rob Walker
A: 

You may want to check Baby Web Server

Sergey Kornilov
I should probably have specified: portable, open-source. That suggestion appears to be neither.
Bklyn
+7  A: 

My current favourite is libpion: pion-network-library

which effectively uses the nice boost.asio library for async sockets

jdkoftinoff
I'm already using Boost so this seems like the best fit of the lot. Thanks for the pointer.
Bklyn
+4  A: 

How about Shttpd? I did some googling for a web server and came across this one? Has anyone used it before?

akshat
Looks like this project was renamed "mongoose" and now lives at http://code.google.com/p/mongoose/. I like it for its simplicity and ease of integration (1 C file).
Bklyn
A: 

for future search and reference: http://libwebserver.sourceforge.net/

lf
+1  A: 

What about libmicrohttpd?

Gatis