Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. 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

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

Scheduled Pinned Locked Moved C++ Gurus
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Narottam
    wrote on last edited by
    #1

    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]

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved