Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the closest C++ analogue to Ruby's Rack?

I'm a big fan of Rack, and I've used it to build several lightweight web apps over the past few years. I've been curious for a while if something similar exists for C++. I've spent quite a bit of time searching Google and come up empty-handed. It doesn't help that I find Rack hard to describe. Its tagline is "A Ruby Webserver Interface". Searching for {c++ "webserver interface"}, I've found things that do much more than I want, like wt, and I've found suggestions to use FastCGI directly. I feel like Rack fits squarely between these two options.

I'm not sure if I'm having trouble finding a C++ analogue to Rack because no such thing exists or because I'm just using poor search terms.

Is there a close C++ analogue to Rack? If not, is there a library or small set of libraries that can do most of the lower-level, error-prone stuff for me, but still leave me with the level of control that Rack does?

like image 422
Darshan Rivka Whittle Avatar asked Jun 06 '12 11:06

Darshan Rivka Whittle


2 Answers

You might take a look at cpp-netlib. It gives a fairly low level view of http (both client and server side), but high enough that you aren't constantly dealing with lowest level networking apis.

like image 163
Managu Avatar answered Nov 02 '22 16:11

Managu


Here are the best options I've found so far:

  • cpp-net-lib (Thanks @Managu) - This appears to be close to what I had in mind.
  • fastcgi++ - This appears to offers lots of niceties over straight FastCGI without turning into a full framework -- so also close to what I had in mind.
  • Mongrel2 - According to Zed, "Mongrel2's protocol also tends to remove the need for any 'middleware' like WSGI or Rack since its protocol is already similar to what those do." This comes from a very different angle, but also looks like it satisfies my general criteria.
like image 43
Darshan Rivka Whittle Avatar answered Nov 02 '22 15:11

Darshan Rivka Whittle