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 <string> | 5 #include <string> |
6 #include <utility> | 6 #include <utility> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 6431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6442 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), | 6442 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), |
6443 GetParam(), nullptr); | 6443 GetParam(), nullptr); |
6444 helper.RunToCompletion(&data); | 6444 helper.RunToCompletion(&data); |
6445 TransactionHelperResult out = helper.output(); | 6445 TransactionHelperResult out = helper.output(); |
6446 | 6446 |
6447 EXPECT_EQ(OK, out.rv); | 6447 EXPECT_EQ(OK, out.rv); |
6448 EXPECT_EQ("HTTP/1.1 200", out.status_line); | 6448 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
6449 EXPECT_EQ("hello!", out.response_data); | 6449 EXPECT_EQ("hello!", out.response_data); |
6450 } | 6450 } |
6451 | 6451 |
| 6452 // Regression test for https://crbug.com/535629: response header exceeds 16 kB. |
| 6453 TEST_P(SpdyNetworkTransactionTest, LargeResponseHeader) { |
| 6454 scoped_ptr<SpdyHeaderBlock> headers( |
| 6455 spdy_util_.ConstructGetHeaderBlock(GetDefaultUrl())); |
| 6456 scoped_ptr<SpdyFrame> req( |
| 6457 spdy_util_.ConstructSpdySyn(1, *headers, LOWEST, false, true)); |
| 6458 MockWrite writes[] = { |
| 6459 CreateMockWrite(*req, 0), |
| 6460 }; |
| 6461 |
| 6462 // HPACK decoder implementation limits string literal length to 16 kB. |
| 6463 const char* response_headers[2]; |
| 6464 const std::string kKey(16 * 1024, 'a'); |
| 6465 response_headers[0] = kKey.data(); |
| 6466 const std::string kValue(16 * 1024, 'b'); |
| 6467 response_headers[1] = kValue.data(); |
| 6468 |
| 6469 scoped_ptr<SpdyFrame> resp( |
| 6470 spdy_util_.ConstructSpdyGetSynReply(response_headers, 1, 1)); |
| 6471 scoped_ptr<SpdyFrame> body(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 6472 MockRead reads[] = { |
| 6473 CreateMockRead(*resp, 1), CreateMockRead(*body, 2), |
| 6474 MockRead(ASYNC, 0, 3) // EOF |
| 6475 }; |
| 6476 |
| 6477 HttpRequestInfo request; |
| 6478 request.method = "GET"; |
| 6479 request.url = GURL(GetDefaultUrl()); |
| 6480 NormalSpdyTransactionHelper helper(request, DEFAULT_PRIORITY, BoundNetLog(), |
| 6481 GetParam(), nullptr); |
| 6482 |
| 6483 SequencedSocketData data(reads, arraysize(reads), writes, arraysize(writes)); |
| 6484 helper.RunToCompletion(&data); |
| 6485 TransactionHelperResult out = helper.output(); |
| 6486 |
| 6487 EXPECT_EQ(OK, out.rv); |
| 6488 EXPECT_EQ("HTTP/1.1 200", out.status_line); |
| 6489 EXPECT_EQ("hello!", out.response_data); |
| 6490 ASSERT_TRUE(out.response_info.headers->HasHeaderValue(kKey, kValue)); |
| 6491 } |
| 6492 |
6452 class SpdyNetworkTransactionNoTLSUsageCheckTest | 6493 class SpdyNetworkTransactionNoTLSUsageCheckTest |
6453 : public SpdyNetworkTransactionTest { | 6494 : public SpdyNetworkTransactionTest { |
6454 protected: | 6495 protected: |
6455 void RunNoTLSUsageCheckTest(scoped_ptr<SSLSocketDataProvider> ssl_provider) { | 6496 void RunNoTLSUsageCheckTest(scoped_ptr<SSLSocketDataProvider> ssl_provider) { |
6456 // Construct the request. | 6497 // Construct the request. |
6457 scoped_ptr<SpdyFrame> req( | 6498 scoped_ptr<SpdyFrame> req( |
6458 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); | 6499 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); |
6459 MockWrite writes[] = {CreateMockWrite(*req, 0)}; | 6500 MockWrite writes[] = {CreateMockWrite(*req, 0)}; |
6460 | 6501 |
6461 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 6502 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6554 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6595 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6555 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6596 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6556 new SSLSocketDataProvider(ASYNC, OK)); | 6597 new SSLSocketDataProvider(ASYNC, OK)); |
6557 // Set to TLS_RSA_WITH_NULL_MD5 | 6598 // Set to TLS_RSA_WITH_NULL_MD5 |
6558 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6599 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6559 | 6600 |
6560 RunTLSUsageCheckTest(std::move(ssl_provider)); | 6601 RunTLSUsageCheckTest(std::move(ssl_provider)); |
6561 } | 6602 } |
6562 | 6603 |
6563 } // namespace net | 6604 } // namespace net |
OLD | NEW |