Compile a send a HTML response to the HTTP client. The HTML page content is supplied as a hzChain
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzHttpEvent::SendRawChain | (HttpRC,hzMimetype,hzChain&,uint32_t,bool,) |
Declared in file: hzHttpServer.h
Defined in file : hzHttpServer.cpp
Function Logic:
Function body:
hzEcode hzHttpEvent::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
//
// Arguments: 1) hrc The HTTP return code to appear in the header.
// 2) type The MIME type of HTTP message
// 3) Data The page content
// 4) nExpires The expiry time for the page
// 5) bZip A boolean flag to indicate if the content has been zipped. It sets an indicator in the outgoing header.
//
// Returns: E_ARGUMENT If any of the arguments are invalid
// E_WRITEFAIL If the HTTP response could not be sent to the browser.
// E_OK If the operation was successful.
//
_hzfunc("hzHttpEvent::SendRawChain") ;
hzChain Z ; // For building header
hzEcode rc ; // Return code
rc = _formhead(Z, hrc, type, Data.Size(), nExpires, bZip) ;
if (rc != E_OK)
return hzerr(rc, "Could not formulate HTTP header (sock=%d)", m_pCx->CliSocket()) ;
// Z << Data ;
if (m_pCx->SendData(Z, Data) != E_OK)
{
hzerr(E_WRITEFAIL, "Event %p Failed to send response (size=%d + %d, sock=%d)", this, Z.Size(), Data.Size(), m_pCx->CliSocket()) ;
return E_WRITEFAIL ;
}
return E_OK ;
}