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

Side by Side Diff: third_party/WebKit/Source/platform/network/HTTPParsers.h

Issue 2292763002: [Fetch API] Implement Request.formData and Response.formData. (Closed)
Patch Set: Rebase Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 2 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 4 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 26 matching lines...) Expand all
37 #include "platform/wtf/Forward.h" 37 #include "platform/wtf/Forward.h"
38 #include "platform/wtf/HashSet.h" 38 #include "platform/wtf/HashSet.h"
39 #include "platform/wtf/Vector.h" 39 #include "platform/wtf/Vector.h"
40 #include "platform/wtf/text/StringHash.h" 40 #include "platform/wtf/text/StringHash.h"
41 41
42 #include <stdint.h> 42 #include <stdint.h>
43 #include <memory> 43 #include <memory>
44 44
45 namespace blink { 45 namespace blink {
46 46
47 class HTTPHeaderMap;
47 class Suborigin; 48 class Suborigin;
48 class ResourceResponse; 49 class ResourceResponse;
49 50
50 enum ContentTypeOptionsDisposition { 51 enum ContentTypeOptionsDisposition {
51 kContentTypeOptionsNone, 52 kContentTypeOptionsNone,
52 kContentTypeOptionsNosniff 53 kContentTypeOptionsNosniff
53 }; 54 };
54 55
55 // Be sure to update the behavior of 56 // Be sure to update the behavior of
56 // XSSAuditor::combineXSSProtectionHeaderAndCSP whenever you change this enum's 57 // XSSAuditor::combineXSSProtectionHeaderAndCSP whenever you change this enum's
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // may be Strings in |messages|. 131 // may be Strings in |messages|.
131 PLATFORM_EXPORT bool ParseSuboriginHeader(const String& header, 132 PLATFORM_EXPORT bool ParseSuboriginHeader(const String& header,
132 Suborigin*, 133 Suborigin*,
133 WTF::Vector<String>& messages); 134 WTF::Vector<String>& messages);
134 135
135 PLATFORM_EXPORT ContentTypeOptionsDisposition 136 PLATFORM_EXPORT ContentTypeOptionsDisposition
136 ParseContentTypeOptionsHeader(const String& header); 137 ParseContentTypeOptionsHeader(const String& header);
137 138
138 // Returns true and stores the position of the end of the headers to |*end| 139 // Returns true and stores the position of the end of the headers to |*end|
139 // if the headers part ends in |bytes[0..size]|. Returns false otherwise. 140 // if the headers part ends in |bytes[0..size]|. Returns false otherwise.
141 PLATFORM_EXPORT bool ParseMultipartFormHeadersFromBody(
142 const char* bytes,
143 size_t,
144 HTTPHeaderMap* header_fields,
145 size_t* end);
146
147 // Returns true and stores the position of the end of the headers to |*end|
148 // if the headers part ends in |bytes[0..size]|. Returns false otherwise.
140 PLATFORM_EXPORT bool ParseMultipartHeadersFromBody(const char* bytes, 149 PLATFORM_EXPORT bool ParseMultipartHeadersFromBody(const char* bytes,
141 size_t, 150 size_t,
142 ResourceResponse*, 151 ResourceResponse*,
143 size_t* end); 152 size_t* end);
144 153
145 // Parses a header value containing JSON data, according to 154 // Parses a header value containing JSON data, according to
146 // https://tools.ietf.org/html/draft-ietf-httpbis-jfv-01 155 // https://tools.ietf.org/html/draft-ietf-httpbis-jfv-01
147 // Returns an empty unique_ptr if the header cannot be parsed as JSON. JSON 156 // Returns an empty unique_ptr if the header cannot be parsed as JSON. JSON
148 // strings which represent object nested deeper than |maxParseDepth| will also 157 // strings which represent object nested deeper than |maxParseDepth| will also
149 // cause an empty return value. 158 // cause an empty return value.
150 PLATFORM_EXPORT std::unique_ptr<JSONArray> ParseJSONHeader(const String& header, 159 PLATFORM_EXPORT std::unique_ptr<JSONArray> ParseJSONHeader(const String& header,
151 int max_parse_depth); 160 int max_parse_depth);
152 161
153 // Extracts the values in a Content-Range header and returns true if all three 162 // Extracts the values in a Content-Range header and returns true if all three
154 // values are present and valid for a 206 response; otherwise returns false. 163 // values are present and valid for a 206 response; otherwise returns false.
155 // The following values will be outputted: 164 // The following values will be outputted:
156 // |*first_byte_position| = inclusive position of the first byte of the range 165 // |*first_byte_position| = inclusive position of the first byte of the range
157 // |*last_byte_position| = inclusive position of the last byte of the range 166 // |*last_byte_position| = inclusive position of the last byte of the range
158 // |*instance_length| = size in bytes of the object requested 167 // |*instance_length| = size in bytes of the object requested
159 // If this method returns false, then all of the outputs will be -1. 168 // If this method returns false, then all of the outputs will be -1.
160 PLATFORM_EXPORT bool ParseContentRangeHeaderFor206(const String& content_range, 169 PLATFORM_EXPORT bool ParseContentRangeHeaderFor206(const String& content_range,
161 int64_t* first_byte_position, 170 int64_t* first_byte_position,
162 int64_t* last_byte_position, 171 int64_t* last_byte_position,
163 int64_t* instance_length); 172 int64_t* instance_length);
164 173
165 } // namespace blink 174 } // namespace blink
166 175
167 #endif 176 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698