[Interest] Proxy Ports and GET requests

Jason Kretzer Jason at gocodigo.com
Mon Dec 15 18:52:49 CET 2014


Hello all,

I have some software that is running behind a proxy server and the policy there is that all HTTP/HTTPS traffic should go through the proxy port 8080.  

The software needs to be able to perform a GET to a url to get some JSON.  Here is a sample of the GET code.  The url already has “setPort(8080)” called on it before it gets to this function.

Will this work as I think it would?  I do not have access to update the software to test.

executeGET(QUrl url)
{
    QNetworkReply* reply = _manager->get(QNetworkRequest(url));
    qDebug() << "EXECUTEGET -- " << url.toDisplayString();
    // Wait for the manager get function to finish
    QEventLoop loop;
    connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
    if(!reply->isFinished())
        loop.exec();
    QByteArray bytearray = reply->readAll();
    //error checking removed for brevity//
    return QJsonDocument::fromJson(bytearray);
}

Thanks!

-Jason


//------------------------------//
   Jason R. Kretzer
   Lead Application Developer
   Jason at gocodigo.com
   C:606.792.0079
   H:606.297.2551
//-----------------------------//



More information about the Interest mailing list