| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzHttpClient::GetPage | (HttpRC&,const hzUrl&,const hzString&,) |
Declared in file: hzHttpClient.h
Defined in file : hzHttpClient.cpp
Function Logic:
Function body:
hzEcode hzHttpClient::GetPage (HttpRC& hRet, const hzUrl& url, const hzString& etag)
{
_hzfunc("hzHttpClient::GetPage") ;
hzUrl dest ;
hzString dom ;
hzString etag2 ;
hzEcode rc = E_OK ;
m_Error.Clear() ;
m_Error.Printf("GETTING PAGE %s\n", *url) ;
dest = url ;
m_rtRequest = RealtimeNano() ;
rc = _getpage(hRet, dest, etag) ;
m_rtResponse = RealtimeNano() ;
if (rc != E_OK)
{
m_Error.Printf("ABORTED (_getpage failure)\n") ;
return rc ;
}
for (; hRet == HTTPMSG_REDIRECT_PERM || hRet == HTTPMSG_REDIRECT_TEMP ;)
{
if (!m_Redirect)
m_Error.Printf("Oops - no URL to redirect to\n") ;
else
{
if (m_Redirect[0]== CHAR_FWSLASH)
{ dom = dest.Domain() ; dest.SetValue(dom, m_Redirect) ; }
else
dest = m_Redirect ;
m_Error.Printf("redirecting to %s\n", *dest) ;
rc = _getpage(hRet, dest, etag2) ;
if (rc != E_OK)
{
m_Error.Printf("Redirect FAILED (error=%s)\n", Err2Txt(rc)) ;
return rc ;
}
}
}
m_Error.Printf("Got response %d (size %d bytes)\n", hRet, m_Content.Size()) ;
return rc ;
}