| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ret.push_back(value); | 91 ret.push_back(value); |
| 92 } | 92 } |
| 93 va_end(args); | 93 va_end(args); |
| 94 | 94 |
| 95 return ret; | 95 return ret; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating | 98 // SpdyNextProtos returns a vector of NPN protocol strings for negotiating |
| 99 // SPDY. | 99 // SPDY. |
| 100 std::vector<std::string> SpdyNextProtos() { | 100 std::vector<std::string> SpdyNextProtos() { |
| 101 return MakeNextProtos("http/1.1", "spdy/2", "spdy/2.1", "spdy/3", NULL); | 101 return MakeNextProtos("http/1.1", "spdy/2", "spdy/3", NULL); |
| 102 } | 102 } |
| 103 | 103 |
| 104 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { | 104 int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) { |
| 105 return session->GetTransportSocketPool( | 105 return session->GetTransportSocketPool( |
| 106 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 106 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { | 109 int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) { |
| 110 return session->GetSSLSocketPool( | 110 return session->GetSSLSocketPool( |
| 111 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); | 111 net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount(); |
| (...skipping 8334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8446 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 8446 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 8447 HttpStreamFactory::set_use_alternate_protocols(false); | 8447 HttpStreamFactory::set_use_alternate_protocols(false); |
| 8448 } | 8448 } |
| 8449 | 8449 |
| 8450 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { | 8450 TEST_F(HttpNetworkTransactionSpdy3Test, SpdyAlternateProtocolThroughProxy) { |
| 8451 // This test ensures that the URL passed into the proxy is upgraded | 8451 // This test ensures that the URL passed into the proxy is upgraded |
| 8452 // to https when doing an Alternate Protocol upgrade. | 8452 // to https when doing an Alternate Protocol upgrade. |
| 8453 HttpStreamFactory::set_use_alternate_protocols(true); | 8453 HttpStreamFactory::set_use_alternate_protocols(true); |
| 8454 HttpStreamFactory::SetNextProtos( | 8454 HttpStreamFactory::SetNextProtos( |
| 8455 MakeNextProtos( | 8455 MakeNextProtos( |
| 8456 "http/1.1", "http1.1", "spdy/2", "spdy/2.1", "spdy/3", "spdy", NULL)); | 8456 "http/1.1", "http1.1", "spdy/2", "spdy/3", "spdy", NULL)); |
| 8457 | 8457 |
| 8458 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); | 8458 SessionDependencies session_deps(ProxyService::CreateFixed("myproxy:70")); |
| 8459 HttpAuthHandlerMock::Factory* auth_factory = | 8459 HttpAuthHandlerMock::Factory* auth_factory = |
| 8460 new HttpAuthHandlerMock::Factory(); | 8460 new HttpAuthHandlerMock::Factory(); |
| 8461 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); | 8461 HttpAuthHandlerMock* auth_handler = new HttpAuthHandlerMock(); |
| 8462 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); | 8462 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_PROXY); |
| 8463 auth_factory->set_do_init_from_challenge(true); | 8463 auth_factory->set_do_init_from_challenge(true); |
| 8464 session_deps.http_auth_handler_factory.reset(auth_factory); | 8464 session_deps.http_auth_handler_factory.reset(auth_factory); |
| 8465 | 8465 |
| 8466 HttpRequestInfo request; | 8466 HttpRequestInfo request; |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9725 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); | 9725 HttpStreamFactory::SetNextProtos(std::vector<std::string>()); |
| 9726 ClientSocketPoolManager::set_max_sockets_per_pool( | 9726 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 9727 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_pool); | 9727 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_pool); |
| 9728 ClientSocketPoolManager::set_max_sockets_per_proxy_server( | 9728 ClientSocketPoolManager::set_max_sockets_per_proxy_server( |
| 9729 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_proxy_server); | 9729 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_proxy_server); |
| 9730 ClientSocketPoolManager::set_max_sockets_per_group( | 9730 ClientSocketPoolManager::set_max_sockets_per_group( |
| 9731 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_group); | 9731 HttpNetworkSession::NORMAL_SOCKET_POOL, old_max_sockets_per_group); |
| 9732 } | 9732 } |
| 9733 | 9733 |
| 9734 } // namespace net | 9734 } // namespace net |
| OLD | NEW |