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
Public Methods:
| hzString | Auth | (void) | |
| void | Clear | (void) | |
| uint32_t | CliSocket | (void) | |
| hzIpaddr | ClientIP | (void) | |
| uint32_t | Connection | (void) | |
| hzSysID | Cookie | (void) | |
| hzSDate | CookieExpire | (void) | |
| void | DelSessCookie | (hzSysID& Cookie) | |
| const char* | ETag | (void) | |
| uint32_t | EventNo | (void) | |
| uint32_t | ExpectSize | (void) | |
| hzEcode | GetAt | (hzPair& P)uint32_t nIndex, | |
| hzIpConnex* | GetConnex | (void) | |
| const char* | GetFragment | (void) | |
| hzLogger* | GetLogger | (void) | |
| const char* | GetResource | (void) | |
| HttpRC | GetRetCode | (void) | |
| hzEcode | GetVar | (hzChain& Z)hzString& name, | Append the supplied chain assumed to be HTML output, with the value found in the variable of the supplied name |
| hzChain | GetVarChain | (hzString& name) | |
| hzString | GetVarStr | (hzString& name) | |
| bool | HdrComplete | (void) | |
| uint32_t | HeaderLen | (void) | |
| const char* | Hostname | (void) | |
| uint32_t | Inputs | (void) | |
| HttpMethod | Method | (void) | |
| bool | MsgComplete | (void) | |
| hzEcode | ProcessEvent | (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_t | QueryLen | (void) | |
| hzEcode | Redirect | (hzUrl& url)uint32_t nExpires, bool bZip, | Send a temporary redirection to the browser |
| hzString | Referer | (void) | |
| hzEcode | SendAjaxResult | (HttpRC hrc) | Send a HTTP response code only. Note: This function should only be invoked in response to AJAX HTTP requests |
| hzEcode | SendAjaxResult | (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 |
| hzEcode | SendAjaxResult | (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 |
| hzEcode | SendError | (HttpRC hrc)const char* va_alist, | Purpose: Send a general error message to browser |
| hzEcode | SendFileHead | (const char* cpDir)const char* cpFilename, uint32_t nExpires, | Sends a HTML or other file to the browser |
| hzEcode | SendFilePage | (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. |
| hzEcode | SendHttpHead | (hzString& fixContent)hzMimetype type, uint32_t nExpires, | |
| hzEcode | SendHttpHead | (hzChain& fixContent)hzMimetype type, uint32_t nExpires, | |
| hzEcode | SendNotFound | (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. |
| hzEcode | SendPageE | (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. |
| hzEcode | SendRawChain | (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 |
| hzEcode | SendRawString | (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) | |
| hzEcode | SetHdr | (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. |
| void | SetLogger | (hzLogger* pLog) | |
| void | SetPermCookie | (hzSysID& Cookie)hzSDate& expires, | Set a new cookie and expire any old. Returns: None |
| void | SetRetCode | (HttpRC RetCode) | |
| void | SetSessCookie | (hzSysID& Cookie) | Set a new cookie and expire any old. Returns: None |
| void | SetSession | (hzHttpSession* pSession) | |
| void | SetURI | (const char* cpURI) | |
| hzEcode | SetVarChain | (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. |
| hzEcode | SetVarString | (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. |
| hzEcode | Storeform | (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) | |
| bool | Zipped | (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:
| hzString | m_Auth | Basic authorization | |
| hzIpaddr | m_ClientIP | This is either copied from the connection or if apache proxypass is in use, then it is set by an X-param | |
| hzSDate | m_CookieExpire | Expiry date (for setting permanent cookies only) | |
| hzSysID | m_CookieNew | New cookie as set by server | |
| hzSysID | m_CookieOld | Redundant cookie from browser | |
| hzSysID | m_CookieSub | Cookie submitted by the browser | |
| hzChain | m_Error | Set during form processing in order to pass error messages to the form response | |
| hzList<hzPair> | m_HdrsResponse | HTTP headers set in the response | |
| hzArray<hzPair> | m_Inputs | Data submissions | |
| hzString | m_LangCode | Page Language (in response) | |
| hzXDate | m_LastMod | If last modified directive hzUrl m_Referer ; // Refered from URL. | |
| hzMapS<hzString,uint32_t> | m_ObjIds | Map of caches and objects ids (Dissemino only) | |
| hzXDate | m_Occur | Exact time of hit | |
| hzString | m_Redirect | Directive to browser URI | |
| hzString | m_Referer | Refered from URL. | |
| hzChain | m_Report | Set by function processing the hits | |
| hzString | m_Resarg | Resource argument (dissemino) | |
| hzMapS<hzString,hzHttpFile> | m_Uploads | List of uploaded files | |
| hzString | m_appError | This can be set by the application (eg form submission error) | |
| bool | m_bHdrComplete | False if hit's header incomplete | |
| bool | m_bMsgComplete | False if hit incomplete | |
| bool | m_bZipped | True if Accept-Encoding contains 'gzip' | |
| HttpMethod | m_eMethod | E.g. GET, HEAD or POST | |
| HttpRC | m_eRetCode | HTTP return code | |
| hzMapS<hzString,hzChain> | m_mapChains | Populated by SetVar() function (used in Dissemino) | |
| hzMapS<hzString,hzString> | m_mapStrings | Populated by form submission (POST) events but also by SetVar() calls by the application | |
| uint32_t | m_nConnection | Positive value for keep-alive (no of seconds to live), 0 for close | |
| uint32_t | m_nContentLen | Actual length of the form data | |
| uint32_t | m_nCountry | Country code | |
| uint32_t | m_nHeaderLen | Actual length of header | |
| uint32_t | m_nMaxForwards | Max forwards | |
| uint32_t | m_nQueryLen | Query length | |
| uint32_t | m_nVersion | HTTP/1.0 or whatever. | |
| char* | m_pAccept | Accept mimetype eg text/plain | |
| char* | m_pAcceptCharset | Accept character set | |
| char* | m_pAcceptCode | Encoding | |
| char* | m_pAcceptLang | Language e.g. US English | |
| char* | m_pBuf | Buffer for header values | |
| char* | m_pCacheControl | Cache Control | |
| char* | m_pCliIP | IP From Apache | |
| char* | m_pConnection | Connection directive | |
| char* | m_pContentType | Content Type | |
| void* | m_pContextApp | The applicable Dissemino application (set by the 'Host:' header in the HTTP request) | |
| void* | m_pContextForm | Application specific context. Dissemino current form reference. | |
| void* | m_pContextLang | The applicable language (set by HTTP request processing) | |
| void* | m_pContextObj | Application specific context. Dissemino current object. | |
| hzIpConnex* | m_pCx | Connection to TCP server | |
| char* | m_pETag | Page ID checking | |
| char* | m_pFrom | Email address of person making request (not sure why this is but hey what the heck) | |
| char* | m_pFwrdIP | IP From Apache | |
| char* | m_pHost | The desired hostname | |
| hzLogger* | m_pLog | Log channel (from connection) | |
| char* | m_pPragma | Misc command | |
| char* | m_pProcessor | Type of processor on browser computer | |
| char* | m_pProxIP | IP From Apache | |
| char* | m_pReferer | Email address of person making request (not sure why this is but hey what the heck) | |
| char* | m_pReqFRAG | Request path fragment | |
| char* | m_pReqPATH | Request path | |
| char* | m_pServer | The desired server | |
| hzHttpSession* | m_pSession | HTTP session (set by app) | |
| char* | m_pUserAgent | Type of browser | |
| char* | m_pVia | Some proxy servers send this | |
| char* | m_pXost | The desired hostname |