Friday, February 11, 2011

C/C++ Web Server Library?

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.

  • 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

  • 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.

    Bklyn : Interesting solution. Playing with FastCGI now.
    From bmdhacks
  • I've heard about Wt (nothing to do with Qt, I think :) ) but haven't actually used it.

  • 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.

    From Rob Walker
  • You may want to check Baby Web Server

    Bklyn : I should probably have specified: portable, open-source. That suggestion appears to be neither.
  • My current favourite is libpion: pion-network-library

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

    Bklyn : I'm already using Boost so this seems like the best fit of the lot. Thanks for the pointer.
  • How about Shttpd? I did some googling for a web server and came across this one? Has anyone used it before?

    Bklyn : 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).
    From akshat
  • for future search and reference: http://libwebserver.sourceforge.net/

    From lf
  • What about libmicrohttpd?

    From Gatis

0 comments:

Post a Comment