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

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

Issue 2880543003: Implement a parser for Content-Disposition header fields (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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef HeaderFieldTokenizer_h
6 #define HeaderFieldTokenizer_h
7
8 #include "platform/network/ParsedContentHeaderFieldParameters.h"
9 #include "platform/wtf/text/WTFString.h"
10
11 namespace blink {
12
13 // Parses header fields into tokens, quoted strings and separators.
14 // Commonly used by ParsedContent* classes.
15 class HeaderFieldTokenizer final {
16 STACK_ALLOCATED();
17
18 public:
19 using Mode = ParsedContentHeaderFieldParameters::Mode;
20
21 explicit HeaderFieldTokenizer(const String& header_field);
22 HeaderFieldTokenizer(HeaderFieldTokenizer&&);
23
24 // Try to parse a separator character, a token or either a token or a quoted
25 // string from the |header_field| input. Return |true| on success. Return
26 // |false| if the separator character, the token or the quoted string is
27 // missing or invalid.
28 bool Consume(char);
29 bool ConsumeToken(Mode, StringView& output);
30 bool ConsumeTokenOrQuotedString(Mode, String& output);
31
32 unsigned Index() const { return index_; }
33 bool IsConsumed() const { return index_ >= input_.length(); }
34 void SkipSpaces();
35
36 private:
37 bool ConsumeQuotedString(String& output);
38
39 unsigned index_;
40 const String input_;
41 };
42
43 } // namespace blink
44
45 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | third_party/WebKit/Source/platform/network/HeaderFieldTokenizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698