nikhilm / qhttpserver

HTTP server implementation for Qt based on node.js' http parser

Home Page:http://kodeclutz.blogspot.com/2011/02/qhttpserver-web-apps-in-qt.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I am using QT Creator IDE for develop Cplusplus Rest API using “qhttpserver” http server . We are unable to import “pkcs#12” “.pfx” certificate file

narottam88 opened this issue · comments

Hi, nikhilm
I have spent couple of week on this problem, i did not reach any solution. Actually i am using cross-platform mechanism for develop so Web server and App server run on different port or system.
These below code i am using , but i don't know where i receive request as file multipart "QHttpRequest" request so that i can write file into server directory.

RestMain::RestMain()
{
try {
QHttpServer server = new QHttpServer(this);
connect(server, SIGNAL(newRequest(QHttpRequest
, QHttpResponse_)),
this, SLOT(handleRequest(QHttpRequest_, QHttpResponse_)));
server->listen(QHostAddress::Any, 8080);
} catch (std::exception& e)
{
qDebug() << "Exception:" << e.what() << '\n';
}
}
// request handler mathod
void RestMain::handleRequest(QHttpRequest *req, QHttpResponse *resp)
{
try{
resp->setHeader("Access-Control-Allow-Origin", "_");
resp->setHeader("Access-Control-Allow-Methods", "GET,POST");
resp->setHeader("Access-Control-Allow-Headers", "origin, x-requested-with, content-type");
} catch (std::exception& e)
{
qDebug() << "Exception:" << e.what() << '\n';
}
}