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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5398 EXPECT_EQ("insert", parts[0]); | 5398 EXPECT_EQ("insert", parts[0]); |
5399 if (i == 0) { | 5399 if (i == 0) { |
5400 session_id = parts[1]; | 5400 session_id = parts[1]; |
5401 } else { | 5401 } else { |
5402 EXPECT_NE(session_id, parts[1]); | 5402 EXPECT_NE(session_id, parts[1]); |
5403 } | 5403 } |
5404 } | 5404 } |
5405 } | 5405 } |
5406 } | 5406 } |
5407 | 5407 |
| 5408 // Check that our ClientHello doesn't get too large because that's known to |
| 5409 // cause issues. |
| 5410 TEST_F(HTTPSRequestTest, ClientHelloTest) { |
| 5411 SpawnedTestServer::SSLOptions ssl_options; |
| 5412 SpawnedTestServer test_server( |
| 5413 SpawnedTestServer::TYPE_HTTPS, |
| 5414 ssl_options, |
| 5415 base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
| 5416 ASSERT_TRUE(test_server.Start()); |
| 5417 |
| 5418 // NPN/ALPN strings need to be enabled in order for the size of the handshake |
| 5419 // to be accurate as ALPN includes these strings in the handshake. This will |
| 5420 // be reset by NetTestSuite. |
| 5421 HttpStreamFactory::EnableNpnSpdy4a2(); |
| 5422 |
| 5423 TestDelegate d; |
| 5424 URLRequest r( |
| 5425 test_server.GetURL("client-hello-length"), &d, &default_context_); |
| 5426 |
| 5427 r.Start(); |
| 5428 EXPECT_TRUE(r.is_pending()); |
| 5429 |
| 5430 base::MessageLoop::current()->Run(); |
| 5431 |
| 5432 // The response will be a single, base 10 number which is the number of bytes |
| 5433 // in the ClientHello, including the handshake message type byte and 3 byte |
| 5434 // length at the beginning. |
| 5435 |
| 5436 EXPECT_EQ(1, d.response_started_count()); |
| 5437 unsigned client_hello_length; |
| 5438 ASSERT_TRUE(base::StringToUint(d.data_received(), &client_hello_length)); |
| 5439 // We add the overhead of an SNI extension because the request is sent to |
| 5440 // 127.0.0.1 and so doesn't have one otherwise. |
| 5441 const unsigned sni_overhead = 2 /* extension type */ + |
| 5442 2 /* extension length */ + |
| 5443 4 /* lengths in the server_name extension */ + |
| 5444 strlen("www.wellsfargo.com"); |
| 5445 static const unsigned session_id_overhead = 32; |
| 5446 |
| 5447 EXPECT_GT(256u, client_hello_length + sni_overhead + session_id_overhead); |
| 5448 } |
| 5449 |
5408 class TestSSLConfigService : public SSLConfigService { | 5450 class TestSSLConfigService : public SSLConfigService { |
5409 public: | 5451 public: |
5410 TestSSLConfigService(bool ev_enabled, | 5452 TestSSLConfigService(bool ev_enabled, |
5411 bool online_rev_checking, | 5453 bool online_rev_checking, |
5412 bool rev_checking_required_local_anchors) | 5454 bool rev_checking_required_local_anchors) |
5413 : ev_enabled_(ev_enabled), | 5455 : ev_enabled_(ev_enabled), |
5414 online_rev_checking_(online_rev_checking), | 5456 online_rev_checking_(online_rev_checking), |
5415 rev_checking_required_local_anchors_( | 5457 rev_checking_required_local_anchors_( |
5416 rev_checking_required_local_anchors) {} | 5458 rev_checking_required_local_anchors) {} |
5417 | 5459 |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6242 | 6284 |
6243 EXPECT_FALSE(r.is_pending()); | 6285 EXPECT_FALSE(r.is_pending()); |
6244 EXPECT_EQ(1, d->response_started_count()); | 6286 EXPECT_EQ(1, d->response_started_count()); |
6245 EXPECT_FALSE(d->received_data_before_response()); | 6287 EXPECT_FALSE(d->received_data_before_response()); |
6246 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 6288 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
6247 } | 6289 } |
6248 } | 6290 } |
6249 #endif // !defined(DISABLE_FTP_SUPPORT) | 6291 #endif // !defined(DISABLE_FTP_SUPPORT) |
6250 | 6292 |
6251 } // namespace net | 6293 } // namespace net |
OLD | NEW |