urlhttprequest Class Reference

Inherits httprequest.

## Public Member Functions

| urlhttprequest (httpserverapi *sapi)
void | dumpVariables ()
const char * | application ()
const char * | applicationPath ()
const char * | applicationUrl ()
const char * | program ()
const char * | programPath ()
const char * | programUrl ()
const char * | skin ()
const char * | skinPath ()
const char * | skinUrl ()
const char * | module ()
const char * | modulePath ()
const char * | moduleUrl ()
const char * | page ()
const char * | pagePath ()
const char * | pageUrl ()
uint64_t | getUrlVariableCount ()
const char *const * | getUrlVariables ()
const char *const * | getUrlValues ()
const char * | getSkinVariable (const char *name)
uint64_t | getSkinVariableCount ()
const char *const * | getSkinVariables ()
const char *const * | getSkinValues ()
bool | setSkinVariable (const char *name, const char *value)
virtual bool | methodAllowed ()
virtual bool | ipAllowed ()
virtual bool | refererAllowed ()
Public Member Functions inherited from httprequest
| httprequest (httpserverapi *sapi)
const char * | getEnvironmentVariable (const char *name)
uint64_t | getEnvironmentVariableCount ()
const char *const * | getEnvironmentVariables ()
const char *const * | getEnvironmentValues ()
bool | setEnvironmentVariable (const char *name, const char *value)
void | dumpEnvironment ()
const char * | getParameter (const char *name)
void | getParametersAsGetString (output *container, const char *const *exceptions)
void | getParametersAsHiddenVariables (output *container, const char *const *excepcions)
uint64_t | getParameterCount ()
const char *const * | getParameterVariables ()
const char *const * | getParameterValues ()
bool | setParameter (const char *name, const char *value)
const char * | getFileParameterFilename (const char *name)
const char * | getFileParameterTempFilename (const char *name)
const char * | getFileParameterMimeType (const char *name)
uint64_t | getFileCount ()
const char *const * | getFileNames ()
bool | setFileParameter (const char *name, const char *filename, const char *tempfilename, const char *mimetype)
void | removeTempFiles ()
const char * | getCookie (const char *name)
uint64_t | getCookieCount ()
const char *const * | getCookieVariables ()
const char *const * | getCookieValues ()
bool | setCookie (const char *name, const char *value)
uint64_t | getAllVariableCount ()
const char *const * | getAllVariables ()
const char *const * | getAllValues ()
virtual bool | methodAllowed (const char *deniedmethods, const char *allowedmethods)
virtual bool | ipAllowed (const char *deniedips, const char *allowedips)
virtual bool | refererAllowed (const char *deniedreferers, const char *allowedreferers)
bool | requiredParameters (parameterrequirement **pr)

## Detailed Description

The urlhttprequest class extends httprequest, parsing the url and providing methods for accessing its components.

The SCRIPT_NAME part of the url is parsed as follows:

    DOCUMENT_ROOT/"application"/"program".cgi

    ("application" may span multiple directories)

The PATH_INFO part url is parsed as follows:

    /"skin"/"module"/"page".html

    ("module" may span multiple directories)

The following directories are presumed to exist:

    DOCUMENT_ROOT/"application"/"skin"/"module"

These directories are searched for XML files with .var extensions, formatted as follows:

        <skin>
        <var name="...name...">...value...</var>
        </skin>

These are parsed into "skin variables". Skin variables defined in deeper level .var files override skin variables defined in shallower files.

## Member Function Documentation

## application()

const char* urlhttprequest::application | ( |  | ) |

Returns the "application" part of the SCRIPT_NAME environment variable. SCRIPT_NAME is assumed to be constructed as follows: DOCUMENT_ROOT/"application"/"program".cgi

## applicationPath()

const char* urlhttprequest::applicationPath | ( |  | ) |

Returns the location in the filesystem corresponding to the "application" part of the SCRIPT_NAME environment variable. SCRIPT_NAME is assumed to be constructed as follows: DOCUMENT_ROOT/"application"/"program".cgi

## applicationUrl()

const char* urlhttprequest::applicationUrl | ( |  | ) |

Returns a URL corresponding to the "application" part of the SCRIPT_NAME environment variable. SCRIPT_NAME is assumed to be constructed as follows: DOCUMENT_ROOT/"application"/"program".cgi

## dumpVariables()

void urlhttprequest::dumpVariables | ( |  | ) |

virtual

