OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <sys/epoll.h> | 6 #include <sys/epoll.h> |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 // Force the client to write with a stream ID belonging to a nonexistent | 1173 // Force the client to write with a stream ID belonging to a nonexistent |
1174 // server-side stream. | 1174 // server-side stream. |
1175 QuicSessionPeer::SetNextOutgoingStreamId(client_->client()->session(), 2); | 1175 QuicSessionPeer::SetNextOutgoingStreamId(client_->client()->session(), 2); |
1176 | 1176 |
1177 client_->SendCustomSynchronousRequest(request); | 1177 client_->SendCustomSynchronousRequest(request); |
1178 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 1178 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
1179 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 1179 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
1180 EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error()); | 1180 EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error()); |
1181 } | 1181 } |
1182 | 1182 |
| 1183 // Test that if the the server will close the connection if the client attempts |
| 1184 // to send a request with overly large headers. |
| 1185 TEST_P(EndToEndTest, LargeHeaders) { |
| 1186 ASSERT_TRUE(Initialize()); |
| 1187 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 1188 |
| 1189 string body; |
| 1190 test::GenerateBody(&body, kMaxPacketSize); |
| 1191 |
| 1192 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); |
| 1193 request.AddHeader("key1", string(15 * 1024, 'a')); |
| 1194 request.AddHeader("key2", string(15 * 1024, 'a')); |
| 1195 request.AddHeader("key3", string(15 * 1024, 'a')); |
| 1196 request.AddBody(body, true); |
| 1197 |
| 1198 client_->SendCustomSynchronousRequest(request); |
| 1199 if (FLAGS_quic_limit_uncompressed_headers) { |
| 1200 EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, client_->stream_error()); |
| 1201 } else { |
| 1202 EXPECT_EQ(QUIC_STREAM_NO_ERROR, client_->stream_error()); |
| 1203 EXPECT_EQ(kFooResponseBody, client_->response_body()); |
| 1204 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1205 } |
| 1206 EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error()); |
| 1207 } |
| 1208 |
1183 TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) { | 1209 TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) { |
1184 ASSERT_TRUE(Initialize()); | 1210 ASSERT_TRUE(Initialize()); |
1185 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1211 client_->client()->WaitForCryptoHandshakeConfirmed(); |
1186 | 1212 |
1187 string large_body; | 1213 string large_body; |
1188 GenerateBody(&large_body, 1024 * 1024); | 1214 GenerateBody(&large_body, 1024 * 1024); |
1189 | 1215 |
1190 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); | 1216 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); |
1191 request.AddBody(large_body, false); | 1217 request.AddBody(large_body, false); |
1192 | 1218 |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2929 client_->WaitForResponse(); | 2955 client_->WaitForResponse(); |
2930 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 2956 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
2931 QuicConnectionStats client_stats = | 2957 QuicConnectionStats client_stats = |
2932 client_->client()->session()->connection()->GetStats(); | 2958 client_->client()->session()->connection()->GetStats(); |
2933 EXPECT_EQ(0u, client_stats.packets_lost); | 2959 EXPECT_EQ(0u, client_stats.packets_lost); |
2934 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 2960 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
2935 } | 2961 } |
2936 } // namespace | 2962 } // namespace |
2937 } // namespace test | 2963 } // namespace test |
2938 } // namespace net | 2964 } // namespace net |
OLD | NEW |