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



  • Hi, all

    I have spent couple of week on this problem, i did not reach any solution. can you suggest me how we can solve this problem and sent me reply as soon as possible, below code i am using

    @
    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';
    }
    

    }
    @

    [edit: added missing coding tags @ SGaist]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.