Re: [Interest] Http Proxy connection woes

2015-04-06 Thread Jason Kretzer
And here was a response and then my response.

I have Vimal checking his username/password.  He has not got back with me today.

-Jason

//--//
   Jason R. Kretzer
   Lead Application Developer
   ja...@gocodigo.commailto:ja...@gocodigo.com
//-//


From: Jason R. Kretzer ja...@gocodigo.commailto:ja...@gocodigo.com
To: Thiago Macieira 
thiago.macie...@intel.commailto:thiago.macie...@intel.com, 
interest@qt-project.orgmailto:interest@qt-project.org 
interest@qt-project.orgmailto:interest@qt-project.org
Subject: Re: [Interest] Http Proxy connection woes

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@DOMAIN


-Jason

//--//
   Jason R. Kretzer
   Lead Application Developer
   ja...@gocodigo.commailto:ja...@gocodigo.com
//-//


From: Thiago Macieira 
thiago.macie...@intel.commailto:thiago.macie...@intel.com
To: interest@qt-project.orgmailto:interest@qt-project.org 
interest@qt-project.orgmailto:interest@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@qt-project.orgmailto:Interest@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.


No virus found in this message.
Checked by AVG - www.avg.comhttp://www.avg.com
Version: 2015.0.5751 / Virus Database: 4315/9375 - Release Date: 03/24/15
Internal Virus Database is out of date.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Http Proxy connection woes

2015-04-06 Thread Thiago Macieira
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@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Http Proxy connection woes

2015-04-06 Thread Jason Kretzer
Still trying to figure this out.

Here is the code again.  I have distilled this down quite a bit trying to 
figure it out and here is the code that I am currently using.

In main:
QNetworkProxyFactory::setUseSystemConfiguration(true);
QNetworkProxy proxy = QNetworkProxy::applicationProxy();
proxy.setUser(uname);
proxy.setPassword(pw);

