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

Unified Diff: net/url_request/url_request_data_job.cc

Issue 555383003: [Regression fix] [Data URI parser] Accept data URI with invalid mediatype data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed InvalidMimeType unittest Created 6 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
Index: net/url_request/url_request_data_job.cc
diff --git a/net/url_request/url_request_data_job.cc b/net/url_request/url_request_data_job.cc
index e0746467079836f42aff97cdbe2029b6e5669eb9..9d1a282656c6169766818267ceeafa57bb6ab156 100644
--- a/net/url_request/url_request_data_job.cc
+++ b/net/url_request/url_request_data_job.cc
@@ -7,6 +7,7 @@
#include "net/url_request/url_request_data_job.h"
#include "net/base/data_url.h"
+#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "url/gurl.h"
@@ -34,9 +35,11 @@ int URLRequestDataJob::BuildResponse(const GURL& url,
// the "token" ABNF in the HTTP spec. When DataURL::Parse() call is
// successful, it's guaranteed that the string in |charset| follows the
// "token" ABNF.
- std::string content_type_header =
- "Content-Type: " + *mime_type + ";charset=" + *charset;
- headers->AddHeader(content_type_header);
+ if (ParseMimeTypeWithoutParameter(*mime_type, NULL, NULL)) {
+ std::string content_type_header =
+ "Content-Type: " + *mime_type + ";charset=" + *charset;
+ headers->AddHeader(content_type_header);
+ }
headers->AddHeader("Access-Control-Allow-Origin: *");
}

Powered by Google App Engine
This is Rietveld 408576698