| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 int HttpStreamFactoryImpl::Job::DoStart() { | 616 int HttpStreamFactoryImpl::Job::DoStart() { |
| 617 origin_ = HostPortPair::FromURL(request_info_.url); | 617 origin_ = HostPortPair::FromURL(request_info_.url); |
| 618 origin_url_ = stream_factory_->ApplyHostMappingRules( | 618 origin_url_ = stream_factory_->ApplyHostMappingRules( |
| 619 request_info_.url, &origin_); | 619 request_info_.url, &origin_); |
| 620 | 620 |
| 621 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, | 621 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, |
| 622 base::Bind(&NetLogHttpStreamJobCallback, | 622 base::Bind(&NetLogHttpStreamJobCallback, |
| 623 &request_info_.url, &origin_url_, | 623 &request_info_.url, &origin_url_, |
| 624 priority_)); | 624 priority_)); |
| 625 | 625 |
| 626 // Don't connect to restricted ports. | |
| 627 bool is_port_allowed = IsPortAllowedByDefault(origin_.port()); | |
| 628 if (request_info_.url.SchemeIs("ftp")) { | 626 if (request_info_.url.SchemeIs("ftp")) { |
| 629 // Never share connection with other jobs for FTP requests. | 627 // Never share connection with other jobs for FTP requests. |
| 630 DCHECK(!waiting_job_); | 628 DCHECK(!waiting_job_); |
| 629 } |
| 631 | 630 |
| 632 is_port_allowed = IsPortAllowedByFtp(origin_.port()); | 631 // Don't connect to restricted ports. |
| 633 } | 632 // Note: origin_.port() == request_info_.url.EffectiveIntPort() |
| 634 if (!is_port_allowed && !IsPortAllowedByOverride(origin_.port())) { | 633 if (!IsEffectivePortAllowedByScheme(request_info_.url) && |
| 634 !IsPortAllowedByOverride(origin_.port())) { |
| 635 if (waiting_job_) { | 635 if (waiting_job_) { |
| 636 waiting_job_->Resume(this); | 636 waiting_job_->Resume(this); |
| 637 waiting_job_ = NULL; | 637 waiting_job_ = NULL; |
| 638 } | 638 } |
| 639 return ERR_UNSAFE_PORT; | 639 return ERR_UNSAFE_PORT; |
| 640 } | 640 } |
| 641 | 641 |
| 642 next_state_ = STATE_RESOLVE_PROXY; | 642 next_state_ = STATE_RESOLVE_PROXY; |
| 643 return OK; | 643 return OK; |
| 644 } | 644 } |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 | 1463 |
| 1464 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1464 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
| 1465 HistogramBrokenAlternateProtocolLocation( | 1465 HistogramBrokenAlternateProtocolLocation( |
| 1466 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1466 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
| 1467 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1467 session_->http_server_properties()->SetBrokenAlternateProtocol( |
| 1468 HostPortPair::FromURL(request_info_.url)); | 1468 HostPortPair::FromURL(request_info_.url)); |
| 1469 } | 1469 } |
| 1470 } | 1470 } |
| 1471 | 1471 |
| 1472 } // namespace net | 1472 } // namespace net |
| OLD | NEW |