Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 770343003: Block port 443 for all protocols other than HTTPS or WSS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add link to issue in comment next to port 443 on the (default) blocked list. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698