OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 9710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9721 UseAlternateProtocolForTunneledNpnSpdy) { | 9721 UseAlternateProtocolForTunneledNpnSpdy) { |
9722 session_deps_.use_alternative_services = true; | 9722 session_deps_.use_alternative_services = true; |
9723 session_deps_.next_protos = SpdyNextProtos(); | 9723 session_deps_.next_protos = SpdyNextProtos(); |
9724 | 9724 |
9725 ProxyConfig proxy_config; | 9725 ProxyConfig proxy_config; |
9726 proxy_config.set_auto_detect(true); | 9726 proxy_config.set_auto_detect(true); |
9727 proxy_config.set_pac_url(GURL("http://fooproxyurl")); | 9727 proxy_config.set_pac_url(GURL("http://fooproxyurl")); |
9728 | 9728 |
9729 CapturingProxyResolver capturing_proxy_resolver; | 9729 CapturingProxyResolver capturing_proxy_resolver; |
9730 session_deps_.proxy_service.reset(new ProxyService( | 9730 session_deps_.proxy_service.reset(new ProxyService( |
9731 new ProxyConfigServiceFixed(proxy_config), | 9731 make_scoped_ptr(new ProxyConfigServiceFixed(proxy_config)), |
9732 make_scoped_ptr( | 9732 make_scoped_ptr( |
9733 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), | 9733 new CapturingProxyResolverFactory(&capturing_proxy_resolver)), |
9734 NULL)); | 9734 NULL)); |
9735 TestNetLog net_log; | 9735 TestNetLog net_log; |
9736 session_deps_.net_log = &net_log; | 9736 session_deps_.net_log = &net_log; |
9737 | 9737 |
9738 HttpRequestInfo request; | 9738 HttpRequestInfo request; |
9739 request.method = "GET"; | 9739 request.method = "GET"; |
9740 request.url = GURL("http://www.example.org/"); | 9740 request.url = GURL("http://www.example.org/"); |
9741 request.load_flags = 0; | 9741 request.load_flags = 0; |
(...skipping 2793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12535 new DeterministicSocketData(reads2, arraysize(reads2), | 12535 new DeterministicSocketData(reads2, arraysize(reads2), |
12536 writes2, arraysize(writes2))); | 12536 writes2, arraysize(writes2))); |
12537 MockConnect connect_data2(ASYNC, OK); | 12537 MockConnect connect_data2(ASYNC, OK); |
12538 data2->set_connect_data(connect_data2); | 12538 data2->set_connect_data(connect_data2); |
12539 | 12539 |
12540 // Set up a proxy config that sends HTTP requests to a proxy, and | 12540 // Set up a proxy config that sends HTTP requests to a proxy, and |
12541 // all others direct. | 12541 // all others direct. |
12542 ProxyConfig proxy_config; | 12542 ProxyConfig proxy_config; |
12543 proxy_config.proxy_rules().ParseFromString("http=https://proxy:443"); | 12543 proxy_config.proxy_rules().ParseFromString("http=https://proxy:443"); |
12544 session_deps_.proxy_service.reset(new ProxyService( | 12544 session_deps_.proxy_service.reset(new ProxyService( |
12545 new ProxyConfigServiceFixed(proxy_config), nullptr, NULL)); | 12545 make_scoped_ptr(new ProxyConfigServiceFixed(proxy_config)), nullptr, |
| 12546 NULL)); |
12546 | 12547 |
12547 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy | 12548 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy |
12548 ssl1.SetNextProto(GetParam()); | 12549 ssl1.SetNextProto(GetParam()); |
12549 // Load a valid cert. Note, that this does not need to | 12550 // Load a valid cert. Note, that this does not need to |
12550 // be valid for proxy because the MockSSLClientSocket does | 12551 // be valid for proxy because the MockSSLClientSocket does |
12551 // not actually verify it. But SpdySession will use this | 12552 // not actually verify it. But SpdySession will use this |
12552 // to see if it is valid for the new origin | 12553 // to see if it is valid for the new origin |
12553 ssl1.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); | 12554 ssl1.cert = ImportCertFromFile(GetTestCertsDirectory(), "ok_cert.pem"); |
12554 ASSERT_TRUE(ssl1.cert.get()); | 12555 ASSERT_TRUE(ssl1.cert.get()); |
12555 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); | 12556 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); |
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14368 ASSERT_TRUE(response); | 14369 ASSERT_TRUE(response); |
14369 ASSERT_TRUE(response->headers.get()); | 14370 ASSERT_TRUE(response->headers.get()); |
14370 | 14371 |
14371 EXPECT_EQ(101, response->headers->response_code()); | 14372 EXPECT_EQ(101, response->headers->response_code()); |
14372 | 14373 |
14373 trans.reset(); | 14374 trans.reset(); |
14374 session->CloseAllConnections(); | 14375 session->CloseAllConnections(); |
14375 } | 14376 } |
14376 | 14377 |
14377 } // namespace net | 14378 } // namespace net |
OLD | NEW |