Chromium Code Reviews| 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..fd88227b17edcbb1d08ff056c59888dcfbb3df24 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) |
|
dcheng
2016/11/03 05:54:43
Nit: this early return isn't necessary (JSONArray:
iclelland
2016/11/03 14:59:20
Done, thanks.
|
| + return nullptr; // Header is not valid JSON |
| + return JSONArray::cast(std::move(headerValue)); |
| +} |
| + |
| } // namespace blink |