Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's assume I want (for fun at start) to play with some new DSL (domain specific language) idea. And I really want its user[s] (probably only me at first) to interact thru a web interface. I'll probably implement it in C++ (probably using LLVM).

Should I use an HTTP server library (like libonion or microhttpd) to talk directly HTTP or should I use FastCGI? I could also use libraries doing both like cppcms or wt...

In particular, I am noticing that several recent web frameworks (Opa, Ocsigen, ...) do not have any FastCGI interface but only HTTP one.... (but Ur/Web seems to have both)

So my feeling is that FastCGI is really out of fashion....

Any opinions on that? Do you know recently started project using FastCGI ? (and what about SCGI?)

share|improve this question
1  
FastCGI has a tremendous presence in scripting languages. It may simply be that it's not something that the C++ community has decided to pick up so far. – Charles Dec 8 '12 at 6:37
    
FastCGI is usable from C++. The question is: it worth it, or is it slowly becoming obsolete or irrelevant? – Basile Starynkevitch Dec 8 '12 at 8:03

I've considered many implementations, with different types of connection methods, and this is how I view the choice.

From a developer perspective FastCGI IS out of style, in the same way they would consider C. from a developer perspective accomplishing the task can be done through simpler ways.

From an implementation perspective, HTTP isn't a perfect replacement, however their is enough overlap so they could be used to solve the same goals. BUT really this question is about implementation and architecture, and not a developer focused question, so I'll answer it from systems engineering side.

Despite what I've unfortunately read in developer blogs, FastCGI CAN be a better choice when utilized in the proper circumstances. It separates a large complicated concern, that otherwise must be implemented higher up the stack.

For example, It allows you to avoid creating a robust web server inside your framework/language. A huge task if you actually care about quality, but very doable if you slap it together like most. So it's ironically easier to roll it all up in a spaghetti ball, then cleanly separate that part. This is why so many avoid FastCGI, because they could only implement it by almost wrapping HTTP anyway, due to their bad architectural choices.

Since you didn’t get more detailed about how ambitious your plan, I can't really give you great recommendations. Let me suggest a few things to investigate, that are not the common slap together python node style.

Read about the implementation details of , php-fpm

If you want to do a more appserver model, do it right, read about uwsgi

share|improve this answer

Few notes:

So my feeling is that FastCGI is really out of fashion....

Telling this is like to tell that TCP/IP is out of fashion in days of HTTP.

FastCGI is the protocol between web application and the web server - however it does not mean that you need to use it directly from your application.

Should I use an HTTP server library (like libonion or microhttpd) to talk directly HTTP or should I use FastCGI? I could also use libraries doing both like cppcms or wt...

See if you want to develop even a simple web site it is very hard to do it using HTTP alone - there are many factors to handle - this is why there are web frameworks that solve the problem for you, more than that many stuff like static files handing and some security considerations are passed to web server and the framework itself.

So I'd recommend you to use Web framework like CppCMS that allows to implement web application using C++ easily - so basically you work on busyness logic, the rest web framework does for you.

And as a bounce you get support of HTTP, FastCGI, SCGI protocols and you can use either your internal web server or any industry standard protocol with powerful web server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.