FastCGI for C++

前端 未结 6 667
忘了有多久
忘了有多久 2021-02-01 07:59

I\'ve found only two FastCGI libraries for C++. There\'s the \"official\" one, and fastcgi++. How is either one better than the other? Do any others exist?

相关标签:
6条回答
  • 2021-02-01 08:22

    The C-version of FastCGI does very little, and developing in C++ isn't such a big problem as it hardly interferes with your own code. It's most likely just a loop and an environment variable.

    So my advice would be just to stick with the official version.

    Just be aware of one thing: it works by redefining printf! So if you use cout it won't work.

    0 讨论(0)
  • 2021-02-01 08:39

    See also the Cgicc library:

    http://www.gnu.org/software/cgicc/

    The library appears to be mature (currently at version 3.x). According to the documentation it can be used with FastCGI by passing a custom reader (reader_function_t) to the constructor of the Cgicc class.

    0 讨论(0)
  • 2021-02-01 08:42

    As fastcgi++ is still listed as "Development Status: 4- Beta" so I would suggest going for the official one. It has been around for ages and has bindings for a whole host of languages. Licences between the 2 don't seem to make much difference. Put some measurements in your code and if performance is an issue then spend some time playing around with alternatives.

    0 讨论(0)
  • 2021-02-01 08:42

    There is a pretty library for creating FastCGI daemons: https://github.com/golubtsov/Fastcgi-Daemon

    0 讨论(0)
  • 2021-02-01 08:45

    What you probably want is hidden in the contrib directory of Cgicc package.

    fcgi-test.cpp is an example of how to use cgicc with FastCGI.

    Path to the installed fcgi-test.cpp should be /usr/share/doc/libcgicc-doc/examples/contrib/fcgi-test.cpp

    0 讨论(0)
  • 2021-02-01 08:47

    The official library is rather low-level, and as such, is only useful as an intermediate for a high-level CGI library such as cgicc.

    Fastcgi++, on the other hand, allows for use of C++ idioms when dealing with FastCGI. Incompleteness in v1 motivated me to fork it into mosh-fcgi.

    Pros: My fork complies with every point of the standard (especially ROLE_FILTER) everything's extensively templated, so it's easier to use arbitrary T for std::basic_strings. Cons: My modifications are in alpha mode.

    In any case, download the latest zip from https://github.com/moshbear/mosh-fcgi.

    0 讨论(0)
提交回复
热议问题