[Interest] Progressive decay of QNAM/QNetworkReply

Bob Hood bhood2 at comcast.net
Thu Dec 22 02:51:41 CET 2016


I have several projects that use QNAM/QNetworkReply pretty heavily. They were 
developed using Qt 5.4.2, and the networking works flawlessly.

However, I switched to Qt 5.6.2 and my networking stopped working.  No errors, 
my slots weren't even being invoked.  The request just appears to vanish into 
the ether.

I just tried Qt 5.7.1 and the same networking code is now returning 
|ProtocolUnknownError (|error code 301).

The code being used for all three versions is very simply:

     ...
     QUrl url(url_str);
     url.setUserName(username);
     url.setPassword(password);

     QNetworkRequest request(url);
     request.setRawHeader(QByteArray("Content-type"), 
QByteArray("application/json"));
     request.setRawHeader(QByteArray("Accept"), QByteArray("application/json"));

     QNetworkReply* reply = QNAM->get(request);
     connect(reply, &QNetworkReply::readyRead, this, &TeamCity::slot_get_read);
     connect(reply, &QNetworkReply::finished, this, &TeamCity::slot_get_complete);
     connected = connect(reply, static_cast<void 
(QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
                         this, &TeamCity::slot_get_failed);
     ...

This same code using the same URL works in 5.4.2, and variously doesn't in 
later versions.

The URL is a REST API, and uses HTTPS.

Any hints about what might be going wrong here?  Something new in 5.6 that I'm 
not doing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161221/1b5f71a2/attachment.html>


More information about the Interest mailing list