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

Unified Diff: third_party/WebKit/Source/platform/network/HTTPParsers.cpp

Issue 2254533002: [FeaturePolicy] Initial implementation of Feature Policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fp-flag
Patch Set: Don't leak FeaturePolicy objects Created 4 years, 2 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: third_party/WebKit/Source/platform/network/HTTPParsers.cpp
diff --git a/third_party/WebKit/Source/platform/network/HTTPParsers.cpp b/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
index 37a2afc1cf8f4bdacfd1fee67145ba951f01826e..6c63320df54ecca0c957694d33d0bdd81b9d42d0 100644
--- a/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
+++ b/third_party/WebKit/Source/platform/network/HTTPParsers.cpp
@@ -34,6 +34,7 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
+#include "platform/json/JSONParser.h"
#include "platform/network/ResourceResponse.h"
#include "platform/weborigin/Suborigin.h"
#include "public/platform/WebString.h"
@@ -877,4 +878,16 @@ bool parseMultipartHeadersFromBody(const char* bytes,
return true;
}
+// See https://tools.ietf.org/html/draft-ietf-httpbis-jfv-01, Section 4.
+std::unique_ptr<JSONArray> parseJSONHeader(const String& header) {
+ StringBuilder sb;
+ sb.append("[");
+ sb.append(header);
+ sb.append("]");
+ std::unique_ptr<JSONValue> headerValue = parseJSON(sb.toString());
+ if (!headerValue)
+ return std::unique_ptr<JSONArray>(nullptr); // Header is not valid JSON
dcheng 2016/10/24 19:16:45 Nit: return nullptr works.
iclelland 2016/10/25 18:34:33 Nice, thanks. Done.
+ return JSONArray::cast(std::move(headerValue));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698