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

Unified Diff: net/url_request/ftp_protocol_handler.cc

Issue 1436243003: Don't allow FTP requests to HSTS-enabled domains. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/ftp_protocol_handler.cc
diff --git a/net/url_request/ftp_protocol_handler.cc b/net/url_request/ftp_protocol_handler.cc
index 4c10124ceed561394fb91791304affe231f7b684..237a2b568fc1bbf8eaf86a9decee845dc950e306 100644
--- a/net/url_request/ftp_protocol_handler.cc
+++ b/net/url_request/ftp_protocol_handler.cc
@@ -8,7 +8,9 @@
#include "net/base/net_errors.h"
#include "net/base/port_util.h"
#include "net/ftp/ftp_auth_cache.h"
+#include "net/http/transport_security_state.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_ftp_job.h"
#include "url/gurl.h"
@@ -34,6 +36,13 @@ URLRequestJob* FtpProtocolHandler::MaybeCreateJob(
return new URLRequestErrorJob(request, network_delegate, ERR_UNSAFE_PORT);
}
+ TransportSecurityState* state =
+ request->context()->transport_security_state();
+ if (state && state->ShouldUpgradeToSSL(request->url().host())) {
+ return new URLRequestErrorJob(request, network_delegate,
+ ERR_DISALLOWED_URL_SCHEME);
+ }
+
return new URLRequestFtpJob(request,
network_delegate,
ftp_transaction_factory_,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698