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_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443"); | 1180 ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443"); |
1181 | 1181 |
1182 // Set up the proxy server as a server that supports request priorities. | 1182 // Set up the proxy server as a server that supports request priorities. |
1183 HttpServerPropertiesImpl http_server_properties; | 1183 HttpServerPropertiesImpl http_server_properties; |
1184 if (set_http_server_properties) { | 1184 if (set_http_server_properties) { |
1185 url::SchemeHostPort spdy_server("https", "myproxy.org", 443); | 1185 url::SchemeHostPort spdy_server("https", "myproxy.org", 443); |
1186 http_server_properties.SetSupportsSpdy(spdy_server, true); | 1186 http_server_properties.SetSupportsSpdy(spdy_server, true); |
1187 } | 1187 } |
1188 | 1188 |
1189 SpdySessionDependencies session_deps; | 1189 SpdySessionDependencies session_deps; |
1190 session_deps.restrict_to_one_preconnect_for_proxies = true; | |
1191 HttpNetworkSession::Params params = | 1190 HttpNetworkSession::Params params = |
1192 SpdySessionDependencies::CreateSessionParams(&session_deps); | 1191 SpdySessionDependencies::CreateSessionParams(&session_deps); |
1193 params.enable_quic = true; | 1192 params.enable_quic = true; |
1194 params.proxy_service = proxy_service.get(); | 1193 params.proxy_service = proxy_service.get(); |
1195 params.http_server_properties = &http_server_properties; | 1194 params.http_server_properties = &http_server_properties; |
1196 ASSERT_TRUE(params.restrict_to_one_preconnect_for_proxies); | |
1197 | 1195 |
1198 std::unique_ptr<HttpNetworkSession> session( | 1196 std::unique_ptr<HttpNetworkSession> session( |
1199 new HttpNetworkSession(params)); | 1197 new HttpNetworkSession(params)); |
1200 | 1198 |
1201 HttpNetworkSessionPeer peer(session.get()); | 1199 HttpNetworkSessionPeer peer(session.get()); |
1202 HostPortPair proxy_host("myproxy.org", 443); | 1200 HostPortPair proxy_host("myproxy.org", 443); |
1203 | 1201 |
1204 for (int preconnect_request = 0; preconnect_request < 2; | 1202 for (int preconnect_request = 0; preconnect_request < 2; |
1205 ++preconnect_request) { | 1203 ++preconnect_request) { |
1206 CapturePreconnectsHttpProxySocketPool* http_proxy_pool = | 1204 CapturePreconnectsHttpProxySocketPool* http_proxy_pool = |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 std::unique_ptr<ProxyService> proxy_service = | 1269 std::unique_ptr<ProxyService> proxy_service = |
1272 ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443"); | 1270 ProxyService::CreateFixedFromPacResult("HTTPS myproxy.org:443"); |
1273 | 1271 |
1274 // Set up the proxy server as a server that supports request priorities. | 1272 // Set up the proxy server as a server that supports request priorities. |
1275 HttpServerPropertiesImpl http_server_properties; | 1273 HttpServerPropertiesImpl http_server_properties; |
1276 | 1274 |
1277 url::SchemeHostPort spdy_server("https", "myproxy.org", 443); | 1275 url::SchemeHostPort spdy_server("https", "myproxy.org", 443); |
1278 http_server_properties.SetSupportsSpdy(spdy_server, true); | 1276 http_server_properties.SetSupportsSpdy(spdy_server, true); |
1279 | 1277 |
1280 SpdySessionDependencies session_deps; | 1278 SpdySessionDependencies session_deps; |
1281 session_deps.restrict_to_one_preconnect_for_proxies = true; | |
1282 HttpNetworkSession::Params params = | 1279 HttpNetworkSession::Params params = |
1283 SpdySessionDependencies::CreateSessionParams(&session_deps); | 1280 SpdySessionDependencies::CreateSessionParams(&session_deps); |
1284 params.enable_quic = true; | 1281 params.enable_quic = true; |
1285 params.proxy_service = proxy_service.get(); | 1282 params.proxy_service = proxy_service.get(); |
1286 params.http_server_properties = &http_server_properties; | 1283 params.http_server_properties = &http_server_properties; |
1287 ASSERT_TRUE(params.restrict_to_one_preconnect_for_proxies); | |
1288 | 1284 |
1289 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params)); | 1285 std::unique_ptr<HttpNetworkSession> session(new HttpNetworkSession(params)); |
1290 | 1286 |
1291 HttpNetworkSessionPeer peer(session.get()); | 1287 HttpNetworkSessionPeer peer(session.get()); |
1292 HostPortPair proxy_host("myproxy.org", 443); | 1288 HostPortPair proxy_host("myproxy.org", 443); |
1293 | 1289 |
1294 CapturePreconnectsHttpProxySocketPool* http_proxy_pool = | 1290 CapturePreconnectsHttpProxySocketPool* http_proxy_pool = |
1295 new CapturePreconnectsHttpProxySocketPool( | 1291 new CapturePreconnectsHttpProxySocketPool( |
1296 session_deps.host_resolver.get(), session_deps.cert_verifier.get(), | 1292 session_deps.host_resolver.get(), session_deps.cert_verifier.get(), |
1297 session_deps.transport_security_state.get(), | 1293 session_deps.transport_security_state.get(), |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 HttpNetworkSession::WEBSOCKET_SOCKET_POOL, | 1689 HttpNetworkSession::WEBSOCKET_SOCKET_POOL, |
1694 HostPortPair("myproxy", 8888)))); | 1690 HostPortPair("myproxy", 8888)))); |
1695 EXPECT_FALSE(waiter.used_proxy_info().is_direct()); | 1691 EXPECT_FALSE(waiter.used_proxy_info().is_direct()); |
1696 } | 1692 } |
1697 | 1693 |
1698 // Verifies that once a stream has been created to a proxy server (that supports | 1694 // Verifies that once a stream has been created to a proxy server (that supports |
1699 // request priorities) the next preconnect job can again open new sockets. | 1695 // request priorities) the next preconnect job can again open new sockets. |
1700 TEST_F(HttpStreamFactoryTest, RequestHttpStreamOverProxyWithPreconnects) { | 1696 TEST_F(HttpStreamFactoryTest, RequestHttpStreamOverProxyWithPreconnects) { |
1701 SpdySessionDependencies session_deps( | 1697 SpdySessionDependencies session_deps( |
1702 ProxyService::CreateFixed("https://myproxy.org:443")); | 1698 ProxyService::CreateFixed("https://myproxy.org:443")); |
1703 session_deps.restrict_to_one_preconnect_for_proxies = true; | |
1704 | 1699 |
1705 // Set up the proxy server as a server that supports request priorities. | 1700 // Set up the proxy server as a server that supports request priorities. |
1706 std::unique_ptr<HttpServerPropertiesImpl> http_server_properties( | 1701 std::unique_ptr<HttpServerPropertiesImpl> http_server_properties( |
1707 new HttpServerPropertiesImpl()); | 1702 new HttpServerPropertiesImpl()); |
1708 url::SchemeHostPort spdy_server("https", "myproxy.org", 443); | 1703 url::SchemeHostPort spdy_server("https", "myproxy.org", 443); |
1709 http_server_properties->SetSupportsSpdy(spdy_server, true); | 1704 http_server_properties->SetSupportsSpdy(spdy_server, true); |
1710 session_deps.http_server_properties = std::move(http_server_properties); | 1705 session_deps.http_server_properties = std::move(http_server_properties); |
1711 | 1706 |
1712 StaticSocketDataProvider socket_data; | 1707 StaticSocketDataProvider socket_data; |
1713 socket_data.set_connect_data(MockConnect(ASYNC, OK)); | 1708 socket_data.set_connect_data(MockConnect(ASYNC, OK)); |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2703 session->GetTransportSocketPool( | 2698 session->GetTransportSocketPool( |
2704 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | 2699 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); |
2705 EXPECT_EQ(1, GetSocketPoolGroupCount( | 2700 EXPECT_EQ(1, GetSocketPoolGroupCount( |
2706 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | 2701 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); |
2707 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 2702 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
2708 } | 2703 } |
2709 | 2704 |
2710 } // namespace | 2705 } // namespace |
2711 | 2706 |
2712 } // namespace net | 2707 } // namespace net |
OLD | NEW |