• ricea's avatar
    Avoid WebSocket upgrade on network error. · 23c3f94f
    ricea authored
    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}
    23c3f94f
websocket_stream_test.cc 54.8 KB