Index: net/http/http_stream_factory_impl_job.cc |
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc |
index 34bab8a3b29b3e3d24bcffb09cf42dae0a3c802b..64c7ea5d08ae286dc9235b198f8b1c4f6d82ae92 100644 |
--- a/net/http/http_stream_factory_impl_job.cc |
+++ b/net/http/http_stream_factory_impl_job.cc |
@@ -125,7 +125,7 @@ std::unique_ptr<base::Value> NetLogHttpStreamJobCallback( |
const NetLogSource& source, |
const GURL* original_url, |
const GURL* url, |
- const AlternativeService* alternative_service, |
+ const AlternativeServiceInfo* alternative_service_info, |
RequestPriority priority, |
NetLogCaptureMode /* capture_mode */) { |
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
@@ -133,7 +133,8 @@ std::unique_ptr<base::Value> NetLogHttpStreamJobCallback( |
source.AddToEventParameters(dict.get()); |
dict->SetString("original_url", original_url->GetOrigin().spec()); |
dict->SetString("url", url->GetOrigin().spec()); |
- dict->SetString("alternative_service", alternative_service->ToString()); |
+ dict->SetString("alternative_service", |
+ alternative_service_info->alternative_service.ToString()); |
dict->SetString("priority", RequestPriorityToString(priority)); |
return std::move(dict); |
} |
@@ -171,25 +172,26 @@ HttpStreamFactoryImpl::Job::Job(Delegate* delegate, |
proxy_ssl_config, |
destination, |
origin_url, |
- AlternativeService(), |
+ AlternativeServiceInfo(), |
ProxyServer(), |
enable_ip_based_pooling, |
net_log) {} |
-HttpStreamFactoryImpl::Job::Job(Delegate* delegate, |
- JobType job_type, |
- HttpNetworkSession* session, |
- const HttpRequestInfo& request_info, |
- RequestPriority priority, |
- const ProxyInfo& proxy_info, |
- const SSLConfig& server_ssl_config, |
- const SSLConfig& proxy_ssl_config, |
- HostPortPair destination, |
- GURL origin_url, |
- AlternativeService alternative_service, |
- const ProxyServer& alternative_proxy_server, |
- bool enable_ip_based_pooling, |
- NetLog* net_log) |
+HttpStreamFactoryImpl::Job::Job( |
+ Delegate* delegate, |
+ JobType job_type, |
+ HttpNetworkSession* session, |
+ const HttpRequestInfo& request_info, |
+ RequestPriority priority, |
+ const ProxyInfo& proxy_info, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config, |
+ HostPortPair destination, |
+ GURL origin_url, |
+ const AlternativeServiceInfo& alternative_service_info, |
+ const ProxyServer& alternative_proxy_server, |
+ bool enable_ip_based_pooling, |
+ NetLog* net_log) |
: request_info_(request_info), |
priority_(priority), |
proxy_info_(proxy_info), |
@@ -204,7 +206,7 @@ HttpStreamFactoryImpl::Job::Job(Delegate* delegate, |
next_state_(STATE_NONE), |
destination_(destination), |
origin_url_(origin_url), |
- alternative_service_(alternative_service), |
+ alternative_service_info_(alternative_service_info), |
alternative_proxy_server_(alternative_proxy_server), |
enable_ip_based_pooling_(enable_ip_based_pooling), |
delegate_(delegate), |
@@ -228,14 +230,16 @@ HttpStreamFactoryImpl::Job::Job(Delegate* delegate, |
// the same time since alternative services are used for requests that are |
// fetched directly, while the alternative proxy server is used for requests |
// that should be fetched using proxy. |
- DCHECK(alternative_service_.protocol == kProtoUnknown || |
+ DCHECK(alternative_service_info_.alternative_service.protocol == |
+ kProtoUnknown || |
!alternative_proxy_server_.is_valid()); |
DCHECK(!alternative_proxy_server_.is_valid() || |
!(IsSpdyAlternative() || IsQuicAlternative())); |
// If either the alternative service protocol is specified or if the |
// alternative proxy server is valid, then the job type must be set to |
// either ALTERNATIVE or PRECONNECT. |
- DCHECK((alternative_service_.protocol == kProtoUnknown && |
+ DCHECK((alternative_service_info_.alternative_service.protocol == |
+ kProtoUnknown && |
!alternative_proxy_server_.is_valid()) || |
(job_type_ == ALTERNATIVE || job_type_ == PRECONNECT)); |
// If the alternative proxy server is valid, then the job type must be |
@@ -730,7 +734,7 @@ int HttpStreamFactoryImpl::Job::DoStart() { |
net_log_.BeginEvent( |
NetLogEventType::HTTP_STREAM_JOB, |
base::Bind(&NetLogHttpStreamJobCallback, net_log->source(), |
- &request_info_.url, &origin_url_, &alternative_service_, |
+ &request_info_.url, &origin_url_, &alternative_service_info_, |
priority_)); |
net_log->AddEvent(NetLogEventType::HTTP_STREAM_REQUEST_STARTED_JOB, |
net_log_.source().ToEventParametersCallback()); |
@@ -858,10 +862,15 @@ int HttpStreamFactoryImpl::Job::DoInitConnectionImpl() { |
destination = destination_; |
ssl_config = &server_ssl_config_; |
} |
- int rv = |
- quic_request_.Request(destination, request_info_.privacy_mode, |
- ssl_config->GetCertVerifyFlags(), url, |
- request_info_.method, net_log_, io_callback_); |
+ QuicVersionVector advertised_versions; |
+ advertised_versions.push_back(QUIC_VERSION_37); |
+ // TODO(zhongyi): change this to |
+ // alternative_service_info_.advertised_versions. |
+ |
+ int rv = quic_request_.Request( |
+ destination, advertised_versions, request_info_.privacy_mode, |
+ ssl_config->GetCertVerifyFlags(), url, request_info_.method, net_log_, |
+ io_callback_); |
if (rv == OK) { |
using_existing_quic_session_ = true; |
} else { |
@@ -1290,11 +1299,11 @@ bool HttpStreamFactoryImpl::Job::IsHttpsProxyAndHttpUrl() const { |
} |
bool HttpStreamFactoryImpl::Job::IsSpdyAlternative() const { |
- return alternative_service_.protocol == kProtoHTTP2; |
+ return alternative_service_info_.alternative_service.protocol == kProtoHTTP2; |
} |
bool HttpStreamFactoryImpl::Job::IsQuicAlternative() const { |
- return alternative_service_.protocol == kProtoQUIC; |
+ return alternative_service_info_.alternative_service.protocol == kProtoQUIC; |
} |
void HttpStreamFactoryImpl::Job::InitSSLConfig(SSLConfig* ssl_config, |
@@ -1479,13 +1488,14 @@ HttpStreamFactoryImpl::JobFactory::CreateAltSvcJob( |
const SSLConfig& proxy_ssl_config, |
HostPortPair destination, |
GURL origin_url, |
- AlternativeService alternative_service, |
+ const AlternativeServiceInfo& alternative_service_info, |
bool enable_ip_based_pooling, |
NetLog* net_log) { |
return base::MakeUnique<HttpStreamFactoryImpl::Job>( |
delegate, job_type, session, request_info, priority, proxy_info, |
server_ssl_config, proxy_ssl_config, destination, origin_url, |
- alternative_service, ProxyServer(), enable_ip_based_pooling, net_log); |
+ alternative_service_info, ProxyServer(), enable_ip_based_pooling, |
+ net_log); |
} |
std::unique_ptr<HttpStreamFactoryImpl::Job> |
@@ -1506,8 +1516,8 @@ HttpStreamFactoryImpl::JobFactory::CreateAltProxyJob( |
return base::MakeUnique<HttpStreamFactoryImpl::Job>( |
delegate, job_type, session, request_info, priority, proxy_info, |
server_ssl_config, proxy_ssl_config, destination, origin_url, |
- AlternativeService(), alternative_proxy_server, enable_ip_based_pooling, |
- net_log); |
+ AlternativeServiceInfo(), alternative_proxy_server, |
+ enable_ip_based_pooling, net_log); |
} |
} // namespace net |