Avoid WebSocket upgrade on network error.
In the event of network error, the WebSocket server response is not validated. However, some network errors are ignored higher up in the stack. For example, in HttpNetworkTransaction::DoReadHeadersComplete at http_network_transaction.cc:988, ERR_CONNECTION_CLOSED is converted to OK. To avoid this whole class of bugs, do not keep status code 101 (Switching Protocols) if there was a network error. It is changed to 503. The response headers that are displayed in devtools are copied before the change, so they will still retain the original status code. BUG=408061 TEST=net_unittests Review URL: https://codereview.chromium.org/889783002 Cr-Commit-Position: refs/heads/master@{#314136}
Showing
Please register or sign in to comment