Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.5.1
-
e66dcd51d0e5517e88cd59912fd08501522a2902
Description
If there is a delay between status line ("HTTP/1.1 101 Upgrading Protocol") and headers, QWebSocketPrivate::processHandshake erroneously detects server disconnect. The problem is that disconnect condition is checked using QAbstractSocket::atEnd function which just checks if data available and not the actual socket state. This results in multiple error signals:
websocket error: QWebSocket::processHandshake: Connection closed while reading header.
websocket error: Invalid statusline in response: Date: Thu, 11 Feb 2016 20:07:37 GMT^M .
websocket error: Invalid statusline in response: Server: WSGIServer/0.1 Python/2.7.10^M .
websocket error: Invalid statusline in response: Upgrade: websocket^M .
websocket error: Invalid statusline in response: Connection: Upgrade^M .
websocket error: Invalid statusline in response: Sec-WebSocket-Accept: oQ+NK56UdGrsXFisB9chjE3SU+Y=^M .
websocket error: Invalid statusline in response: Sec-WebSocket-Version: 13^M .
websocket error: Invalid statusline in response: Content-Length: 0^M .
websocket error: Invalid statusline in response: ^M .
You can reproduce bug using attached server.py. It simulates HTTP server and introduces delay between status line and headers.
Attached patch fixes the problem.
Attachments
For Gerrit Dashboard: QTBUG-51069 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
159655,2 | Fixed erroneous detection of server disconnect condition | 5.6 | qt/qtwebsockets | Status: MERGED | +2 | 0 |