#include <cgi.h>
Collaboration diagram for Dv::Cgi::Cgi:
Public Member Functions | |
Cgi (const std::string &name, const std::string &reply_format="text/html", bool debug=false) throw () | |
Constructor takes encoding type of response as parameter. | |
virtual | ~Cgi () |
Destructor. | |
const Dv::Util::Props & | props () const |
const std::string & | props (const std::string &name) const throw (std::runtime_error) |
Dv::Util::Props & | props () |
std::string & | props (const std::string &name) throw (std::runtime_error) |
const Dv::Util::Props & | cookies () const |
const std::string & | cookies (const std::string &name) const throw (std::runtime_error) |
const Util::Props & | env () const |
const std::string & | env (const std::string &name) const throw (std::runtime_error) |
HttpHeader * | operator-> () |
Easy access to HttpHeader. | |
const std::string * | operator() (const std::string &key) const |
Easy check for formdata. | |
const std::string & | data () const |
HttpHeader & | header () |
const HttpHeader & | header () const |
const std::string & | name () const |
std::ostream & | log () |
const std::string & | here () const |
const std::string & | here_base () const |
const std::string & | client_host () const |
const std::string & | client_host_name () const |
const std::string & | this_host () const |
const std::string & | this_host_name () const |
std::string | url (const Dv::Util::Props &props) const |
Extend the base url of this Cgi object with formdata from props. | |
void | debug (std::ostream &os) const |
Write debug info on output stream. | |
Static Public Member Functions | |
static std::string | props_as_url_args (const Dv::Util::Props &props) |
Print props as url-arguments. | |
static std::string | url (const std::string &url, const Dv::Util::Props &props) |
Extend a url with arguments from props. | |
Private Attributes | |
const std::string | name_ |
Filter | filter_ |
Dv::Util::Props | cookies_ |
Dv::Util::Props | env_ |
Dv::Util::Props | formdata_ |
std::string | data_ |
Dv::Util::logstream | log_ |
std::string | here_ |
url of this program | |
std::string | here_base_ |
base of url of this program: anything before '?' | |
std::string | client_host_ |
dot address of client host | |
std::string | client_host_name_ |
name of client host | |
std::string | this_host_ |
dot address of this host | |
std::string | this_host_name_ |
name of this host | |
Dv::Cgi::HttpHeader | header_ |
header to be sent before reply | |
Classes | |
class | Filter |
Filter class which ensures that header_ is output before anything else. More... |
The constructor stores any form data and cookies in a property list. Dv::Cgi::operator<<(ostream&,const Dv::Cgi::Cgi& ) outputs the header lines set in Cgi::header().
A typical usage could be:
try { Cgi cgi("myapplication.cgi"); cgi.header().content_type("text/plain"); cgi << cgi.props() << endl; } catch (std::exception& e) { cerr << e.what() << endl; }
Definition at line 41 of file cgi.h.
|
Constructor takes encoding type of response as parameter.
Cgi cgi("myapplication.cgi", "text/html", true); try { } catch (exception& e) { cgi.header().content_type("text/plain"); cgi << e.what(); } @encode which ensure that there is always proper output to cout. Even the following will work because the destructor will output something. @code { Cgi cgi("myapplication.cgi"); try { } catch (std::exception& e) { } } // Cgi::~Cgi() will output something. |
|
Destructor. The destructor will output a header and some standard error message, if nothing else was output yet. |
|
Definition at line 84 of file cgi.h. References formdata_. Referenced by operator()(), and props(). |
|
Definition at line 88 of file cgi.h. References props(). |
|
Definition at line 92 of file cgi.h. References formdata_. |
|
Definition at line 96 of file cgi.h. References props(). |
|
Definition at line 98 of file cgi.h. References cookies_. Referenced by cookies(). |
|
Definition at line 102 of file cgi.h. References cookies(). |
|
Definition at line 105 of file cgi.h. References env_. Referenced by env(). |
|
Definition at line 109 of file cgi.h. References env(). |
|
Easy access to HttpHeader.
Definition at line 117 of file cgi.h. References header_. |
|
Easy check for formdata.
Definition at line 122 of file cgi.h. References Dv::Util::Props::find(), and props(). |
|
Definition at line 125 of file cgi.h. References data_. |
|
Definition at line 128 of file cgi.h. References header_. |
|
Definition at line 130 of file cgi.h. References header_. |
|
Definition at line 134 of file cgi.h. References name_. |
|
Definition at line 139 of file cgi.h. References log_. |
|
Definition at line 145 of file cgi.h. References here_. |
|
Definition at line 152 of file cgi.h. References here_base_. |
|
Definition at line 158 of file cgi.h. References client_host_. |
|
Definition at line 164 of file cgi.h. References client_host_name_. |
|
Definition at line 169 of file cgi.h. References this_host_. |
|
Definition at line 176 of file cgi.h. References this_host_name_. |
|
Print props as url-arguments. Convert a property list of a string suitable for inclusion in a url. E.g. abc=123&key=blabla. Both keys and values will be encoded using Dv::Cgi::www_encode.
|
|
Extend the base url of this Cgi object with formdata from props.
|
|
Extend a url with arguments from props.
|
|
Write debug info on output stream.
|
|
Definition at line 223 of file cgi.h. Referenced by name(). |
|
|
|
Definition at line 225 of file cgi.h. Referenced by cookies(). |
|
Definition at line 226 of file cgi.h. Referenced by env(). |
|
Definition at line 227 of file cgi.h. Referenced by props(). |
|
Definition at line 228 of file cgi.h. Referenced by data(). |
|
Definition at line 229 of file cgi.h. Referenced by log(). |
|
url of this program
Definition at line 231 of file cgi.h. Referenced by here(). |
|
base of url of this program: anything before '?'
Definition at line 233 of file cgi.h. Referenced by here_base(). |
|
dot address of client host
Definition at line 235 of file cgi.h. Referenced by client_host(). |
|
name of client host
Definition at line 237 of file cgi.h. Referenced by client_host_name(). |
|
dot address of this host
Definition at line 239 of file cgi.h. Referenced by this_host(). |
|
name of this host
Definition at line 241 of file cgi.h. Referenced by this_host_name(). |
|
header to be sent before reply
Definition at line 243 of file cgi.h. Referenced by header(), and operator->(). |
dvcgi-0.5.14 | [22 January, 2006] |