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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 11931024: Removed static factories for data, ftp, file, and about jobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (r198785) Created 7 years, 7 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_ftp_job_unittest.cc ('k') | net/url_request/url_request_job_factory.h » ('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
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index ade6c159904d891a380412950dfb3886fd4b9e8a..71904a52258023a5f9d7663439604c4d21fe99b9 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -43,6 +43,7 @@
#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_job_factory.h"
#include "net/url_request/url_request_redirect_job.h"
#include "net/url_request/url_request_throttler_header_adapter.h"
#include "net/url_request/url_request_throttler_manager.h"
@@ -1049,25 +1050,16 @@ Filter* URLRequestHttpJob::SetupFilter() const {
}
bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) {
- // We only allow redirects to certain "safe" protocols. This does not
- // restrict redirects to externally handled protocols. Our consumer would
- // need to take care of those.
-
- if (!URLRequest::IsHandledURL(location))
+ // HTTP is always safe.
+ // TODO(pauljensen): Remove once crbug.com/146591 is fixed.
+ if (location.is_valid() &&
+ (location.scheme() == "http" || location.scheme() == "https")) {
return true;
-
- static const char* kSafeSchemes[] = {
- "http",
- "https",
- "ftp"
- };
-
- for (size_t i = 0; i < arraysize(kSafeSchemes); ++i) {
- if (location.SchemeIs(kSafeSchemes[i]))
- return true;
}
-
- return false;
+ // Query URLRequestJobFactory as to whether |location| would be safe to
+ // redirect to.
+ return request_->context()->job_factory() &&
+ request_->context()->job_factory()->IsSafeRedirectTarget(location);
}
bool URLRequestHttpJob::NeedsAuth() {
« no previous file with comments | « net/url_request/url_request_ftp_job_unittest.cc ('k') | net/url_request/url_request_job_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698