Commit 1a47d5d6 authored by Bence Béky's avatar Bence Béky Committed by Commit Bot

Add WebSocket-related CHECKs to HttpStreamFactoryImpl::Job.

The primary reason for these CHECKs is to better document expectations
in code.  Also, they are CHECKs instead of DCHECKs to help track down
crashes in case these expectations do not hold.

Bug: 819101
Change-Id: Ia309bbff2f4e048926930cd9a15fbc107994895d
Reviewed-on: https://chromium-review.googlesource.com/975621Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
Commit-Queue: Bence Béky <bnc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545196}
parent 72f11415
......@@ -1051,8 +1051,14 @@ int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) {
net_log_.AddEvent(
NetLogEventType::HTTP_STREAM_REQUEST_PROTO,
base::Bind(&NetLogHttpStreamProtoCallback, negotiated_protocol_));
if (negotiated_protocol_ == kProtoHTTP2)
if (negotiated_protocol_ == kProtoHTTP2) {
// If request is WebSocket, HTTP/2 must not have been advertised in
// the TLS handshake. The TLS layer must not have accepted the
// server choosing HTTP/2.
// TODO(bnc): Change to DCHECK once https://crbug.com/819101 is fixed.
CHECK(!is_websocket_);
using_spdy_ = true;
}
}
}
} else if (proxy_info_.is_https() && connection_->socket() &&
......@@ -1213,6 +1219,10 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() {
CHECK(!stream_.get());
// WebSocket over HTTP/2 is only allowed to use existing connections.
// TODO(bnc): Change to DCHECK once https://crbug.com/819101 is fixed.
CHECK(!is_websocket_ || existing_spdy_session_);
// It is possible that a pushed stream has been opened by a server since last
// time Job checked above.
if (!existing_spdy_session_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment