Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.6
-
None
Description
Steps to reproduce:
- Call QNetworkAccessManager.setProxy() to configure HTTP proxy with some valid IP but non-listening port;
- Create a QHttpRequest to some valid URL;
- Call QNetworkAccessManager::get() with request from step 2;
- On reply returned on step 3, connect to finished() signal;
- When QNetworkReply::finished() is emitted, check the value return by error() and errorString()
Expected behavior:
QNetworkReply::error() == QNetworkReply::ProxyConnectionRefusedError
QNetworkReply::errorString() == "Proxy connection refused"
Actual behavior:
QNetworkReply::error() == QNetworkReply::UnknownNetworkError
QNetworkReply::errorString() == "Proxy connection refused"
Same behavior is observed with the QNetworkReply::error() signal parameter being UnknownNetworkError. Since this error code is non-specific, and error string is localizable and non-constant, there is no easy way to detect this (very common) proxy-related error.
Proposed fix:
In source file qhttpnetworkconnectionchannel.cpp, line 1049, add the following code:
case QAbstractSocket::ProxyConnectionRefusedError: errorCode = QNetworkReply::ProxyConnectionRefusedError; break;