From bcb84f8b62103f881ffcb50e8aed0e9bd1a2d821 Mon Sep 17 00:00:00 2001 From: "mirandac@chromium.org" Date: Mon, 31 Aug 2009 16:20:14 +0000 Subject: Adding command-line option to override bans on certain port numbers through a comma-separated list of ports. BUG= http://crbug.com/18307 TEST= url_request_unittest, use commandline flag allowed_ports=1,600. Navigate to http://www.google.com:1 or http://www.google.com:600. You should not get an ERR_UNSAFE_PORT, it will attempt to load the page. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24883 0039d316-1c4b-4281-b951-d872f2087c98 --- net/url_request/url_request_http_job.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'net/url_request/url_request_http_job.h') diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h index fdb32ae..48c155d 100644 --- a/net/url_request/url_request_http_job.h +++ b/net/url_request/url_request_http_job.h @@ -5,6 +5,7 @@ #ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ +#include #include #include @@ -25,6 +26,12 @@ class URLRequestContext; class URLRequestHttpJob : public URLRequestJob { public: static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); + // Specifies a comma separated list of port numbers that should be accepted + // despite bans. If the string is invalid no allowed ports are stored. + static void SetExplicitlyAllowedPorts(const std::wstring& allowed_ports); + static const std::set& explicitly_allowed_ports() { + return explicitly_allowed_ports_; + } virtual ~URLRequestHttpJob(); @@ -78,6 +85,10 @@ class URLRequestHttpJob : public URLRequestJob { void RestartTransactionWithAuth(const std::wstring& username, const std::wstring& password); + // Check if banned |port| has been overriden by an entry in + // |explicitly_allowed_ports_|. + static bool IsPortAllowedByOverride(int port); + // Keep a reference to the url request context to be sure it's not deleted // before us. scoped_refptr context_; @@ -115,6 +126,10 @@ class URLRequestHttpJob : public URLRequestJob { // For recording of stats, we need to remember if this is cached content. bool is_cached_content_; + private: + // Holds a list of ports that should be accepted despite bans. + static std::set explicitly_allowed_ports_; + DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); }; -- cgit v1.1