| 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 <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 9078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9089 }; | 9089 }; |
| 9090 | 9090 |
| 9091 std::unique_ptr<HttpNetworkSession> SetupSessionForGroupNameTests( | 9091 std::unique_ptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
| 9092 NextProto next_proto, | 9092 NextProto next_proto, |
| 9093 SpdySessionDependencies* session_deps_) { | 9093 SpdySessionDependencies* session_deps_) { |
| 9094 std::unique_ptr<HttpNetworkSession> session(CreateSession(session_deps_)); | 9094 std::unique_ptr<HttpNetworkSession> session(CreateSession(session_deps_)); |
| 9095 | 9095 |
| 9096 HttpServerProperties* http_server_properties = | 9096 HttpServerProperties* http_server_properties = |
| 9097 session->http_server_properties(); | 9097 session->http_server_properties(); |
| 9098 AlternativeService alternative_service( | 9098 AlternativeService alternative_service( |
| 9099 AlternateProtocolFromNextProto(next_proto), "", 443); | 9099 AlternateProtocolFromNextProto(next_proto), "", 444); |
| 9100 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9100 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9101 http_server_properties->SetAlternativeService( | 9101 http_server_properties->SetAlternativeService( |
| 9102 url::SchemeHostPort("http", "host.with.alternate", 80), | 9102 url::SchemeHostPort("https", "host.with.alternate", 443), |
| 9103 alternative_service, expiration); | 9103 alternative_service, expiration); |
| 9104 | 9104 |
| 9105 return session; | 9105 return session; |
| 9106 } | 9106 } |
| 9107 | 9107 |
| 9108 int GroupNameTransactionHelper(const std::string& url, | 9108 int GroupNameTransactionHelper(const std::string& url, |
| 9109 HttpNetworkSession* session) { | 9109 HttpNetworkSession* session) { |
| 9110 HttpRequestInfo request; | 9110 HttpRequestInfo request; |
| 9111 request.method = "GET"; | 9111 request.method = "GET"; |
| 9112 request.url = GURL(url); | 9112 request.url = GURL(url); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9146 true, | 9146 true, |
| 9147 }, | 9147 }, |
| 9148 { | 9148 { |
| 9149 "", // unused | 9149 "", // unused |
| 9150 "https://[2001:1418:13:1::25]/direct", | 9150 "https://[2001:1418:13:1::25]/direct", |
| 9151 "ssl/[2001:1418:13:1::25]:443", | 9151 "ssl/[2001:1418:13:1::25]:443", |
| 9152 true, | 9152 true, |
| 9153 }, | 9153 }, |
| 9154 { | 9154 { |
| 9155 "", // unused | 9155 "", // unused |
| 9156 "http://host.with.alternate/direct", | 9156 "https://host.with.alternate/direct", |
| 9157 "ssl/host.with.alternate:443", | 9157 "ssl/host.with.alternate:443", |
| 9158 true, | 9158 true, |
| 9159 }, | 9159 }, |
| 9160 }; | 9160 }; |
| 9161 | 9161 |
| 9162 session_deps_.enable_alternative_service_with_different_host = false; | 9162 session_deps_.enable_alternative_service_with_different_host = false; |
| 9163 | 9163 |
| 9164 for (size_t i = 0; i < arraysize(tests); ++i) { | 9164 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 9165 session_deps_.proxy_service = | 9165 session_deps_.proxy_service = |
| 9166 ProxyService::CreateFixed(tests[i].proxy_server); | 9166 ProxyService::CreateFixed(tests[i].proxy_server); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9201 // SSL Tests | 9201 // SSL Tests |
| 9202 { | 9202 { |
| 9203 "http_proxy", | 9203 "http_proxy", |
| 9204 "https://www.example.org/http_connect_ssl", | 9204 "https://www.example.org/http_connect_ssl", |
| 9205 "ssl/www.example.org:443", | 9205 "ssl/www.example.org:443", |
| 9206 true, | 9206 true, |
| 9207 }, | 9207 }, |
| 9208 | 9208 |
| 9209 { | 9209 { |
| 9210 "http_proxy", | 9210 "http_proxy", |
| 9211 "http://host.with.alternate/direct", | 9211 "https://host.with.alternate/direct", |
| 9212 "ssl/host.with.alternate:443", | 9212 "ssl/host.with.alternate:443", |
| 9213 true, | 9213 true, |
| 9214 }, | 9214 }, |
| 9215 | 9215 |
| 9216 { | 9216 { |
| 9217 "http_proxy", | 9217 "http_proxy", |
| 9218 "ftp://ftp.google.com/http_proxy_normal", | 9218 "ftp://ftp.google.com/http_proxy_normal", |
| 9219 "ftp/ftp.google.com:21", | 9219 "ftp/ftp.google.com:21", |
| 9220 false, | 9220 false, |
| 9221 }, | 9221 }, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9278 }, | 9278 }, |
| 9279 { | 9279 { |
| 9280 "socks5://socks_proxy:1080", | 9280 "socks5://socks_proxy:1080", |
| 9281 "https://www.example.org/socks5_ssl", | 9281 "https://www.example.org/socks5_ssl", |
| 9282 "socks5/ssl/www.example.org:443", | 9282 "socks5/ssl/www.example.org:443", |
| 9283 true, | 9283 true, |
| 9284 }, | 9284 }, |
| 9285 | 9285 |
| 9286 { | 9286 { |
| 9287 "socks4://socks_proxy:1080", | 9287 "socks4://socks_proxy:1080", |
| 9288 "http://host.with.alternate/direct", | 9288 "https://host.with.alternate/direct", |
| 9289 "socks4/ssl/host.with.alternate:443", | 9289 "socks4/ssl/host.with.alternate:443", |
| 9290 true, | 9290 true, |
| 9291 }, | 9291 }, |
| 9292 }; | 9292 }; |
| 9293 | 9293 |
| 9294 session_deps_.enable_alternative_service_with_different_host = false; | 9294 session_deps_.enable_alternative_service_with_different_host = false; |
| 9295 | 9295 |
| 9296 for (size_t i = 0; i < arraysize(tests); ++i) { | 9296 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 9297 session_deps_.proxy_service = | 9297 session_deps_.proxy_service = |
| 9298 ProxyService::CreateFixed(tests[i].proxy_server); | 9298 ProxyService::CreateFixed(tests[i].proxy_server); |
| (...skipping 6845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16144 base::RunLoop().RunUntilIdle(); | 16144 base::RunLoop().RunUntilIdle(); |
| 16145 | 16145 |
| 16146 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); | 16146 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); |
| 16147 HttpRequestHeaders headers; | 16147 HttpRequestHeaders headers; |
| 16148 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); | 16148 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); |
| 16149 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); | 16149 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); |
| 16150 } | 16150 } |
| 16151 #endif // !defined(OS_IOS) | 16151 #endif // !defined(OS_IOS) |
| 16152 | 16152 |
| 16153 } // namespace net | 16153 } // namespace net |
| OLD | NEW |