本文整理汇总了C++中AbstractQoreNode::getAsInt方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractQoreNode::getAsInt方法的具体用法?C++ AbstractQoreNode::getAsInt怎么用?C++ AbstractQoreNode::getAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractQoreNode
的用法示例。
在下文中一共展示了AbstractQoreNode::getAsInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendMessageAndGetResponse
QoreHashNode* qore_httpclient_priv::sendMessageAndGetResponse(const char* meth, const char* mpath, const QoreHashNode& nh, const void* data, unsigned size, const ResolvedCallReferenceNode* send_callback, QoreHashNode* info, bool with_connect, int timeout_ms, int& code, bool& aborted, ExceptionSink* xsink) {
QoreString pathstr(msock->socket->getEncoding());
const char* msgpath = with_connect ? mpath : getMsgPath(mpath, pathstr);
if (!connected) {
if (persistent) {
xsink->raiseException("PERSISTENCE-ERROR", "the current connection has been temporarily marked as persistent, but has been disconnected");
return 0;
}
if (connect_unlocked(xsink)) {
// if we have an info hash then write the request-uri key for reporting/logging purposes
if (info)
info->setKeyValue("request-uri", new QoreStringNodeMaker("%s %s HTTP/%s", meth, msgpath && msgpath[0] ? msgpath : "/", http11 ? "1.1" : "1.0"), 0);
return 0;
}
}
// send the message
int rc = msock->socket->priv->sendHttpMessage(xsink, info, meth, msgpath, http11 ? "1.1" : "1.0", &nh, data, size, send_callback, QORE_SOURCE_HTTPCLIENT, timeout_ms, &msock->m, &aborted);
//sendHTTPMessage(xsink, info, meth, msgpath, http11 ? "1.1" : "1.0", &nh, data, size, QORE_SOURCE_HTTPCLIENT, timeout_ms);
if (rc) {
assert(*xsink);
if (rc == QSE_NOT_OPEN)
disconnect_unlocked();
return 0;
}
QoreHashNode* ah = 0;
while (true) {
ReferenceHolder<QoreHashNode> ans(msock->socket->readHTTPHeader(xsink, info, timeout, QORE_SOURCE_HTTPCLIENT), xsink);
if (!(*ans)) {
disconnect_unlocked();
assert(*xsink);
return 0;
}
// check HTTP status code
AbstractQoreNode* v = ans->getKeyValue("status_code");
if (!v) {
xsink->raiseException("HTTP-CLIENT-RECEIVE-ERROR", "no HTTP status code received in response");
return 0;
}
code = v->getAsInt();
// continue processing if "100 Continue" response received (ignore this response)
if (code == 100)
continue;
ah = ans.release();
break;
}
return ah;
}