![]() |
Home | Libraries | People | FAQ | More |
Copyright © 2007, 2008 Darren Garvey
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Table of Contents
![]() |
Important |
|---|---|
|
This manual does not document a library that is a part of _Boost_. The major part of it has been developed this summer as part of the Google Summer of Code, 'GSoC07'. Everything from here on in is alpha-grade, some bits more than others; comments and bug reports are welcome. These documents are either hosted at sourceforge, or at svn.boost.org. For free! |
All science is either Physics, or stamp collecting.
-- Ernest Rutherford.
THIS LIBRARY IS NOT A PART OF BOOST.
Boost.CGI is an open-source library for writing CGI programs in Standard C++. The library supports vanilla CGI, SCGI and FastCGI (SCGI doesn't really work yet) so it can be used to write anything from simple 'CGI scripts' to full-fledged, scalable applications. This library rests on top of and should appear familiar to users of Boost.Asio, a cross-platform asynchronous (and fast) networking library. One of the main aims of the library is to allow programs to be written for any of the supported protocols without any real modification.
C++ may not be the most common language used for CGI programming, but it is a powerful one that can be used to produce scalable, maintainable and uncompromisingly efficient applications.
A discussion about the benefits of CGI programming in C++ is beyond the scope of this document and I've assumed you're here because you want to try C++ CGI programming, but here is a short list anyway:
With web applications becoming increasingly complex and responsive (ie. asynchronous, vis-ŕ-vis AJAX) all the while being required to scale boundlessly - the benefits of C++ begin to show.
The generally poor support for CGI programming for C++ - most libraries are either unmaintained, or don't take advantage of modern C++ capabilities - has driven the development of this library. moremoremore
![]() |
Note |
|---|---|
At the moment, the Boost style guidelines aren't honoured properly or consistently. Please ignore this for now, as the ambiguity is half-intentional (since this is not a Boost library). It's simple enough to rectify. |
Table 1.1. What Headers to Include
|
Protocol |
|
|---|---|
|
All |
|
|
CGI |
|
|
aCGI |
|
|
FastCGI |
|
The classes/functions that are shared between protocols are in the cgi::common
namespace. Using the above headers dumps these into the relevant namespace.
|
Protocol |
|
|---|---|
|
CGI |
OR
|
|
aCGI |
OR
|
|
FastCGI |
OR
|
Macros are prefixed with BOOST_CGI_* .
The only public macros so far are:
Valid macros
BOOST_CGI_DEFAULT_CONTENT_TYPEThis defaults to "text/plain" and causes a default "content-type" header to be output, but only when you don't output any other headers.
BOOST_CGI_NO_DEFAULT_CONTENT_TYPE
#define this when you
don't want a default "content-type" header to be output. CGI
scripts always need one of these, so you will be responsible for sending
one!
As you are probably used to, it is assumed that code snippets in this manual
have the correct #includes
and "using namespace
boost::<protocol>;"
prepended to them.
Use cases, example requests, puzzles and problems should be sent to the mailing list:
cgi-talk @ lists.sf \.\ net
or thereabouts.
Last revised: March 31, 2009 at 23:00:39 GMT |