Hello,

my problem is i don't get the error message in case something went wrong. In case QNetworkReply::error() != QNetworkReply::NoError all fields are empty. Just
QNetworkReply::errorString provides "Connection closed" or sometimes "Connection refused". But with Wireshark i can see the device/server does indeed send more information including the reason for the "Connection closed".
How can i get the statuscode or description?


Qt Code:
  1. MyClass::MyClass(QObject* parent)
  2. {
  3. m_pNetManager = new QNetworkAccessManager(this);
  4. connect(m_pNetManager, &QNetworkAccessManager::finished, this, &MyClass::readReply);
  5. }
  6.  
  7. MyClass::readReply(QNetworkReply* const pReply)
  8. {
  9. if (pReply->error() != QNetworkReply::NoError)
  10. {
  11. qDebug() << pReply->readAll();
  12. qDebug() << pReply->rawHeaderList();
  13. qDebug() << pReply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
  14. qDebug() << pReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
  15. qDebug() << pReply->errorString() << pReply->error();
  16.  
  17. pReply->deleteLater();
  18. return;
  19. }
  20. // normal program flow here ...
  21. }
To copy to clipboard, switch view to plain text mode 

Output of above code when receiving an error:
""
()
QVariant(Invalid)
QVariant(Invalid)
"Connection closed" QNetworkReply::NetworkError(RemoteHostClosedError)
On WireShark there are 3 TCP packages [ACK][PSH,ACK][FIN,ACK], the second contains:
Qt Code:
  1. HTTP/1.1 401 Unauthorized
  2. WWW-Authenticate: Digest realm="AXIS_WS_ACCC8E7913BD", nonce="oPoxc2iuBQA=1d8e93903510c2de354fadda8b313cd6da6372dc", algorithm=MD5, qop="auth"
  3. Server: gSOAP/2.7
  4. Content-Type: application/soap+xml; charset=utf-8
  5. Content-Length: 620
  6. Connection: close
To copy to clipboard, switch view to plain text mode 
It seems i only get the content of messages which wiresharks marks as HTTP/XML-Protocol. The above 401 Unauthorized is only in a TCP-Package.
How do i get the "401 Unauthorized"?

Thanks for any ideas.