[Interest] Http Proxy connection woes

Jason Kretzer Jason at gocodigo.com
Mon Apr 6 18:09:00 CEST 2015


So, incorrect credentials will cause a timeout?

Yeah the repeating code was a leftover from when I was checking the proxy at different points.

Anyway, I can remove the signal/slot connect then as long as it is set in the proxy to begin with.
QObject::connect(&socket,SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), this, SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));

Any ideas on what format the credentials should use?
DOMAIN/someUsername
or
DOMAIN\someUsername
or
DOMAIN\\someUsername
or
someIUsername at DOMAIN


-Jason

//------------------------------//
   Jason R. Kretzer
   Lead Application Developer
   Jason at gocodigo.com<mailto:Jason at gocodigo.com>
//-----------------------------//


From: Thiago Macieira <thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>>
To: "interest at qt-project.org<mailto:interest at qt-project.org>" <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] Http Proxy connection woes

On Monday 06 April 2015 07:52:01 Jason Kretzer wrote:
bool ServerCommunication::connectToPort(QString server, int port)
{
     QTcpSocket socket;
     QNetworkProxy proxy = QNetworkProxy::applicationProxy();
     socket.setProxy(proxy);

These two lines are unnecessary. QTcpSocket will use the application proxy by
default.

void ServerCommunication::onProxyAuthenticationRequired(const QNetworkProxy
&p, QAuthenticator *auth) {
     qDebug() << "Calling onProxyAuthenticationRequired method";
     QNetworkProxy proxy = QNetworkProxy::applicationProxy();
     auth->setUser(proxy.user());
     auth->setPassword(proxy.password());
}

Given what the proxy you've set in the first method, you're not adding any new
information here. Your proxy user and/or password are incorrect or missing in
QNetworkProxy::applicationProxy() in the first place.

I am totally at a loss on this.  I have googled this for hours looking for
different ideas.  Would using a QNetworkAccessManager fare any better than
the QTcpSocket?   Am I using the Qauthenticator correctly?  Should I
further increase the timeout?  Do I need to disconnect the SIGNAL from
inside the SLOT to keep it from being called so many times — ie. Is that
resetting the progress and never allowing it to properly authenticate?

Your code is correct, even if it does things it doesn't have to.

The problem is that your authentication credentials are wrong.
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto: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.5751 / Virus Database: 4315/9375 - Release Date: 03/24/15
Internal Virus Database is out of date.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150406/bf492abd/attachment.html>


More information about the Interest mailing list