Reviewing merge request #1613: Fix QHttp error handling in case of RemoteHostClosedError
When the remote host closes the connection 3 times, no error was emitted, so QHttp appeared to be connecting successfully, but it wasn't.
I know QHttp is deprecated, but your QtSoap solution is still based on it.
Commits that would be merged:
- 36304a7
- 18f712f
Fix error handling when the host returns RemoteHostClosedError 3 times.
36304a7-18f712fComments
Need autotest. Right now, all of tst_qhttp.cpp is passing.
Err, how do I provide an HTTP server that refuses connections???
Connect to “qt-test-server” port 90. That one refuses connections.
Set your /etc/hosts to have qt-test-server pointing to a valid host.
That gives ConnectionRefusedError, which is handled ok, rather than RemoteHostClosedError, which is where the bug is.
I tried re-enabling connectionClose(), but that one (www.fon.com) fails with QAbstractSocket::SslHandshakeFailedError, so that’s different again.
The commented-out one (nexus.passport.com) just works, no error.
I don’t know how to unittest RemoteHostClosedError, but I'm 100% sure of this fix; the server I was using here (in a VM, not a public HTTP website) was consistently giving that error….
A QTcpServer should do…
I give up. If you won’t take my fix unless I put in more hours into it, that’s your loss.
Sorry, I've run the QHttp unit test with this change and it introduces regressions:
FAIL! : tst_QHttp::get(WithoutProxy:failprot_02_0) Compared values are not the same
Actual (res.value().success): 0
Expected ("success"): 1
Loc: [/home/tmacieir/src/troll/qt-main/tests/auto/qhttp/tst_qhttp.cpp(391)]
FAIL! : tst_QHttp::get(WithoutProxy:failprot_02_1) Compared values are not the same
Actual (res.value().success): 0
Expected ("success"): 1
Loc: [/home/tmacieir/src/troll/qt-main/tests/auto/qhttp/tst_qhttp.cpp(391)]
FAIL! : tst_QHttp::get(WithSocks5Proxy:failprot_02_0) Compared values are not the same
Actual (res.value().success): 0
Expected ("success"): 1
Loc: [/home/tmacieir/src/troll/qt-main/tests/auto/qhttp/tst_qhttp.cpp(391)]
FAIL! : tst_QHttp::get(WithSocks5Proxy:failprot_02_1) Compared values are not the same
Actual (res.value().success): 0
Expected ("success"): 1
Loc: [/home/tmacieir/src/troll/qt-main/tests/auto/qhttp/tst_qhttp.cpp(391)]
I also added the test I had wanted you to write. See e8f45c5ba8371053817f13e70d78b06f229d8666.


Add a new comment:
Login or create an account to post a comment