使用JQHttpServer接收http数据
在网上下载源码后,添加信号readReady
void JQHttpServer::AbstractManage::handleAccepted(const QPointer<Session> &session)
{
QtConcurrent::run(handleThreadPool_.data(), [ this, session ]() {
Session *a = qobject_cast<Session *>(session);
if (a != nullptr) {
emit readReady(a->requestUrl(), a->requestBody());
}
if (!this->httpAcceptedCallback_) {
qDebug() << "JQHttpServer::Manage::handleAccepted: error, httpAcceptedCallback_ is nullptr";
return;
}
this->httpAcceptedCallback_(session);
});
}
外部调用, 在onReadReady处理数据
m_httpServer = new JQHttpServer::TcpServerManage(2);
connect(m_httpServer, &JQHttpServer::TcpServerManage::readReady, this, &GitlabServer::onReadReady);