Index: net/url_request/url_request_http_job.cc |
=================================================================== |
--- net/url_request/url_request_http_job.cc (revision 6791) |
+++ net/url_request/url_request_http_job.cc (working copy) |
@@ -4,6 +4,8 @@ |
#include "net/url_request/url_request_http_job.h" |
+#include "base/base_switches.h" |
+#include "base/command_line.h" |
#include "base/compiler_specific.h" |
#include "base/file_util.h" |
#include "base/file_version_info.h" |
@@ -37,6 +39,13 @@ |
return new URLRequestErrorJob(request, net::ERR_INVALID_ARGUMENT); |
} |
+ // We cache the value of the switch because this code path is hit on every |
+ // network request. |
+ static const bool kForceHTTPS = |
+ CommandLine().HasSwitch(switches::kForceHTTPS); |
wtc
2008/12/15 18:14:15
Nit: this line seems to be over-indented.
|
+ if (kForceHTTPS && scheme == "http") |
jar (doing other things)
2008/12/15 08:34:17
Perhaps you should even be more aggressive and use
|
+ return new URLRequestErrorJob(request, net::ERR_DISALLOWED_URL_SCHEME); |
+ |
return new URLRequestHttpJob(request); |
} |
@@ -375,7 +384,8 @@ |
if (result == net::OK) { |
NotifyHeadersComplete(); |
- } else if (net::IsCertificateError(result)) { |
+ } else if (net::IsCertificateError(result) && |
+ !CommandLine().HasSwitch(switches::kForceHTTPS)) { |
// We encountered an SSL certificate error. Ask our delegate to decide |
// what we should do. |
// TODO(wtc): also pass ssl_info.cert_status, or just pass the whole |