Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cgicc::CgiEnvironment Class Reference

Class encapsulating the CGI runtime environment. More...

#include <cgicc/CgiEnvironment.h>

List of all members.

Public Methods

Constructor and Destructor
 CgiEnvironment (CgiInput *input)
 Read in the CGI environment passed to the CGI application by the server. More...

 ~CgiEnvironment ()
 Destructor. More...

Server Information
Information on the server handling the HTTP/CGI request

std::string getServerSoftware () const
 Get the name and version of the HTTP server software. More...

std::string getServerName () const
 Get the hostname, DNS name or IP address of the HTTP server. More...

std::string getGatewayInterface () const
 Get the name and version of the gateway interface. More...

std::string getServerProtocol () const
 Get the name and revision of the protocol used for this request. More...

unsigned long getServerPort () const
 Get the port number on the server to which this request was sent. More...

bool usingHTTPS () const
 Determine if this is a secure request. More...

CGI Query Information
Information specific to this CGI query

std::string getCookies () const
 Get the HTTP cookies associated with this query, if any. More...

const std::vector< HTTPCookie > & getCookieList () const
 Get a vector containing the HTTP cookies associated with this query. More...

std::string getRequestMethod () const
 Get the request method used for this query. More...

std::string getPathInfo () const
 Get the extra path information for this request, given by the client. More...

std::string getPathTranslated () const
 Get the translated path information (virtual to physical mapping). More...

std::string getScriptName () const
 Get the full path to this CGI application. More...

std::string getQueryString () const
 Get the query string for this request. More...

unsigned long getContentLength () const
 Get the length of the data read from standard input, in chars. More...

std::string getContentType () const
 Get the content type of the submitted information. More...

std::string getPostData () const
 Get the data passed to the CGI application via standard input. More...

Server Specific Information
Information dependent on the type of HTTP server in use

std::string getReferrer () const
 Get the URL of the page which called this CGI application. More...

Remote User Information
Information about the user making the CGI request

std::string getRemoteHost () const
 Get the hostname of the remote machine making this request. More...

std::string getRemoteAddr () const
 Get the IP address of the remote machine making this request. More...

std::string getAuthType () const
 Get the protocol-specific user authentication method used. More...

std::string getRemoteUser () const
 Get the authenticated remote user name. More...

std::string getRemoteIdent () const
 Get the remote user name retrieved from the server. More...

std::string getAccept () const
 Get the MIME data types accepted by the client's browser. More...

std::string getUserAgent () const
 Get the name of the browser used for this CGI request. More...

ErrorDocument Handling
For a tutorial on ErrorDocument handling, see http://hoohoo.ncsa.uiuc.edu/cgi/ErrorCGI.html

std::string getRedirectRequest () const
 Get the redirect request. More...

std::string getRedirectURL () const
 Get the redirect URL. More...

std::string getRedirectStatus () const
 Get the redirect status. More...


Protected Methods

Saving and Restoring
These are implementation methods only

void save (const std::string &filename) const
 Implementation of save, for saving CGI environments. More...

void restore (const std::string &filename)
 Implementation of restore, for restoring CGI environments. More...


Friends

class Cgicc


Detailed Description

Class encapsulating the CGI runtime environment.

The CgiEnvironment class encapsulates the environment of the CGI application as described by the HTTP server. CgiEnvironment contains the GET or POST data along with all environment variables set by the HTTP server specified in the CGI specification.

Definition at line 74 of file CgiEnvironment.h.


Constructor & Destructor Documentation

cgicc::CgiEnvironment::CgiEnvironment CgiInput   input
 

Read in the CGI environment passed to the CGI application by the server.

This function is not usually called directly; instead, an object of type CgiEnvironment is retrieved by calling the getEnvironment() method on Cgicc. If you are using cgicc with FastCGI, you will need to pass a CgiInput subclass that cgicc will use to read input. If input is omitted, standard input and environment variables will be used.

Parameters:
input  A CgiInput object to use for reading input
See also:
Cgicc::getEnvironment

cgicc::CgiEnvironment::~CgiEnvironment  
 

Destructor.

Delete this CgiEnvironment object


Member Function Documentation

std:: string cgicc::CgiEnvironment::getAccept   const [inline]
 

Get the MIME data types accepted by the client's browser.

For example image/gif, image/x-xbitmap, image/jpeg, image/pjpeg

Returns:
The accepted data types

Definition at line 389 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getAuthType   const [inline]
 

Get the protocol-specific user authentication method used.

This is only applicable if the server supports user authentication, and the user has authenticated.

Returns:
The authorization type

Definition at line 354 of file CgiEnvironment.h.

unsigned long cgicc::CgiEnvironment::getContentLength   const [inline]
 

Get the length of the data read from standard input, in chars.

This is usually only valid for scripts called with the POST method.

Returns:
The data length

Definition at line 272 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getContentType   const [inline]
 

Get the content type of the submitted information.

For applications called via the GET method, this information is irrelevant. For applications called with the POST method, this is specifies the MIME type of the information, usually application/x-www-form-urlencoded or as specified by getContentType().

Returns:
The content type
See also:
getContentType

Definition at line 287 of file CgiEnvironment.h.

const std:: vector<HTTPCookie>& cgicc::CgiEnvironment::getCookieList   const [inline]
 

Get a vector containing the HTTP cookies associated with this query.

This vector may be empty

