| 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_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "net/socket/ssl_client_socket_pool.h" | 37 #include "net/socket/ssl_client_socket_pool.h" |
| 38 #include "net/spdy/spdy_http_stream.h" | 38 #include "net/spdy/spdy_http_stream.h" |
| 39 #include "net/spdy/spdy_session.h" | 39 #include "net/spdy/spdy_session.h" |
| 40 #include "net/spdy/spdy_session_pool.h" | 40 #include "net/spdy/spdy_session_pool.h" |
| 41 | 41 |
| 42 namespace net { | 42 namespace net { |
| 43 | 43 |
| 44 // Returns parameters associated with the start of a HTTP stream job. | 44 // Returns parameters associated with the start of a HTTP stream job. |
| 45 Value* NetLogHttpStreamJobCallback(const GURL* original_url, | 45 Value* NetLogHttpStreamJobCallback(const GURL* original_url, |
| 46 const GURL* url, | 46 const GURL* url, |
| 47 RequestPriority priority, |
| 47 NetLog::LogLevel /* log_level */) { | 48 NetLog::LogLevel /* log_level */) { |
| 48 DictionaryValue* dict = new DictionaryValue(); | 49 DictionaryValue* dict = new DictionaryValue(); |
| 49 dict->SetString("original_url", original_url->GetOrigin().spec()); | 50 dict->SetString("original_url", original_url->GetOrigin().spec()); |
| 50 dict->SetString("url", url->GetOrigin().spec()); | 51 dict->SetString("url", url->GetOrigin().spec()); |
| 52 dict->SetInteger("priority", priority); |
| 51 return dict; | 53 return dict; |
| 52 } | 54 } |
| 53 | 55 |
| 54 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP | 56 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP |
| 55 // stream. | 57 // stream. |
| 56 Value* NetLogHttpStreamProtoCallback( | 58 Value* NetLogHttpStreamProtoCallback( |
| 57 const SSLClientSocket::NextProtoStatus status, | 59 const SSLClientSocket::NextProtoStatus status, |
| 58 const std::string* proto, | 60 const std::string* proto, |
| 59 const std::string* server_protos, | 61 const std::string* server_protos, |
| 60 NetLog::LogLevel /* log_level */) { | 62 NetLog::LogLevel /* log_level */) { |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 571 |
| 570 int HttpStreamFactoryImpl::Job::DoStart() { | 572 int HttpStreamFactoryImpl::Job::DoStart() { |
| 571 int port = request_info_.url.EffectiveIntPort(); | 573 int port = request_info_.url.EffectiveIntPort(); |
| 572 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); | 574 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); |
| 573 origin_url_ = stream_factory_->ApplyHostMappingRules( | 575 origin_url_ = stream_factory_->ApplyHostMappingRules( |
| 574 request_info_.url, &origin_); | 576 request_info_.url, &origin_); |
| 575 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_)); | 577 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_)); |
| 576 | 578 |
| 577 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, | 579 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, |
| 578 base::Bind(&NetLogHttpStreamJobCallback, | 580 base::Bind(&NetLogHttpStreamJobCallback, |
| 579 &request_info_.url, &origin_url_)); | 581 &request_info_.url, &origin_url_, |
| 582 request_info_.priority)); |
| 580 | 583 |
| 581 // Don't connect to restricted ports. | 584 // Don't connect to restricted ports. |
| 582 bool is_port_allowed = IsPortAllowedByDefault(port); | 585 bool is_port_allowed = IsPortAllowedByDefault(port); |
| 583 if (request_info_.url.SchemeIs("ftp")) { | 586 if (request_info_.url.SchemeIs("ftp")) { |
| 584 // Never share connection with other jobs for FTP requests. | 587 // Never share connection with other jobs for FTP requests. |
| 585 DCHECK(!waiting_job_); | 588 DCHECK(!waiting_job_); |
| 586 | 589 |
| 587 is_port_allowed = IsPortAllowedByFtp(port); | 590 is_port_allowed = IsPortAllowedByFtp(port); |
| 588 } | 591 } |
| 589 if (!is_port_allowed && !IsPortAllowedByOverride(port)) { | 592 if (!is_port_allowed && !IsPortAllowedByOverride(port)) { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | 1354 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
| 1352 net::LOAD_IS_DOWNLOAD)) { | 1355 net::LOAD_IS_DOWNLOAD)) { |
| 1353 // Avoid pipelining resources that may be streamed for a long time. | 1356 // Avoid pipelining resources that may be streamed for a long time. |
| 1354 return false; | 1357 return false; |
| 1355 } | 1358 } |
| 1356 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1359 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
| 1357 *http_pipelining_key_.get()); | 1360 *http_pipelining_key_.get()); |
| 1358 } | 1361 } |
| 1359 | 1362 |
| 1360 } // namespace net | 1363 } // namespace net |
| OLD | NEW |