| 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 "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10110 // connection was attempted with TLSv1. This is transparent to the caller | 10110 // connection was attempted with TLSv1. This is transparent to the caller |
| 10111 // of the HttpNetworkTransaction. Because this test failure is due to | 10111 // of the HttpNetworkTransaction. Because this test failure is due to |
| 10112 // requiring a client certificate, this fallback handshake should also | 10112 // requiring a client certificate, this fallback handshake should also |
| 10113 // fail. | 10113 // fail. |
| 10114 SSLSocketDataProvider ssl_data4(ASYNC, net::ERR_SSL_PROTOCOL_ERROR); | 10114 SSLSocketDataProvider ssl_data4(ASYNC, net::ERR_SSL_PROTOCOL_ERROR); |
| 10115 ssl_data4.cert_request_info = cert_request.get(); | 10115 ssl_data4.cert_request_info = cert_request.get(); |
| 10116 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); | 10116 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); |
| 10117 net::StaticSocketDataProvider data4(NULL, 0, NULL, 0); | 10117 net::StaticSocketDataProvider data4(NULL, 0, NULL, 0); |
| 10118 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 10118 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 10119 | 10119 |
| 10120 // Need one more if TLSv1.2 is enabled. |
| 10121 SSLSocketDataProvider ssl_data5(ASYNC, net::ERR_SSL_PROTOCOL_ERROR); |
| 10122 ssl_data5.cert_request_info = cert_request.get(); |
| 10123 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5); |
| 10124 net::StaticSocketDataProvider data5(NULL, 0, NULL, 0); |
| 10125 session_deps_.socket_factory->AddSocketDataProvider(&data5); |
| 10126 |
| 10120 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10127 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10121 scoped_ptr<HttpTransaction> trans( | 10128 scoped_ptr<HttpTransaction> trans( |
| 10122 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); | 10129 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
| 10123 | 10130 |
| 10124 // Begin the SSL handshake with the peer. This consumes ssl_data1. | 10131 // Begin the SSL handshake with the peer. This consumes ssl_data1. |
| 10125 TestCompletionCallback callback; | 10132 TestCompletionCallback callback; |
| 10126 int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog()); | 10133 int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog()); |
| 10127 ASSERT_EQ(net::ERR_IO_PENDING, rv); | 10134 ASSERT_EQ(net::ERR_IO_PENDING, rv); |
| 10128 | 10135 |
| 10129 // Complete the SSL handshake, which should abort due to requiring a | 10136 // Complete the SSL handshake, which should abort due to requiring a |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10223 | 10230 |
| 10224 // [ssl_]data4 is the data for the SSL handshake once the TLSv1 connection | 10231 // [ssl_]data4 is the data for the SSL handshake once the TLSv1 connection |
| 10225 // falls back to SSLv3. It has the same behaviour as [ssl_]data2. | 10232 // falls back to SSLv3. It has the same behaviour as [ssl_]data2. |
| 10226 SSLSocketDataProvider ssl_data4(ASYNC, net::OK); | 10233 SSLSocketDataProvider ssl_data4(ASYNC, net::OK); |
| 10227 ssl_data4.cert_request_info = cert_request.get(); | 10234 ssl_data4.cert_request_info = cert_request.get(); |
| 10228 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); | 10235 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); |
| 10229 net::StaticSocketDataProvider data4( | 10236 net::StaticSocketDataProvider data4( |
| 10230 data2_reads, arraysize(data2_reads), NULL, 0); | 10237 data2_reads, arraysize(data2_reads), NULL, 0); |
| 10231 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 10238 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 10232 | 10239 |
| 10240 // Need one more if TLSv1.2 is enabled. |
| 10241 SSLSocketDataProvider ssl_data5(ASYNC, net::OK); |
| 10242 ssl_data5.cert_request_info = cert_request.get(); |
| 10243 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5); |
| 10244 net::StaticSocketDataProvider data5( |
| 10245 data2_reads, arraysize(data2_reads), NULL, 0); |
| 10246 session_deps_.socket_factory->AddSocketDataProvider(&data5); |
| 10247 |
| 10233 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10248 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10234 scoped_ptr<HttpTransaction> trans( | 10249 scoped_ptr<HttpTransaction> trans( |
| 10235 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); | 10250 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
| 10236 | 10251 |
| 10237 // Begin the initial SSL handshake. | 10252 // Begin the initial SSL handshake. |
| 10238 TestCompletionCallback callback; | 10253 TestCompletionCallback callback; |
| 10239 int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog()); | 10254 int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog()); |
| 10240 ASSERT_EQ(net::ERR_IO_PENDING, rv); | 10255 ASSERT_EQ(net::ERR_IO_PENDING, rv); |
| 10241 | 10256 |
| 10242 // Complete the SSL handshake, which should abort due to requiring a | 10257 // Complete the SSL handshake, which should abort due to requiring a |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11378 EXPECT_EQ("hello!", response_data); | 11393 EXPECT_EQ("hello!", response_data); |
| 11379 EXPECT_FALSE( | 11394 EXPECT_FALSE( |
| 11380 session->spdy_session_pool()->HasSession(spdy_session_key_a)); | 11395 session->spdy_session_pool()->HasSession(spdy_session_key_a)); |
| 11381 EXPECT_FALSE( | 11396 EXPECT_FALSE( |
| 11382 session->spdy_session_pool()->HasSession(spdy_session_key_b)); | 11397 session->spdy_session_pool()->HasSession(spdy_session_key_b)); |
| 11383 | 11398 |
| 11384 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 11399 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 11385 } | 11400 } |
| 11386 | 11401 |
| 11387 } // namespace net | 11402 } // namespace net |
| OLD | NEW |