Skip to content

Instantly share code, notes, and snippets.

@whalebot-helmsman
Created June 17, 2013 23:08
Show Gist options
  • Save whalebot-helmsman/5801307 to your computer and use it in GitHub Desktop.
Save whalebot-helmsman/5801307 to your computer and use it in GitHub Desktop.
int gFetch( ne_request* request
, const std::string& filePath
, const CWebSpiderOptions& options
, CHttpResponse& response )
{
//checking input params
if (0 == request) {
return kNonHttpError;
}
//working
if ((NE_OK != requestResult) and (NE_REDIRECT != requestResult)) {
if(0 == ne_end_request(request)) {
ne_request_destroy(request);
}
return httpStatusCode;
}
//working
if (true == isFirstReasonToStop) {
if(0 == ne_end_request(request)) {
ne_request_destroy(request);
}
return httpStatusCode;
}
//working
if (true == isSecondReasonToStop) {
if(0 == ne_end_request(request)) {
ne_request_destroy(request);
}
return httpStatusCode;
}
//working
if (true == isThirdReasonToStop) {
//miss free here
return httpStatusCode;
}
//working
if ((not options.m_bSavePages) and (not isBodyForParse)) {
if(0 == ne_end_request(request)) {
ne_request_destroy(request);
}
return httpStatusCode;
}
//working
if (not getBody(request, filePath, response.m_tBody)) {
if(0 == ne_end_request(request)) {
ne_request_destroy(request);
}
return kNonHttpError;
}
return httpStatusCode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment