[Interest] Proxy Ports and GET requests

Jason Kretzer Jason at gocodigo.com
Mon Dec 15 21:08:16 CET 2014


Thank you.  I see now.  The proxy and proxy port information is in the QNetworkProxy object and is passed to the QNetworkAccessManager which handles all the proxy stuff.  The function itself does not need to know about any of that.

-Jason

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

> On Dec 15, 2014, at 2:36 PM, Thiago Macieira <thiago.macieira at intel.com> wrote:
> 
> On Monday 15 December 2014 09:52:49 Jason Kretzer wrote:
>> 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.
> 
> No. You need to update the software.
> 
> The GET request sent to a proxy server is slightly different than the GET 
> request sent to the content server. You need to set the content URL in the 
> request and you need to setProxy or setProxyFactory in your manager.
> 
>> 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!
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.5577 / Virus Database: 4235/8728 - Release Date: 12/13/14



More information about the Interest mailing list