Returns:
A vector containing the HTTP cookies associated with this query
See also:
HTTPCookie

Definition at line 207 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getCookies   const [inline]
 

Get the HTTP cookies associated with this query, if any.

The string returned by this method may contain multiple cookies; it is recommended to use the method getCookieList() instead, which returns a vector<HTTPCookie>.

Returns:
The HTTP cookies
See also:
getCookieList

Definition at line 194 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getGatewayInterface   const [inline]
 

Get the name and version of the gateway interface.

This is usually CGI/1.1

Returns:
The name and version of the gateway interface

Definition at line 143 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getPathInfo   const [inline]
 

Get the extra path information for this request, given by the client.

For example, in the string foo.cgi/cgicc the path information is cgicc.

Returns:
The absolute path info

Definition at line 229 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getPathTranslated   const [inline]
 

Get the translated path information (virtual to physical mapping).

For example, www.gnu.org may be translated to /htdocs/index.html

Returns:
The translated path info

Definition at line 239 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getPostData   const [inline]
 

Get the data passed to the CGI application via standard input.

This data is of MIME type getContentType().

Returns:
The post data.

Definition at line 297 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getQueryString   const [inline]
 

Get the query string for this request.

The query string follows the ? in the URI which called this application. This is usually only valid for scripts called with the GET method. For example, in the string foo.cgi?cgicc=yes the query string is cgicc=yes.

Returns:
The query string

Definition at line 262 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRedirectRequest   const [inline]
 

Get the redirect request.

This will only be valid if you are using this script as a script to use in place of the default server messages.

Returns:
The redirect request.

Definition at line 420 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRedirectStatus   const [inline]
 

Get the redirect status.

This will only be valid if you are using this script as a script to use in place of the default server messages.

Returns:
The redirect status.

Definition at line 443 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRedirectURL   const [inline]
 

Get the redirect URL.

This will only be valid if you are using this script as a script to use in place of the default server messages.

Returns:
The redirect URL.
See also:
\URL{http://hoohoo.ncsa.uiuc.edu/docs/setup/srm/ErrorDocument.html}

Definition at line 432 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getReferrer   const [inline]
 

Get the URL of the page which called this CGI application.

Depending on the HTTP server software, this value may not be set.

Returns:
The URI which called this application.

Definition at line 315 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRemoteAddr   const [inline]
 

Get the IP address of the remote machine making this request.

This is a standard IP address of the form 123.123.123.123

Returns:
The remote IP address

Definition at line 343 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRemoteHost   const [inline]
 

Get the hostname of the remote machine making this request.

This may be either an IP address or a hostname

Returns:
The remote host

Definition at line 333 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRemoteIdent   const [inline]
 

Get the remote user name retrieved from the server.

This is only applicable if the server supports RFC 931 identification. This variable should only be used for logging purposes.

Returns:
The remote identification
See also:
RFC 1431 at http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1413.txt

Definition at line 379 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRemoteUser   const [inline]
 

Get the authenticated remote user name.

This is only applicable if the server supports user authentication, and the user has authenticated.

Returns:
The remote username

Definition at line 365 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getRequestMethod   const [inline]
 

Get the request method used for this query.

This is usually one of GET or POST

Returns:
The request method

Definition at line 217 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getScriptName   const [inline]
 

Get the full path to this CGI application.

This is useful for self-referencing URIs

Returns:
The full path of this application

Definition at line 249 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getServerName   const [inline]
 

Get the hostname, DNS name or IP address of the HTTP server.

This is not a URL, for example www.gnu.org (no leading http://)

Returns:
The name of the server

Definition at line 133 of file CgiEnvironment.h.

unsigned long cgicc::CgiEnvironment::getServerPort   const [inline]
 

Get the port number on the server to which this request was sent.

This will usually be 80.

Returns:
The port number

Definition at line 163 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getServerProtocol   const [inline]
 

Get the name and revision of the protocol used for this request.

This is usually HTTP/1.0 or HTTP/1.1

Returns:
The protocol in use

Definition at line 153 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getServerSoftware   const [inline]
 

Get the name and version of the HTTP server software.

For example, Apache/1.3.4

Returns:
The name of the server software

Definition at line 123 of file CgiEnvironment.h.

std:: string cgicc::CgiEnvironment::getUserAgent   const [inline]
 

Get the name of the browser used for this CGI request.

For example Mozilla/5.0 (X11; U; Linux 2.4.0 i686; en-US; 0.8.1) Gecko/20010421

Returns:
The browser name

Definition at line 400 of file CgiEnvironment.h.

void cgicc::CgiEnvironment::restore const std::string &    filename [protected]
 

Implementation of restore, for restoring CGI environments.

This is called internally by Cgicc

Parameters:
filename  The name of the file from which to restore

void cgicc::CgiEnvironment::save const std::string &    filename const [protected]
 

Implementation of save, for saving CGI environments.

This is called internally by Cgicc

Parameters:
filename  The name of the file to which to save

bool cgicc::CgiEnvironment::usingHTTPS   const [inline]
 

Determine if this is a secure request.

A secure request is usually made using SSL via HTTPS

Returns:
true if this connection is via https, false otherwise

Definition at line 173 of file CgiEnvironment.h.


The documentation for this class was generated from the following file:
GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2002 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Sun Mar 17 16:40:58 2002 for cgicc by doxygen 1.2.13.1