[Interest] Qt HTTP access to Exchange

Bo Thorsen bthorsen at ics.com
Thu Nov 28 16:28:02 CET 2013

Here is a simple test application that shows the problem. If I run this 
against a host that doesn't use username domains, I get a request for 
authentication. If I run it against one of the NTLM hosts with 
domain\user for usernames, it just writes finished. It should of course 
ask for authentication.

I have two test hosts for anyone who wants to try and fix this bug. If 
there's something I can do to fix it myself, I'd be very happy to hear 
about it.

I have tested the problem on both 5.1.1 and 4.8.5. Same issue with both. 
Only tested on Windows using binary builds.


Test case:

#include <QCoreApplication>
#include <QNetworkAccessManager>
#include <QNetworkReply>

class Connect : public QObject {
public slots:
     void authRequired() { qDebug("auth required"); }
     void proxyAuthRequired() { qDebug("proxy auth required"); }
     void sslErrors() { qDebug("ssl errors"); }
     void finished() { qDebug("finished"); }

int main(int argc, char *argv[])
     QCoreApplication a(argc, argv);
     QNetworkAccessManager qnam;
     Connect c;
SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), &c, 
SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), &c, 
SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), &c, SLOT(sslErrors()));
     QObject::connect(&qnam, SIGNAL(finished(QNetworkReply*)), &c, 
     QNetworkRequest request(QUrl("https://host/EWS/Exchange.asmx"));
     request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml; 
     qnam.post(request, QByteArray());
     return a.exec();

#include "main.moc"

Den 28-11-2013 11:28, Bo Thorsen skrev:
> Den 27-11-2013 17:40, Thiago Macieira skrev:
>> On quarta-feira, 27 de novembro de 2013 17:39:35, Mandeep Sandhu wrote:
>>> Then it might be worth while to use a packet sniffer like wire-shark
>>> (or some such) to see if the TCP connection is being abruptly closed
>>> (by either client or server) or are you receiving some HTTP response
>>> from the exchange server which then leads to the client closing the
>>> connection.
>>> MS Exchange is known to non-standard compliant behaviour so I wouldn't
>>> be surprised if it's doing something unexpected!
>> I'm also guessing that he's using NTLM authentication. I don't think
>> our code
>> is wrong in Qt 4.8, but I wouldn't be surprised if we're wrong.
> That's pretty much exactly what I'm thinking.
> I have asked about the authentication but haven't heard from them.
> I will try and create a small self contained test case that shows the
> problem. If there's someone here who thinks he might be able to fix the
> problem, I think the customer won't mind if I give out the address of
> their exchange machine. But I won't post it to the bug tracker.
> Bo.

Bo Thorsen, European Engineering Manager, ICS
Integrated Computer Solutions. Delivering World-Class Applications

More information about the Interest mailing list