Send a temporary redirection to the browser
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzHttpEvent::Redirect | (hzUrl&,uint32_t,bool,) |
Declared in file: hzHttpServer.h
Defined in file : hzHttpServer.cpp
Function Logic:
Function body:
hzEcode hzHttpEvent::Redirect (hzUrl& url)uint32_t nExpires, bool bZip,
{
// Send a temporary redirection to the browser
//
// Arguments: 1) url The redirection URL
// 2) nExpires Expire time for page (for browser use only)
// 3) bZip Flag to indicate if the content is to be zipped
//
// Returns: E_WRITEFAIL If the error message could not be sent
// E_OK If the operation was successful.
_hzfunc("hzHttpEvent::Redirect") ;
hzChain Z ; // Output chain
m_Redirect = url ;
Z << "<html>\n<head>\n<title>Moved</title>\n" ;
Z << "</head>\n<body>\n<h1>Moved</h1>\n" ;
Z.Printf("<p>You are being redirected. Please <a href=\"%s\">click here</a></p>\n", *url) ;
Z << "</body>\n</html>\n" ;
if (SendRawChain(HTTPMSG_FOUND_GOTO, HMTYPE_TXT_HTML, Z, nExpires, bZip) != E_OK)
{
hzerr(E_WRITEFAIL, "Response data not sent (size=%d, sock=%d)", Z.Size(), m_pCx->CliSocket()) ;
return E_WRITEFAIL ;
}
return E_OK ;
}