本文整理汇总了C++中BinaryNode::deref方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryNode::deref方法的具体用法?C++ BinaryNode::deref怎么用?C++ BinaryNode::deref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryNode
的用法示例。
在下文中一共展示了BinaryNode::deref方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_internal
//.........这里部分代码省略.........
nah = msock->socket->priv->readHttpChunkedBody(timeout_ms, xsink, QORE_SOURCE_HTTPCLIENT);
}
if (cb_queue)
do_event(cb_queue, msock->socket->getObjectIDForEvents(), QORE_EVENT_HTTP_CHUNKED_END);
if (!nah && !recv_callback) {
if (!msock->socket->isOpen())
disconnect_unlocked();
return 0;
}
if (info) {
info->setKeyValue("chunked", &True, xsink);
if (*xsink)
return 0;
}
if (!recv_callback) {
body = nah->takeKeyValue("body");
ans->merge(*nah, xsink);
}
}
else if (getbody || len) {
if (content_encoding) {
SimpleRefHolder<BinaryNode> bobj(msock->socket->recvBinary(len, timeout_ms, xsink));
if (!(*xsink) && bobj)
body = bobj.release();
}
else {
QoreStringNodeHolder bstr(msock->socket->recv(len, timeout_ms, xsink));
if (!(*xsink) && bstr)
body = bstr.release();
}
if (*xsink && !msock->socket->isOpen())
disconnect_unlocked();
//printf("body=%p\n", body);
}
}
// check for connection: close header
if (!keep_alive)
disconnect_unlocked();
else {
const char* conn = get_string_header(xsink, **ans, "connection", true);
if (*xsink) {
disconnect_unlocked();
return 0;
}
if (conn && !strcasecmp(conn, "close"))
disconnect_unlocked();
}
sl.unlock();
// for content-encoding processing we can run unlocked
// add body to result hash and process content encoding if necessary
if (body) {
if (content_encoding) {
if (!dec) {
if (!recv_callback) {
xsink->raiseException("HTTP-CLIENT-RECEIVE-ERROR", "don't know how to handle content-encoding '%s'", content_encoding);
ans = 0;
}
}
else {
BinaryNode* bobj = reinterpret_cast<BinaryNode*>(body);
QoreStringNode* str = dec(bobj, msock->socket->getEncoding(), xsink);
bobj->deref();
body = str;
}
}
if (body) {
// send data to recv_callback (already unlocked)
if (recv_callback) {
ReferenceHolder<> bh(body, xsink);
if (msock->socket->priv->runDataCallback(xsink, mname, *recv_callback, 0, body, false)
|| msock->socket->priv->runHeaderCallback(xsink, mname, *recv_callback, 0, 0, send_aborted, obj))
return 0;
}
else
ans->setKeyValue("body", body, xsink);
}
}
// do not throw an exception if a receive callback is used
if (!recv_callback && !*xsink && (code < 100 || code >= 300)) {
const char* mess = get_string_header(xsink, **ans, "status_message");
if (!mess)
mess = "<no message>";
assert(!*xsink);
xsink->raiseExceptionArg("HTTP-CLIENT-RECEIVE-ERROR", ans.release(), "HTTP status code %d received: message: %s", code, mess);
return 0;
}
return *xsink || recv_callback ? 0 : ans.release();
}