Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Dv::Cgi Namespace Reference

Dv::Cgi is the namespace for this package. More...


Classes

class  Cgi
 A wrapper class that represents the http interface to a cgi program. More...
class  CgiError
 A runtime exception thrown by some cgi-related functions. More...
class  HttpHeader
 A class representing the header part of a HTTP response. More...
class  SessionServer
 A class that packages the link to the hidden server. More...

Functions

void cgidata (std::string &data) throw (CgiError)
 Fill the parameter string with the data stream passed to the cgi program.
Dv::Util::Propscookieprops (Dv::Util::Props &props) throw ()
 Store cookies as [name,value] pairs in props.
bool urlencoded_formdata (const std::string &data, Dv::Util::Props &props) throw ()
 Convert url encoded form data to <key,value> pairs in Dv::Util::Props.
bool multipart_formdata (const std::string &data, Dv::Util::Props &props) throw ()
 Convert multipart encoded form data to <key,value> pairs in Dv::Util::Props.
bool formdata (const std::string &data, Dv::Util::Props &props) throw ()
 Convert formdata using either urlencoded_formdata or multipart_formdata.
void eof (SessionServer &)
 Convenience function, simply calls refresh on its argument.
std::string & www_decode (std::string &s)
 In-place decode (RFC 1738) of string s.
std::string & www_encode (const std::string &sin, std::string &sout)
 Encode (RFC 1738) string.
std::string & html_encode (const std::string &sin, std::string &sout)


Detailed Description

Dv::Cgi is the namespace for this package.

Function Documentation

void Dv::Cgi::cgidata std::string &  data  )  throw (CgiError)
 

Fill the parameter string with the data stream passed to the cgi program.

Further processing can be done with Dv::Cgi::formdata.

Parameters:
data a string that will be filled with the data stream.
Exceptions:
CgiError is thrown when something goes wrong, e.g. illegal protocol etc.
See also:
Dv::Cgi::formdata

Dv::Util::Props& Dv::Cgi::cookieprops Dv::Util::Props props  )  throw ()
 

Store cookies as [name,value] pairs in props.

bool Dv::Cgi::urlencoded_formdata const std::string &  data,
Dv::Util::Props props
throw ()
 

Convert url encoded form data to <key,value> pairs in Dv::Util::Props.

Parameters:
data raw data, typically the result of calling Cgi::cgidata().
props where key=value pairs will be stored.
Returns:
true unless something went wrong.
Warning:
several values for the same keys will be appended to the value associated with the key, separated by comma's.
See also:
Dv::Util::Props

bool Dv::Cgi::multipart_formdata const std::string &  data,
Dv::Util::Props props
throw ()
 

Convert multipart encoded form data to <key,value> pairs in Dv::Util::Props.

Parameters:
data raw data, typically the result of calling Cgi::cgidata().
props where key=value pairs will be stored. For a ``file'' field with name ``myfile'' in a form, props[myfile] will contain the contents of the file while props[myfile-name] will contain the filename, if any was transmitted.
Returns:
true unless something went wrong.
Warning:
several values for the same keys will be appended to the value associated with the key, separated by comma's.
See also:
Dv::Util::Props

bool Dv::Cgi::formdata const std::string &  data,
Dv::Util::Props props
throw ()
 

Convert formdata using either urlencoded_formdata or multipart_formdata.

Parameters:
data raw data, typically the result of calling Cgi::cgidata().
props where key=value pairs will be stored.
Returns:
true unless something went wrong.
Warning:
several values for the same keys will be appended to the value associated with the key, separated by comma's.
See also:
Dv::Util::Props

void Dv::Cgi::eof SessionServer &   ) 
 

Convenience function, simply calls refresh on its argument.

Example:

  Dv::Cgi::SessionServer s(..);

  s.header().content_type("text/html").no_cache();

  while (s) {
    Dv::Util::Props& input(s.props());

    s << "<html>..</html>" << Dv::Cgi::eof;
    }
See also:
operator<<(std::ostream& os, void (*f)(Dv::Cgi::SessionServer&)

std::string& Dv::Cgi::www_decode std::string &  s  ) 
 

In-place decode (RFC 1738) of string s.

Parameters:
s string to be decoded (in-place).
Returns:
reference to parameter

std::string& Dv::Cgi::www_encode const std::string &  sin,
std::string &  sout
 

Encode (RFC 1738) string.

Parameters:
sin input string to be encoded.
sout string that will receive the encoded version of sin.
Returns:
reference to sout.

std::string& Dv::Cgi::html_encode const std::string &  sin,
std::string &  sout
 


dvcgi-0.5.14 [22 January, 2006]