]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/http/one/Tokenizer.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_HTTP_ONE_TOKENIZER_H
10 #define SQUID_SRC_HTTP_ONE_TOKENIZER_H
12 #include "parser/Tokenizer.h"
18 * Lexical processor extended to tokenize HTTP/1.x syntax.
20 * \see ::Parser::Tokenizer for more detail
22 class Tokenizer
: public ::Parser::Tokenizer
25 Tokenizer(SBuf
&s
) : ::Parser::Tokenizer(s
), savedStats_(0) {}
28 * Attempt to parse a quoted-string lexical construct.
31 * - RFC 1945 section 2.1
33 * A string of text is parsed as a single word if it is quoted using
36 * quoted-string = ( <"> *(qdtext) <"> )
38 * qdtext = <any CHAR except <"> and CTLs,
41 * Single-character quoting using the backslash ("\") character is not
42 * permitted in HTTP/1.0.
45 * - RFC 7230 section 3.2.6
47 * A string of text is parsed as a single value if it is quoted using
50 * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
51 * qdtext = HTAB / SP /%x21 / %x23-5B / %x5D-7E / obs-text
55 * \param escaped HTTP/1.0 does not permit \-escaped characters
57 bool quotedString(SBuf
&value
, const bool http1p0
= false);
60 * Attempt to parse a (token / quoted-string ) lexical construct.
62 bool quotedStringOrToken(SBuf
&value
, const bool http1p0
= false);
65 /// parse the internal component of a quote-string, and terminal DQUOTE
66 bool qdText(SBuf
&value
, const bool http1p0
);
68 void checkpoint() { savedCheckpoint_
= buf(); savedStats_
= parsedSize(); }
69 void restoreLastCheckpoint() { undoParse(savedCheckpoint_
, savedStats_
); }
71 SBuf savedCheckpoint_
;
72 SBuf::size_type savedStats_
;
78 #endif /* SQUID_SRC_HTTP_ONE_TOKENIZER_H */