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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 194057: Check in patch for pierre.lafayette, http://codereview.chromium.org/178059/sh... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months 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 | « net/url_request/url_request_http_job.h ('k') | net/url_request/url_request_new_ftp_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
===================================================================
--- net/url_request/url_request_http_job.cc (revision 25619)
+++ net/url_request/url_request_http_job.cc (working copy)
@@ -30,18 +30,14 @@
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_redirect_job.h"
-// static
-std::set<int> URLRequestHttpJob::explicitly_allowed_ports_;
-
// TODO(darin): make sure the port blocking code is not lost
-
// static
URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request,
const std::string& scheme) {
DCHECK(scheme == "http" || scheme == "https");
int port = request->url().IntPort();
- if (!net::IsPortAllowedByDefault(port) && !IsPortAllowedByOverride(port))
+ if (!net::IsPortAllowedByDefault(port) && !net::IsPortAllowedByOverride(port))
return new URLRequestErrorJob(request, net::ERR_UNSAFE_PORT);
if (!request->context() ||
@@ -70,35 +66,6 @@
return new URLRequestHttpJob(request);
}
-// static
-void URLRequestHttpJob::SetExplicitlyAllowedPorts(
- const std::wstring& allowed_ports) {
- if (allowed_ports.empty())
- return;
-
- std::set<int> ports;
- size_t last = 0;
- size_t size = allowed_ports.size();
- // The comma delimiter.
- const std::wstring::value_type kComma = L',';
-
- // Overflow is still possible for evil user inputs.
- for (size_t i = 0; i <= size; ++i) {
- // The string should be composed of only digits and commas.
- if (i != size && !IsAsciiDigit(allowed_ports[i]) &&
- (allowed_ports[i] != kComma))
- return;
- if (i == size || allowed_ports[i] == kComma) {
- size_t length = i - last;
- if (length > 0)
- ports.insert(StringToInt(WideToASCII(
- allowed_ports.substr(last, length))));
- last = i + 1;
- }
- }
- explicitly_allowed_ports_ = ports;
-}
-
URLRequestHttpJob::URLRequestHttpJob(URLRequest* request)
: URLRequestJob(request),
context_(request->context()),
@@ -378,19 +345,6 @@
this, &URLRequestHttpJob::OnStartCompleted, rv));
}
-// static
-bool URLRequestHttpJob::IsPortAllowedByOverride(int port) {
- if (explicitly_allowed_ports().empty())
- return false;
-
- std::set<int>::const_iterator it =
- std::find(explicitly_allowed_ports().begin(),
- explicitly_allowed_ports().end(),
- port);
-
- return it != explicitly_allowed_ports().end();
-}
-
void URLRequestHttpJob::CancelAuth() {
// Proxy gets set first, then WWW.
if (proxy_auth_state_ == net::AUTH_STATE_NEED_AUTH) {
« no previous file with comments | « net/url_request/url_request_http_job.h ('k') | net/url_request/url_request_new_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698