Rudiments
Public Member Functions | List of all members
urlhttprequest Class Reference

#include <urlhttprequest.h>

Inherits httprequest.

Public Member Functions

 urlhttprequest (httpserverapi *sapi)
 
void writeVariables ()
 
const chargetApplication ()
 
const chargetApplicationPath ()
 
const chargetApplicationUrl ()
 
const chargetProgram ()
 
const chargetProgramPath ()
 
const chargetProgramUrl ()
 
const chargetSkin ()
 
const chargetSkinPath ()
 
const chargetSkinUrl ()
 
const chargetModule ()
 
const chargetModulePath ()
 
const chargetModuleUrl ()
 
const chargetPage ()
 
const chargetPagePath ()
 
const chargetPageUrl ()
 
uint64_t getUrlVariableCount ()
 
const char *constgetUrlVariables ()
 
const char *constgetUrlValues ()
 
const chargetSkinVariable (const char *name)
 
uint64_t getSkinVariableCount ()
 
const char *constgetSkinVariables ()
 
const char *constgetSkinValues ()
 
bool setSkinVariable (const char *name, const char *value)
 
virtual bool getMethodIsAllowed ()
 
virtual bool getIpIsAllowed ()
 
virtual bool getRefererIsAllowed ()
 
- Public Member Functions inherited from httprequest
 httprequest (httpserverapi *sapi)
 
const chargetEnvironmentVariable (const char *name)
 
uint64_t getEnvironmentVariableCount ()
 
const char *constgetEnvironmentVariables ()
 
const char *constgetEnvironmentValues ()
 
bool setEnvironmentVariable (const char *name, const char *value)
 
void writeEnvironment ()
 
const chargetParameter (const char *name)
 
void getParametersAsGetString (output *container, const char *const *exceptions)
 
void getParametersAsHiddenVariables (output *container, const char *const *excepcions)
 
uint64_t getParameterCount ()
 
const char *constgetParameterVariables ()
 
const char *constgetParameterValues ()
 
bool setParameter (const char *name, const char *value)
 
const chargetFileParameterFileName (const char *name)
 
const chargetFileParameterTempFileName (const char *name)
 
const chargetFileParameterMimeType (const char *name)
 
uint64_t getFileCount ()
 
const char *constgetFileNames ()
 
bool setFileParameter (const char *name, const char *filename, const char *tempfilename, const char *mimetype)
 
void removeTempFiles ()
 
const chargetCookie (const char *name)
 
uint64_t getCookieCount ()
 
const char *constgetCookieVariables ()
 
const char *constgetCookieValues ()
 
bool setCookie (const char *name, const char *value)
 
uint64_t getAllVariableCount ()
 
const char *constgetAllVariables ()
 
const char *constgetAllValues ()
 
ssize_t read (byte_t *buffer, size_t size)
 
ssize_t read (char *buffer, size_t length)
 
ssize_t read (char *character)
 
ssize_t read (wchar_t *buffer, size_t length)
 
ssize_t read (wchar_t *character)
 
ssize_t readUcs2 (ucs2_t *buffer, size_t length)
 
ssize_t readUcs2 (ucs2_t *character)
 
ssize_t read (int16_t *number)
 
ssize_t read (int32_t *number)
 
ssize_t read (int64_t *number)
 
ssize_t read (byte_t *character)
 
ssize_t read (uint16_t *number)
 
ssize_t read (uint32_t *number)
 
ssize_t read (uint64_t *number)
 
ssize_t read (float *number)
 
ssize_t read (double *number)
 
virtual bool getMethodIsAllowed (const char *deniedmethods, const char *allowedmethods)
 
virtual bool getContentTypeIsAllowed (const char *deniedcontenttypes, const char *allowedcontenttypes)
 
virtual bool getIpIsAllowed (const char *deniedips, const char *allowedips)
 
virtual bool getRefererIsAllowed (const char *deniedreferers, const char *allowedreferers)
 
bool getRequiredParametersWereProvided (parameterrequirement **pr)
 
- Public Member Functions inherited from input
 input ()
 
virtual ~input ()
 
virtual off64_t setPositionRelativeToBeginning (off64_t offset)
 
virtual off64_t setPositionRelativeToCurrent (off64_t offset)
 
virtual off64_t setPositionRelativeToEnd (off64_t offset)
 
virtual off64_t getPosition ()
 
ssize_t read (char **buffer, const char *terminator)
 
ssize_t read (char **buffer, const char *terminator, size_t maxbytes)
 
virtual ssize_t read (byte_t *buffer, size_t size, int32_t sec, int32_t usec)
 
virtual ssize_t read (char *buffer, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t read (char *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (wchar_t *buffer, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t read (wchar_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t readUcs2 (ucs2_t *buffer, size_t length, int32_t sec, int32_t usec)
 
virtual ssize_t readUcs2 (ucs2_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (int16_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (int32_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (int64_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (byte_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (uint16_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (uint32_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (uint64_t *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (float *buffer, int32_t sec, int32_t usec)
 
virtual ssize_t read (double *buffer, int32_t sec, int32_t usec)
 
ssize_t read (char **buffer, const char *terminator, int32_t sec, int32_t usec)
 
ssize_t read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec)
 
ssize_t read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec)
 
- Public Member Functions inherited from object
virtual ~object ()
 

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

◆ getApplication()

const char * urlhttprequest::getApplication ( )

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

◆ getApplicationPath()

const char * urlhttprequest::getApplicationPath ( )

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

◆ getApplicationUrl()

const char * urlhttprequest::getApplicationUrl ( )

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

◆ getIpIsAllowed()

virtual bool urlhttprequest::getIpIsAllowed ( )
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.

◆ getMethodIsAllowed()

virtual bool urlhttprequest::getMethodIsAllowed ( )
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.

◆ getModule()

const char * urlhttprequest::getModule ( )

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

◆ getModulePath()

const char * urlhttprequest::getModulePath ( )

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

◆ getModuleUrl()

const char * urlhttprequest::getModuleUrl ( )

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

◆ getPage()

const char * urlhttprequest::getPage ( )

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

◆ getPagePath()

const char * urlhttprequest::getPagePath ( )

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

◆ getPageUrl()

const char * urlhttprequest::getPageUrl ( )

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

◆ getProgram()

const char * urlhttprequest::getProgram ( )

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

◆ getProgramPath()

const char * urlhttprequest::getProgramPath ( )

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

◆ getProgramUrl()

const char * urlhttprequest::getProgramUrl ( )

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

◆ getRefererIsAllowed()

virtual bool urlhttprequest::getRefererIsAllowed ( )
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.

◆ getSkin()

const char * urlhttprequest::getSkin ( )

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

◆ getSkinPath()

const char * urlhttprequest::getSkinPath ( )

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

◆ getSkinUrl()

const char * urlhttprequest::getSkinUrl ( )

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

◆ 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.

◆ 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".

◆ writeVariables()

void urlhttprequest::writeVariables ( )
virtual

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

Reimplemented from httprequest.