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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 // Force the client to write with a stream ID belonging to a nonexistent | 1174 // Force the client to write with a stream ID belonging to a nonexistent |
1175 // server-side stream. | 1175 // server-side stream. |
1176 QuicSessionPeer::SetNextOutgoingStreamId(client_->client()->session(), 2); | 1176 QuicSessionPeer::SetNextOutgoingStreamId(client_->client()->session(), 2); |
1177 | 1177 |
1178 client_->SendCustomSynchronousRequest(request); | 1178 client_->SendCustomSynchronousRequest(request); |
1179 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 1179 // EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
1180 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); | 1180 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error()); |
1181 EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error()); | 1181 EXPECT_EQ(QUIC_INVALID_STREAM_ID, client_->connection_error()); |
1182 } | 1182 } |
1183 | 1183 |
| 1184 // Test that if the the server will close the connection if the client attempts |
| 1185 // to send a request with overly large headers. |
| 1186 TEST_P(EndToEndTest, LargeHeaders) { |
| 1187 ASSERT_TRUE(Initialize()); |
| 1188 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 1189 |
| 1190 string body; |
| 1191 test::GenerateBody(&body, kMaxPacketSize); |
| 1192 |
| 1193 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); |
| 1194 request.AddHeader("key1", string(15 * 1024, 'a')); |
| 1195 request.AddHeader("key2", string(15 * 1024, 'a')); |
| 1196 request.AddHeader("key3", string(15 * 1024, 'a')); |
| 1197 request.AddBody(body, true); |
| 1198 |
| 1199 client_->SendCustomSynchronousRequest(request); |
| 1200 if (FLAGS_quic_limit_uncompressed_headers) { |
| 1201 EXPECT_EQ(QUIC_HEADERS_TOO_LARGE, client_->stream_error()); |
| 1202 } else { |
| 1203 EXPECT_EQ(QUIC_STREAM_NO_ERROR, client_->stream_error()); |
| 1204 EXPECT_EQ(kFooResponseBody, client_->response_body()); |
| 1205 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1206 } |
| 1207 EXPECT_EQ(QUIC_NO_ERROR, client_->connection_error()); |
| 1208 } |
| 1209 |
1184 TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) { | 1210 TEST_P(EndToEndTest, EarlyResponseWithQuicStreamNoError) { |
1185 ASSERT_TRUE(Initialize()); | 1211 ASSERT_TRUE(Initialize()); |
1186 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1212 client_->client()->WaitForCryptoHandshakeConfirmed(); |
1187 | 1213 |
1188 string large_body; | 1214 string large_body; |
1189 GenerateBody(&large_body, 1024 * 1024); | 1215 GenerateBody(&large_body, 1024 * 1024); |
1190 | 1216 |
1191 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); | 1217 HTTPMessage request(HttpConstants::HTTP_1_1, HttpConstants::POST, "/foo"); |
1192 request.AddBody(large_body, false); | 1218 request.AddBody(large_body, false); |
1193 | 1219 |
(...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 client_->WaitForResponse(); | 2957 client_->WaitForResponse(); |
2932 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 2958 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
2933 QuicConnectionStats client_stats = | 2959 QuicConnectionStats client_stats = |
2934 client_->client()->session()->connection()->GetStats(); | 2960 client_->client()->session()->connection()->GetStats(); |
2935 EXPECT_EQ(0u, client_stats.packets_lost); | 2961 EXPECT_EQ(0u, client_stats.packets_lost); |
2936 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 2962 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
2937 } | 2963 } |
2938 } // namespace | 2964 } // namespace |
2939 } // namespace test | 2965 } // namespace test |
2940 } // namespace net | 2966 } // namespace net |
OLD | NEW |