Dumps all environment variable, parameters, file parameter, cookies, skin variables, and url variables to the browser.

Reimplemented from httprequest.

## getSkinValues()

const char* const* urlhttprequest::getSkinValues | ( |  | ) |

Returns a null terminated list of values corresponding to the variables returned from getSkinVariables().

## getSkinVariable()

const char* urlhttprequest::getSkinVariable | ( | const char * | name | ) |

Returns the value of skin variable "name".

## getSkinVariableCount()

uint64_t urlhttprequest::getSkinVariableCount | ( |  | ) |

Returns the number of skin variables.

## getSkinVariables()

const char* const* urlhttprequest::getSkinVariables | ( |  | ) |

Returns a null terminated list of skin variables. The order of the list is the order the variables were received in.

## getUrlValues()

const char* const* urlhttprequest::getUrlValues | ( |  | ) |

Returns a null terminated list of values corresponding to the variables returned from getUrlVariables().

## getUrlVariableCount()

uint64_t urlhttprequest::getUrlVariableCount | ( |  | ) |

Returns the number of URL variables.

## getUrlVariables()

const char* const* urlhttprequest::getUrlVariables | ( |  | ) |

Returns a null terminated list of URL variables.

## ipAllowed()

virtual bool urlhttprequest::ipAllowed | ( |  | ) |

virtual

Matches the REMOTE_ADDR environment variable against the "denied-ips" and "allowed-ips" skin variables (in that order) using regular expression syntax to determine whether the client's IP address is allowed to access this cgi.

This method may be overriden to provide customized ip-based security.

## methodAllowed()

virtual bool urlhttprequest::methodAllowed | ( |  | ) |

virtual

Matches the REQUEST_METHOD environment variable against the "denied-methods" and "allowed-methods" skin variables (in that order) using regular expression syntax to determine whether the client's IP address is allowed to access this cgi.

This method may be overriden to provide customized ip-based security.

## module()

const char* urlhttprequest::module | ( |  | ) |

Returns the "module" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## modulePath()

const char* urlhttprequest::modulePath | ( |  | ) |

Returns the location in the filesystem corresponding to the "module" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## moduleUrl()

const char* urlhttprequest::moduleUrl | ( |  | ) |

Returns a URL corresponding to the "module" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## page()

const char* urlhttprequest::page | ( |  | ) |

Returns the "page" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## pagePath()

const char* urlhttprequest::pagePath | ( |  | ) |

Returns the location in the filesystem corresponding to the "page" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## pageUrl()

const char* urlhttprequest::pageUrl | ( |  | ) |

Returns a URL corresponding to the "path" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## program()

const char* urlhttprequest::program | ( |  | ) |

Returns the "program" part of the SCRIPT_NAME environment variable. SCRIPT_NAME is assumed to be constructed as follows: DOCUMENT_ROOT/"application"/"program".cgi

## programPath()

const char* urlhttprequest::programPath | ( |  | ) |

Returns the location in the filesystem corresponding to the "program" part of the SCRIPT_NAME environment variable. SCRIPT_NAME is assumed to be constructed as follows: DOCUMENT_ROOT/"application"/"program".cgi

## programUrl()

const char* urlhttprequest::programUrl | ( |  | ) |

Returns a URL corresponding to the "program" part of the SCRIPT_NAME environment variable. SCRIPT_NAME is assumed to be constructed as follows: DOCUMENT_ROOT/"application"/"program".cgi

## refererAllowed()

virtual bool urlhttprequest::refererAllowed | ( |  | ) |

virtual

Matches the HTTP_REFERER environment variable against the "denied-referers" and "allowed-referers" skin variables (in that order) using regular expression syntax to determine whether the client's IP address is allowed to access this cgi.

This method may be overriden to provide customized referer-based security.

## setSkinVariable()

bool urlhttprequest::setSkinVariable | ( | const char * | name,
|  | const char * | value
| ) |  |

Creates a new skin variable with name "name" and value "value" or updates an existing skin variable "name" to have value "value".

## skin()

const char* urlhttprequest::skin | ( |  | ) |

Returns the "skin" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## skinPath()

const char* urlhttprequest::skinPath | ( |  | ) |

Returns the location in the filesystem corresponding to the "skin" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html

## skinUrl()

const char* urlhttprequest::skinUrl | ( |  | ) |

Returns a URL corresponding to the "skin" part of the PATH_INFO environment variable. PATH_INFO is assumed to be constructed as follows: /"skin"/"module"/"page".html