[Qt-interest] NTLMv1 HttpProxy in QT 4.5.3
Sergey
sh0375 at gmail.com
Thu Dec 30 14:23:15 CET 2010
Hello,
I have a program for Windows, written on QT 4.5.3, which connects to
webserver via SSL through http proxy with NTLMv1 authorization (3proxy).
Proxy requires authorization.
QNetworkAccessManager http = new QNetworkAccessManager(this);
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(s_proxyHost);
proxy.setPort(4777);
proxy.setUser(s_login);
proxy.setPassword(s_password);
QNetworkProxy::setApplicationProxy(proxy);
http->setProxy(proxy);
QNetworkRequest request(QUrl("https://website.net:443/update/update.xml"));
m_reply = http->get(request);
void Up::proxyAuthenticationRequired( const QNetworkProxy &proxy,
QAuthenticator *authenticator )
{
if (_requests.contains(m_reply))
{
_requests.clear();
if (!askUserToInputLoginAndPassword(s_login, s_password))
return;
}
authenticator->setUser(s_login);
authenticator->setPassword(s_password);
_requests.insert(m_reply);
}
Earlier this program worked well, but after i rebuilt QT using
absolutely the same parameters on the other machine, and rebuilt program
using this new QT build, it stopped working. Now it asks for login and
password in loop.
This is log of tcp conversation of first working well program:
++++++++++++++++++++++++++++++++++++++++++++
TCP session 1:
===============
Client->Server:
--------------
CONNECT website.net:443 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0
Host: website.net
Server->Client:
--------------
HTTP/1.0 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Proxy-Authenticate: basic realm="proxy"
Proxy-Connection: close
Content-type: text/html; charset=us-ascii
<html><head><title>407 Proxy Authentication Required</title></head>
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested
resource disallowed by administrator or you need valid username/password
to use this resource</h3></body></html>
TCP session 2:
===============
Client->Server:
--------------
CONNECT website.net:443 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0
Host: website.net
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABQIAAAAAAAAAAAAAAAAAAAAAAAA=
Server->Client:
--------------
HTTP/1.0 407 Proxy Authentication Required
Proxy-Connection: keep-alive
Content-Length: 0
Proxy-Authenticate: NTLM
TlRMTVNTUAACAAAABAAEADAAAAADgoGgQUTHikLEN1AAAAAAAAAAAAAAAAAAAAAAUwBMAA==
Client->Server:
--------------
CONNECT website.net:443 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0
Host: website.net
Proxy-Authorization: NTLM
TlRMTVNTUAADAAAAGAAYAFAAAAAYABgAaAAAAAQABABAAAAADAAMAEQAAAAAAAAAUAAAAAAAAAAAAAAAAQIAAFMATABzAGgAMAAzADcANQAGWGlWyy2UI6M6itm1qojUpfy67lPfsR0HdSwzcbbop5sgeJA4zJm0sypuKVo8DuE=
Server->Client:
--------------
HTTP/1.0 200 Connection established
This is log of tcp conversation of new NON-WORKING program build:
++++++++++++++++++++++++++++++++++++++++++++
TCP session 1:
===============
Client->Server:
--------------
CONNECT website.net:443 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0
Host: website.net
Server->Client:
--------------
HTTP/1.0 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Proxy-Authenticate: basic realm="proxy"
Proxy-Connection: close
Content-type: text/html; charset=us-ascii
<html><head><title>407 Proxy Authentication Required</title></head>
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested
resource disallowed by administrator or you need valid username/password
to use this resource</h3></body></html>
TCP session 2:
===============
Client->Server:
--------------
CONNECT website.net:443 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0
Host: website.net
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABQIAAAAAAAAAAAAAAAAAAAAAAAA=
Server->Client:
--------------
HTTP/1.0 407 Proxy Authentication Required
Proxy-Connection: keep-alive
Content-Length: 0
Proxy-Authenticate: NTLM
TlRMTVNTUAACAAAABAAEADAAAAADgoGg6PVfmf89v3oAAAAAAAAAAAAAAAAAAAAAUwBMAA==
Client->Server:
--------------
CONNECT website.net:443 HTTP/1.1
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0
Host: website.net
Proxy-Authorization: NTLM
Server->Client:
--------------
HTTP/1.0 407 Proxy Authentication Required
Proxy-Authenticate: NTLM
Proxy-Authenticate: basic realm="proxy"
Proxy-Connection: close
Content-type: text/html; charset=us-ascii
<html><head><title>407 Proxy Authentication Required</title></head>
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested
resource disallowed by administrator or you need valid username/password
to use this resource</h3></body></html>
+++++++++++++
Now client in second TCP session sends in header just:
"Proxy-Authorization: NTLM"
but earlier it sent:
"Proxy-Authorization: NTLM
TlRMTVNTUAADAAAAGAAYAFAAAAAYABgAaAAAAAQABABAAAAADAAMAEQAAAAAAAAAUAAAAAAAAAAAAAAAAQIAAFMATABzAGgAMAAzADcANQAGWGlWyy2UI6M6itm1qojUpfy67lPfsR0HdSwzcbbop5sgeJA4zJm0sypuKVo8DuE="
Why this happens?
I tried both QHttp and QNetworkAccessManager classes, but both giving
the same bad result - which does not work (second log).
How can i fix it?
Please help! I'm trying to solve this problem during 3 days, rebuilt
QtNetwork dll and lib files, but nothing helps.
--
Thank you!
More information about the Qt-interest-old
mailing list