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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. | 626 // Don't connect to restricted ports. |
627 bool is_port_allowed = IsPortAllowedByDefault(origin_.port()); | 627 bool is_port_allowed = IsPortAllowedByDefault(origin_.port()); |
davidben
2014/12/02 20:39:45
This was in the original, but it's really weird th
lgarron
2014/12/02 20:49:00
What about a more general helper function called I
| |
628 if (request_info_.url.SchemeIs("ftp")) { | 628 if (request_info_.url.SchemeIs("ftp")) { |
629 // Never share connection with other jobs for FTP requests. | 629 // Never share connection with other jobs for FTP requests. |
630 DCHECK(!waiting_job_); | 630 DCHECK(!waiting_job_); |
631 | 631 |
632 is_port_allowed = IsPortAllowedByFtp(origin_.port()); | 632 is_port_allowed = IsPortAllowedByFtp(origin_.port()); |
633 } | 633 } |
634 if (request_info_.url.SchemeIs("https") || | |
635 request_info_.url.SchemeIs("wss")) { | |
636 is_port_allowed = IsPortAllowedByHttpsOrWss(origin_.port()); | |
637 } | |
638 | |
634 if (!is_port_allowed && !IsPortAllowedByOverride(origin_.port())) { | 639 if (!is_port_allowed && !IsPortAllowedByOverride(origin_.port())) { |
635 if (waiting_job_) { | 640 if (waiting_job_) { |
636 waiting_job_->Resume(this); | 641 waiting_job_->Resume(this); |
637 waiting_job_ = NULL; | 642 waiting_job_ = NULL; |
638 } | 643 } |
639 return ERR_UNSAFE_PORT; | 644 return ERR_UNSAFE_PORT; |
640 } | 645 } |
641 | 646 |
642 next_state_ = STATE_RESOLVE_PROXY; | 647 next_state_ = STATE_RESOLVE_PROXY; |
643 return OK; | 648 return OK; |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1463 | 1468 |
1464 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { | 1469 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { |
1465 HistogramBrokenAlternateProtocolLocation( | 1470 HistogramBrokenAlternateProtocolLocation( |
1466 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); | 1471 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); |
1467 session_->http_server_properties()->SetBrokenAlternateProtocol( | 1472 session_->http_server_properties()->SetBrokenAlternateProtocol( |
1468 HostPortPair::FromURL(request_info_.url)); | 1473 HostPortPair::FromURL(request_info_.url)); |
1469 } | 1474 } |
1470 } | 1475 } |
1471 | 1476 |
1472 } // namespace net | 1477 } // namespace net |
OLD | NEW |