| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 ret.push_back(value); | 88 ret.push_back(value); |
| 89 } | 89 } |
| 90 va_end(args); | 90 va_end(args); |
| 91 | 91 |
| 92 return ret; | 92 return ret; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating | 95 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating |
| 96 // SPDY. | 96 // SPDY. |
| 97 std::vector<std::string> SpdyNextProtos() { | 97 std::vector<std::string> SpdyNextProtos() { |
| 98 return MakeNextProtos("http/1.1", "spdy/2", NULL); | 98 return MakeNextProtos("http/1.1", "spdy/2", "spdy/2.1", NULL); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace | 101 } // namespace |
| 102 | 102 |
| 103 namespace net { | 103 namespace net { |
| 104 | 104 |
| 105 // Helper to manage the lifetimes of the dependencies for a | 105 // Helper to manage the lifetimes of the dependencies for a |
| 106 // HttpNetworkTransaction. | 106 // HttpNetworkTransaction. |
| 107 struct SessionDependencies { | 107 struct SessionDependencies { |
| 108 // Default set of dependencies -- "null" proxy service. | 108 // Default set of dependencies -- "null" proxy service. |
| (...skipping 8428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8537 | 8537 |
| 8538 HttpStreamFactory::set_next_protos(std::vector<std::string>()); | 8538 HttpStreamFactory::set_next_protos(std::vector<std::string>()); |
| 8539 HttpStreamFactory::set_use_alternate_protocols(false); | 8539 HttpStreamFactory::set_use_alternate_protocols(false); |
| 8540 } | 8540 } |
| 8541 | 8541 |
| 8542 TEST_F(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { | 8542 TEST_F(HttpNetworkTransactionTest, SpdyAlternateProtocolThroughProxy) { |
| 8543 // This test ensures that the URL passed into the proxy is upgraded | 8543 // This test ensures that the URL passed into the proxy is upgraded |
| 8544 // to https when doing an Alternate Protocol upgrade. | 8544 // to https when doing an Alternate Protocol upgrade. |
| 8545 HttpStreamFactory::set_use_alternate_protocols(true); | 8545 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8546 HttpStreamFactory::set_next_protos( | 8546 HttpStreamFactory::set_next_protos( |
| 8547 MakeNextProtos("http/1.1", "http1.1", "spdy/2", "spdy", NULL)); | 8547 MakeNextProtos( |
| 8548 "http/1.1", "http1.1", "spdy/2.1", "spdy/2", "spdy", NULL)); |
| 8548 | 8549 |
| 8549 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); | 8550 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); |
| 8550 HttpAuthHandlerMock::Factory* auth_factory = | 8551 HttpAuthHandlerMock::Factory* auth_factory = |
| 8551 new HttpAuthHandlerMock::Factory(); | 8552 new HttpAuthHandlerMock::Factory(); |
| 8552 HttpAuthHandlerMock* auth_handler1 = new HttpAuthHandlerMock(); | 8553 HttpAuthHandlerMock* auth_handler1 = new HttpAuthHandlerMock(); |
| 8553 auth_factory->AddMockHandler(auth_handler1, HttpAuth::AUTH_PROXY); | 8554 auth_factory->AddMockHandler(auth_handler1, HttpAuth::AUTH_PROXY); |
| 8554 HttpAuthHandlerMock* auth_handler2 = new HttpAuthHandlerMock(); | 8555 HttpAuthHandlerMock* auth_handler2 = new HttpAuthHandlerMock(); |
| 8555 auth_factory->AddMockHandler(auth_handler2, HttpAuth::AUTH_PROXY); | 8556 auth_factory->AddMockHandler(auth_handler2, HttpAuth::AUTH_PROXY); |
| 8556 auth_factory->set_do_init_from_challenge(true); | 8557 auth_factory->set_do_init_from_challenge(true); |
| 8557 session_deps.http_auth_handler_factory.reset(auth_factory); | 8558 session_deps.http_auth_handler_factory.reset(auth_factory); |
| (...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9846 session->spdy_session_pool()->HasSession(host_port_proxy_pair_b)); | 9847 session->spdy_session_pool()->HasSession(host_port_proxy_pair_b)); |
| 9847 | 9848 |
| 9848 HttpStreamFactory::set_next_protos(std::vector<std::string>()); | 9849 HttpStreamFactory::set_next_protos(std::vector<std::string>()); |
| 9849 ClientSocketPoolManager::set_max_sockets_per_pool(old_max_sockets_per_pool); | 9850 ClientSocketPoolManager::set_max_sockets_per_pool(old_max_sockets_per_pool); |
| 9850 ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 9851 ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 9851 old_max_sockets_per_proxy_server); | 9852 old_max_sockets_per_proxy_server); |
| 9852 ClientSocketPoolManager::set_max_sockets_per_group(old_max_sockets_per_group); | 9853 ClientSocketPoolManager::set_max_sockets_per_group(old_max_sockets_per_group); |
| 9853 } | 9854 } |
| 9854 | 9855 |
| 9855 } // namespace net | 9856 } // namespace net |
| OLD | NEW |