Defined in file: hzIpServer.h

The hzHttpEvent class is the focal point of a HadronZoo/Dissemino Internet application. All HTTP requests (GET) or submissions (POST) generate and populates a hzHttpEvent instance which initially contains data supplied in the incoming request. Each time this occurs, the hzHttpEvent is passed to a user defined 'callback' function which processes it and generates a response. This process may add further data to the hzHttpEvent which is used to formulate the header for the outgoing HTTP response.

Constructors/Detructors

hzHttpEvent*hzHttpEvent(hzHttpEvent&)
hzHttpEvent*hzHttpEvent(hzChain& ZI)hzIpConnex* pCx,
hzHttpEvent*hzHttpEvent(void)
NULL-TYPEhzHttpEvent(hzChain& ZI)hzIpConnex* pCx,
NULL-TYPEhzHttpEvent(void)
void~hzHttpEvent(void)
NULL-TYPE~hzHttpEvent(void)

Public Methods:

hzStringAuth(void)
voidClear(void)
uint32_tCliSocket(void)
hzIpaddrClientIP(void)
uint32_tConnection(void)
hzSysIDCookie(void)
hzSDateCookieExpire(void)
voidDelSessCookie(hzSysID& Cookie)
const char*ETag(void)
uint32_tEventNo(void)
uint32_tExpectSize(void)
hzEcodeGetAt(hzPair& P)uint32_t nIndex,
hzIpConnex*GetConnex(void)
const char*GetFragment(void)
hzLogger*GetLogger(void)
const char*GetResource(void)
HttpRCGetRetCode(void)
hzEcodeGetVar(hzChain& Z)hzString& name, Append the supplied chain assumed to be HTML output, with the value found in the variable of the supplied name
hzChainGetVarChain(hzString& name)
hzStringGetVarStr(hzString& name)
boolHdrComplete(void)
uint32_tHeaderLen(void)
const char*Hostname(void)
uint32_tInputs(void)
HttpMethodMethod(void)
boolMsgComplete(void)
hzEcodeProcessEvent(hzChain& ZI)Purpose: Process a HTTP event This function is called whenever data comes in from a connected HTTP client. Should the data contain a complete HTTP request, the request is processed.
uint32_tQueryLen(void)
hzEcodeRedirect(hzUrl& url)uint32_t nExpires, bool bZip, Send a temporary redirection to the browser
hzStringReferer(void)
hzEcodeSendAjaxResult(HttpRC hrc)Send a HTTP response code only. Note: This function should only be invoked in response to AJAX HTTP requests
hzEcodeSendAjaxResult(HttpRC hrc)const char* va_alist, Send a string, without headers of any kind, as a response. Note: This function should only be invoked in response to AJAX HTTP requests
hzEcodeSendAjaxResult(HttpRC hrc)hzChain& Z, Send a string, without headers of any kind, as a response. Note: This function should only be invoked in response to AJAX HTTP requests
hzEcodeSendError(HttpRC hrc)const char* va_alist, Purpose: Send a general error message to browser
hzEcodeSendFileHead(const char* cpDir)const char* cpFilename, uint32_t nExpires, Sends a HTML or other file to the browser
hzEcodeSendFilePage(const char* cpDir)const char* cpFilename, uint32_t nExpires, bool bZip, This sends a file assumed to be a whole HTML page. The HTML must not contain a server side include as there is no processing in this function to detect any such construct. The page may of course contain links to other resources as a means to complete rendering by the browser. Note this function does not use OpenInputStrm to open the file as it does not need the error code detail.
hzEcodeSendHttpHead(hzString& fixContent)hzMimetype type, uint32_t nExpires,
hzEcodeSendHttpHead(hzChain& fixContent)hzMimetype type, uint32_t nExpires,
hzEcodeSendNotFound(hzUrl& url)Purpose: Send a 404 not found message to browser. This message will be a default message if the global variable g_WebPageNotFound is not set within an application.
hzEcodeSendPageE(const char* dir)const char* fname, uint32_t nExpires, bool bZip, Purpose: Sends a HTML or other file to the browser but from memory. The first time the file is requested it is loaded into memory and then sent. On subsequent requests it is served from memory. Note this function does not use OpenInputStrm to open the file as it does not need the error code detail.
hzEcodeSendRawChain(HttpRC hrc)hzMimetype type, hzChain& Data, uint32_t nExpires, bool bZip, Compile a send a HTML response to the HTTP client. The HTML page content is supplied as a hzChain
hzEcodeSendRawString(HttpRC hrc)hzMimetype type, hzString& Content, uint32_t nExpires, bool bZip, Compile a send a HTML response to the HTTP client. The HTML page content is supplied as a hzString Note: This function is deprecated. Please use hzHttpEvent::SendRawChain instead
const char*Server(void)
hzHttpSession*Session(void)
hzEcodeSetHdr(hzString& name)hzString& value, Set a variable to be transmitted as a name/value pair in the header of the HTTP response. With suitable JavaScript in the response page or article, this variable can influence what is displayed. This allows a page that is otherwise fixed, to have different manifestations to different users. Normally, the only way to do this is by having the page generated each time it is requested. A fixed content page or article can be pre-zipped so is quicker to serve and consumes less bandwidth.
voidSetLogger(hzLogger* pLog)
voidSetPermCookie(hzSysID& Cookie)hzSDate& expires, Set a new cookie and expire any old. Returns: None
voidSetRetCode(HttpRC RetCode)
voidSetSessCookie(hzSysID& Cookie)Set a new cookie and expire any old. Returns: None
voidSetSession(hzHttpSession* pSession)
voidSetURI(const char* cpURI)
hzEcodeSetVarChain(hzString& name)hzChain& Z, Sets a chain value to the supplied chain and places it in the hzHttpEvent's map of chain values. Note that if there is a string value of the same name, this is not allowed. Note that the hzHttpEvent is very short lived. An instance is populated by a HTTP request, passed to the event handler ProcHTTP(), which processes it to formulate a response. Then one of its member functions is called to write out that response to the client socket. The only purpose in setting a value in the event's m_mapChains member, is to influence the output by means of a percent-entity of the form [%e:var_name;] that is assumed to exist in the page template being served.
hzEcodeSetVarString(hzString& name)hzString& value, Sets a string value to the supplied value and places it in the hzHttpEvent's map of string values. Note that if there is a chain value of the same name, this is not allowed. Note that the hzHttpEvent is very short lived. An instance is populated by a HTTP request, passed to the event handler ProcHTTP(), which processes it to formulate a response. Then one of its member functions is called to write out that response to the client socket. The only purpose in setting a value in the event's m_mapStrings member, is to influence the output by means of a percent-entity of the form [%e:var_name;] that is assumed to exist in the page template being served.
hzEcodeStoreform(const char* cpPath)Appends submitted forms to a file of the supplied pathname. This is quite separate from any processing of the form by the application. This can be convient for diagnostics or even serve as a rudimantry form of backup.
const char*TxtClientIP(void)
const char*TxtFwrdIP(void)
const char*TxtProxIP(void)
const char*UserAgent(void)
boolZipped(void)
hzEcode_formhead(hzChain& Z)HttpRC hrc, hzMimetype mtype, uint32_t nSize, uint32_t nExpires, bool bZip, Formulate HTTP header for outgoing response.
uint32_t_setnvpairs(hzChain::Iter& ci)Gather up the submitted data as a set of name-value pairs. Advance the supplied iterator to the end of the header.