Then I call:
bool hasAccess = 
ServerCommunication().connectToPort(“http://www.anoutsidesite.com”, 80);
//this returns false


bool ServerCommunication::connectToPort(QString server, int port)
{
QTcpSocket socket;
QNetworkProxy proxy = QNetworkProxy::applicationProxy();
socket.setProxy(proxy);

QObject::connect(socket,SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
 this, SLOT(onProxyAuthenticationRequired(const QNetworkProxy, 
QAuthenticator*)));

socket.connectToHost(server,port);
if(socket.waitForConnected(2)) {
qDebug()  Connect to Host success!;
socket.close();
return true;
}
qDebug()  ConnectToHost Error String:   socket.errorString();
socket.close();
return false;
}

Here is the SLOT from above
void ServerCommunication::onProxyAuthenticationRequired(const QNetworkProxy p, 
QAuthenticator *auth)
{
qDebug()  Calling onProxyAuthenticationRequired method;
QNetworkProxy proxy = QNetworkProxy::applicationProxy();
auth-setUser(proxy.user());
auth-setPassword(proxy.password());
}

I set the timeout to 20seconds on the waitForConnected.
Upon running the above, I get this:
[10:06:29]: DEBUG: Calling onProxyAuthenticationRequired method
[10:06:29]: DEBUG: Calling onProxyAuthenticationRequired method
[10:06:29]: DEBUG: Calling onProxyAuthenticationRequired method

…these repeat for 20 seconds…

[10:06:48]: DEBUG: Calling onProxyAuthenticationRequired method
[10:06:48]: DEBUG: Calling onProxyAuthenticationRequired method
[10:06:49]: DEBUG: Calling onProxyAuthenticationRequired method
[10:06:49]: DEBUG: Calling onProxyAuthenticationRequired method

And finally ends with this.

[10:06:49]: DEBUG: ConnectToHost Error String:  Socket operation timed out

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?

Thoughts?

-Jason

//--//
   Jason R. Kretzer
   Lead Application Developer
   ja...@gocodigo.commailto:ja...@gocodigo.com
//-//


From: Thiago Macieira 
thiago.macie...@intel.commailto:thiago.macie...@intel.com
To: interest@qt-project.orgmailto:interest@qt-project.org 
interest@qt-project.orgmailto:interest@qt-project.org
Subject: Re: [Interest] Http Proxy connection woes

On Tuesday 24 February 2015 13:24:24 Jason Kretzer wrote:
Here is the thing:
I have software that is generally “proxy aware.”  I have it running behind
other proxies and they seem to work.  The software is now running behind
another proxy and I cannot seem to connect to the outside world using it.
Here is the code in main.cpp:
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(hostName);
proxy.setPort(port);
proxy.setUser(uname);
proxy.setPassword(pw);
QNetworkProxy::setApplicationProxy(proxy);
I have validated with the client that it is an HttpProxy.  I have left out
how I get the settings, but they are accurate and in the proper format.
The uname/pw are windows authentication and I tried it with both
“adomain\bob” and “b...@domain.commailto:“b...@domain.com”.

What's the authentication method this proxy server uses? HTTP Basic? Or is it
NTLM?

Anyway, when it runs, this line —  qDebug()  ConnectToHost Error String:
  socket.errorString(); Prints:
DEBUG: ConnectToHost Error String:  Error communicating with HTTP proxy”
Just as an extra piece of information, I also tried it with a SOCKS5
ProxyType and the line printed: DEBUG: ConnectToHost Error String:  Socket
operation timed out
Is there some obvious thing I am missing here?

500 milliseconds may be too short. You may be facing network congestion.
Increase to 10 seconds.
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.orgmailto:Interest@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.5645 / Virus Database: 4293/9166 - Release Date: 02/23/15
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Http Proxy connection woes

2015-04-06 Thread Jason Kretzer
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@DOMAIN


-Jason

//--//
   Jason R. Kretzer
   Lead Application Developer
   ja...@gocodigo.commailto:ja...@gocodigo.com
//-//


From: Thiago Macieira 
thiago.macie...@intel.commailto:thiago.macie...@intel.com
To: interest@qt-project.orgmailto:interest@qt-project.org 
interest@qt-project.orgmailto:interest@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@qt-project.orgmailto:Interest@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.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Http Proxy connection woes

2015-02-25 Thread Jason Kretzer
Authentication is NTLM.  Would I need to modify anything to account for that?

-Jason

//--//
   Jason R. Kretzer
   Lead Application Developer
   ja...@gocodigo.commailto:ja...@gocodigo.com
//-//


From: Thiago Macieira 
thiago.macie...@intel.commailto:thiago.macie...@intel.com
To: interest@qt-project.orgmailto:interest@qt-project.org 
interest@qt-project.orgmailto:interest@qt-project.org
Subject: Re: [Interest] Http Proxy connection woes

On Tuesday 24 February 2015 13:24:24 Jason Kretzer wrote:
Here is the thing:
I have software that is generally “proxy aware.”  I have it running behind
other proxies and they seem to work.  The software is now running behind
another proxy and I cannot seem to connect to the outside world using it.
Here is the code in main.cpp:
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(hostName);
proxy.setPort(port);
proxy.setUser(uname);
proxy.setPassword(pw);
QNetworkProxy::setApplicationProxy(proxy);
I have validated with the client that it is an HttpProxy.  I have left out
how I get the settings, but they are accurate and in the proper format.
The uname/pw are windows authentication and I tried it with both
“adomain\bob” and “b...@domain.commailto:“b...@domain.com”.

What's the authentication method this proxy server uses? HTTP Basic? Or is it
NTLM?

Anyway, when it runs, this line —  qDebug()  ConnectToHost Error String:
  socket.errorString(); Prints:
DEBUG: ConnectToHost Error String:  Error communicating with HTTP proxy”
Just as an extra piece of information, I also tried it with a SOCKS5
ProxyType and the line printed: DEBUG: ConnectToHost Error String:  Socket
operation timed out
Is there some obvious thing I am missing here?

500 milliseconds may be too short. You may be facing network congestion.
Increase to 10 seconds.
--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.orgmailto:Interest@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.5645 / Virus Database: 4293/9166 - Release Date: 02/23/15
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Http Proxy connection woes

2015-02-25 Thread Thiago Macieira
On Wednesday 25 February 2015 05:27:57 Jason Kretzer wrote:
 Authentication is NTLM.  Would I need to modify anything to account for
 that?

Yes. Make sure your timeouts are big, since NTLM requires that you connect to 
the proxy, send the request, disconnect, connect again, send the request, 
receive the reply, then send the request again.

Personal opinion: proxy servers requiring NTLM should be shot.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Http Proxy connection woes

2015-02-24 Thread Thiago Macieira
On Tuesday 24 February 2015 13:24:24 Jason Kretzer wrote:
 Here is the thing:
 
 I have software that is generally “proxy aware.”  I have it running behind
 other proxies and they seem to work.  The software is now running behind
 another proxy and I cannot seem to connect to the outside world using it.
 
 Here is the code in main.cpp:
 QNetworkProxy proxy;
 proxy.setType(QNetworkProxy::HttpProxy);
 proxy.setHostName(hostName);
 proxy.setPort(port);
 proxy.setUser(uname);
 proxy.setPassword(pw);
 QNetworkProxy::setApplicationProxy(proxy);
 
 I have validated with the client that it is an HttpProxy.  I have left out
 how I get the settings, but they are accurate and in the proper format. 
 The uname/pw are windows authentication and I tried it with both
 “adomain\bob” and “b...@domain.com”.

What's the authentication method this proxy server uses? HTTP Basic? Or is it 
NTLM?

 Anyway, when it runs, this line —  qDebug()  ConnectToHost Error String:
   socket.errorString(); Prints:
 DEBUG: ConnectToHost Error String:  Error communicating with HTTP proxy”
 
 
 Just as an extra piece of information, I also tried it with a SOCKS5
 ProxyType and the line printed: DEBUG: ConnectToHost Error String:  Socket
 operation timed out
 
 Is there some obvious thing I am missing here?

500 milliseconds may be too short. You may be facing network congestion. 
Increase to 10 seconds.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest