本文整理汇总了C++中HTTPResponse::getContent方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPResponse::getContent方法的具体用法?C++ HTTPResponse::getContent怎么用?C++ HTTPResponse::getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPResponse
的用法示例。
在下文中一共展示了HTTPResponse::getContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkResponse
/// checks the validity of the HTTP response
void checkResponse(const HTTPResponse& http_response)
{
BOOST_REQUIRE(http_response.getStatusCode() == 200);
BOOST_CHECK(! http_response.hasHeader(HTTPTypes::HEADER_CONTENT_LENGTH));
BOOST_REQUIRE(http_response.getContentLength() == BIG_BUF_SIZE);
BOOST_CHECK_EQUAL(memcmp(http_response.getContent(), m_big_buf, BIG_BUF_SIZE), 0);
}
示例2: LogInfo
Node *Parser::parse(uHTTP::URL *url) {
LogInfo("parse,TID(0x%04x): %s\n", GetCurrentThreadId(), url->getSting());
HTTPRequest httpReq;
HTTPResponse *httpRes = NULL;
{
FUNCTION_BLOCK_NAME_TRACE("post", 100);
const char *host = url->getHost();
int port = url->getPort();
std::string target = url->getTarget();
httpReq.setMethod(HTTP::GET);
httpReq.setURI(target);
httpRes = httpReq.post(host, port);
if (httpRes->isSuccessful() == false){
return NULL;
}
}
Node* pNode = NULL;
{
FUNCTION_BLOCK_NAME_TRACE("ParseContent", 100);
const char *contents = httpRes->getContent();
pNode = parse(contents);
}
return pNode;
}
示例3: parse
Node *Parser::parse(uHTTP::URL *url)
{
const char *host = url->getHost();
int port = url->getPort();
const char *uri = url->getPath();
HTTPRequest httpReq;
httpReq.setMethod(HTTP::GET);
httpReq.setURI(uri);
HTTPResponse *httpRes = httpReq.post(host, port);
if (httpRes->isSuccessful() == false)
return NULL;
const char *contents = httpRes->getContent();
return parse(contents);
}