Overloaded operators:

hzHttpEvent&operator=(hzHttpEvent&)

Member Variables:

hzStringm_AuthBasic authorization
hzIpaddrm_ClientIPThis is either copied from the connection or if apache proxypass is in use, then it is set by an X-param
hzSDatem_CookieExpireExpiry date (for setting permanent cookies only)
hzSysIDm_CookieNewNew cookie as set by server
hzSysIDm_CookieOldRedundant cookie from browser
hzSysIDm_CookieSubCookie submitted by the browser
hzChainm_ErrorSet during form processing in order to pass error messages to the form response
hzList<hzPair>m_HdrsResponseHTTP headers set in the response
hzArray<hzPair>m_InputsData submissions
hzStringm_LangCodePage Language (in response)
hzXDatem_LastModIf last modified directive hzUrl m_Referer ; // Refered from URL.
hzMapS<hzString,uint32_t>m_ObjIdsMap of caches and objects ids (Dissemino only)
hzXDatem_OccurExact time of hit
hzStringm_RedirectDirective to browser URI
hzStringm_RefererRefered from URL.
hzChainm_ReportSet by function processing the hits
hzStringm_ResargResource argument (dissemino)
hzMapS<hzString,hzHttpFile>m_UploadsList of uploaded files
hzStringm_appErrorThis can be set by the application (eg form submission error)
boolm_bHdrCompleteFalse if hit's header incomplete
boolm_bMsgCompleteFalse if hit incomplete
boolm_bZippedTrue if Accept-Encoding contains 'gzip'
HttpMethodm_eMethodE.g. GET, HEAD or POST
HttpRCm_eRetCodeHTTP return code
hzMapS<hzString,hzChain>m_mapChainsPopulated by SetVar() function (used in Dissemino)
hzMapS<hzString,hzString>m_mapStringsPopulated by form submission (POST) events but also by SetVar() calls by the application
uint32_tm_nConnectionPositive value for keep-alive (no of seconds to live), 0 for close
uint32_tm_nContentLenActual length of the form data
uint32_tm_nCountryCountry code
uint32_tm_nHeaderLenActual length of header
uint32_tm_nMaxForwardsMax forwards
uint32_tm_nQueryLenQuery length
uint32_tm_nVersionHTTP/1.0 or whatever.
char*m_pAcceptAccept mimetype eg text/plain
char*m_pAcceptCharsetAccept character set
char*m_pAcceptCodeEncoding
char*m_pAcceptLangLanguage e.g. US English
char*m_pBufBuffer for header values
char*m_pCacheControlCache Control
char*m_pCliIPIP From Apache
char*m_pConnectionConnection directive
char*m_pContentTypeContent Type
void*m_pContextAppThe applicable Dissemino application (set by the 'Host:' header in the HTTP request)
void*m_pContextFormApplication specific context. Dissemino current form reference.
void*m_pContextLangThe applicable language (set by HTTP request processing)
void*m_pContextObjApplication specific context. Dissemino current object.
hzIpConnex*m_pCxConnection to TCP server
char*m_pETagPage ID checking
char*m_pFromEmail address of person making request (not sure why this is but hey what the heck)
char*m_pFwrdIPIP From Apache
char*m_pHostThe desired hostname
hzLogger*m_pLogLog channel (from connection)
char*m_pPragmaMisc command
char*m_pProcessorType of processor on browser computer
char*m_pProxIPIP From Apache
char*m_pRefererEmail address of person making request (not sure why this is but hey what the heck)
char*m_pReqFRAGRequest path fragment
char*m_pReqPATHRequest path
char*m_pServerThe desired server
hzHttpSession*m_pSessionHTTP session (set by app)
char*m_pUserAgentType of browser
char*m_pViaSome proxy servers send this
char*m_pXostThe desired hostname