Commit 9a6ff125 authored by Ryan Hamilton's avatar Ryan Hamilton Committed by Commit Bot

Close the QUIC connection if a server promises to push a response on a client-initiated stream id.

Merge internal change 205691599.

BUG=865809

Change-Id: I0369074ac0c1e754cc350c37a47681101e35cf12
Reviewed-on: https://chromium-review.googlesource.com/1148640Reviewed-by: default avatarZhongyi Shi <zhongyi@chromium.org>
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577620}
parent 13b9bc35
...@@ -69,6 +69,12 @@ void QuicSpdyClientSessionBase::OnPromiseHeaderList( ...@@ -69,6 +69,12 @@ void QuicSpdyClientSessionBase::OnPromiseHeaderList(
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
return; return;
} }
if (!IsIncomingStream(promised_stream_id)) {
connection()->CloseConnection(
QUIC_INVALID_STREAM_ID, "Received push stream id for outgoing stream.",
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
return;
}
largest_promised_stream_id_ = promised_stream_id; largest_promised_stream_id_ = promised_stream_id;
QuicSpdyStream* stream = GetSpdyDataStream(stream_id); QuicSpdyStream* stream = GetSpdyDataStream(stream_id);
......
...@@ -438,6 +438,24 @@ TEST_P(QuicSpdyClientSessionTest, PushPromiseOutOfOrder) { ...@@ -438,6 +438,24 @@ TEST_P(QuicSpdyClientSessionTest, PushPromiseOutOfOrder) {
QuicHeaderList()); QuicHeaderList());
} }
TEST_P(QuicSpdyClientSessionTest, PushPromiseOutgoingStreamId) {
// Initialize crypto before the client session will create a stream.
CompleteCryptoHandshake();
MockQuicSpdyClientStream* stream = static_cast<MockQuicSpdyClientStream*>(
session_->CreateOutgoingDynamicStream());
// Promise an illegal (outgoing) stream id.
promised_stream_id_ = 1;
EXPECT_CALL(
*connection_,
CloseConnection(QUIC_INVALID_STREAM_ID,
"Received push stream id for outgoing stream.", _));
session_->OnPromiseHeaderList(stream->id(), promised_stream_id_, 0,
QuicHeaderList());
}
TEST_P(QuicSpdyClientSessionTest, PushPromiseHandlePromise) { TEST_P(QuicSpdyClientSessionTest, PushPromiseHandlePromise) {
// Initialize crypto before the client session will create a stream. // Initialize crypto before the client session will create a stream.
CompleteCryptoHandshake(); CompleteCryptoHandshake();
......
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