src/net/spdy/spdy_stream_unittest.cc
// Receiving a header with uppercase ASCII should result in a protocol error.
Receiving a header with uppercase ASCII should result in a protocol error.
Receiving a header with uppercase ASCII should result in a protocol error .
TEST_F(SpdyStreamTest, UpperCaseHeaders) {
  spdy::SpdySerializedFrame req(
      spdy_util_.ConstructSpdyGet(nullptr, 0, 1, LOWEST));
  AddWrite(req);
  const char* const kExtraHeaders[] = {"X-UpperCase", "yes"};
  spdy::SpdySerializedFrame reply(spdy_util_.ConstructSpdyGetReply(
      kExtraHeaders, base::size(kExtraHeaders) / 2, 1));
  AddRead(reply);
  spdy::SpdySerializedFrame rst(
      spdy_util_.ConstructSpdyRstStream(1, spdy::ERROR_CODE_PROTOCOL_ERROR));
  AddWrite(rst);
  AddReadEOF();
  SequencedSocketData data(GetReads(), GetWrites());
  MockConnect connect_data(SYNCHRONOUS, OK);
  data.set_connect_data(connect_data);
  session_deps_.socket_factory->AddSocketDataProvider(&data);
  AddSSLSocketData();
  base::WeakPtr<SpdySession> session(CreateDefaultSpdySession());
  base::WeakPtr<SpdyStream> stream = CreateStreamSynchronously(
      SPDY_REQUEST_RESPONSE_STREAM, session, url_, LOWEST, NetLogWithSource());
  ASSERT_TRUE(stream);
  EXPECT_EQ(kDefaultUrl, stream->url().spec());
  StreamDelegateDoNothing delegate(stream);
  stream->SetDelegate(&delegate);
  spdy::SpdyHeaderBlock headers(
      spdy_util_.ConstructGetHeaderBlock(kDefaultUrl));
  EXPECT_THAT(
      stream->SendRequestHeaders(std::move(headers), NO_MORE_DATA_TO_SEND),
      IsError(ERR_IO_PENDING));
  EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_HTTP2_PROTOCOL_ERROR));
  base::RunLoop().RunUntilIdle();
  EXPECT_TRUE(data.AllWriteDataConsumed());
  EXPECT_TRUE(data.AllReadDataConsumed());
}
TEST_F ( SpdyStreamTest , UpperCaseHeaders ) { spdy :: SpdySerializedFrame req ( spdy_util_ . ConstructSpdyGet ( nullptr , 0 , 1 , LOWEST ) ) ; AddWrite ( req ) ; const char * const kExtraHeaders [ ] = { " " , " " } ; spdy :: SpdySerializedFrame reply ( spdy_util_ . ConstructSpdyGetReply ( kExtraHeaders , base :: size ( kExtraHeaders ) / 2 , 1 ) ) ; AddRead ( reply ) ; spdy :: SpdySerializedFrame rst ( spdy_util_ . ConstructSpdyRstStream ( 1 , spdy :: ERROR_CODE_PROTOCOL_ERROR ) ) ; AddWrite ( rst ) ; AddReadEOF ( ) ; SequencedSocketData data ( GetReads ( ) , GetWrites ( ) ) ; MockConnect connect_data ( SYNCHRONOUS , OK ) ; data . set_connect_data ( connect_data ) ; session_deps_ . socket_factory -> AddSocketDataProvider ( & data ) ; AddSSLSocketData ( ) ; base :: WeakPtr < SpdySession > session ( CreateDefaultSpdySession ( ) ) ; base :: WeakPtr < SpdyStream > stream = CreateStreamSynchronously ( SPDY_REQUEST_RESPONSE_STREAM , session , url_ , LOWEST , NetLogWithSource ( ) ) ; ASSERT_TRUE ( stream ) ; EXPECT_EQ ( kDefaultUrl , stream -> url ( ) . spec ( ) ) ; StreamDelegateDoNothing delegate ( stream ) ; stream -> SetDelegate ( & delegate ) ; spdy :: SpdyHeaderBlock headers ( spdy_util_ . ConstructGetHeaderBlock ( kDefaultUrl ) ) ; EXPECT_THAT ( stream -> SendRequestHeaders ( std :: move ( headers ) , NO_MORE_DATA_TO_SEND ) , IsError ( ERR_IO_PENDING ) ) ; EXPECT_THAT ( delegate . WaitForClose ( ) , IsError ( ERR_HTTP2_PROTOCOL_ERROR ) ) ; base :: RunLoop ( ) . RunUntilIdle ( ) ; EXPECT_TRUE ( data . AllWriteDataConsumed ( ) ) ; EXPECT_TRUE ( data . AllReadDataConsumed ( ) ) ; }
Receiving a header with uppercase ASCII should result in a protocol error.
Receiving a header with uppercase ASCII should result in a protocol error .
// Finish async network reads and writes.