]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/http/one/TeChunkedParser.h
2 * Copyright (C) 1996-2016 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_TeChunkedParser_H
10 #define SQUID_SRC_HTTP_ONE_TeChunkedParser_H
12 #include "http/one/Parser.h"
22 * An incremental parser for chunked transfer coding
23 * defined in RFC 7230 section 4.1.
24 * http://tools.ietf.org/html/rfc7230#section-4.1
26 * The parser shovels content bytes from the raw
27 * input buffer into the content output buffer, both caller-supplied.
28 * Ignores chunk extensions except for ICAP's ieof.
29 * Trailers are available via mimeHeader() if wanted.
31 class TeChunkedParser
: public Http1::Parser
35 virtual ~TeChunkedParser() {theOut
=NULL
;/* we dont own this object */}
37 /// set the buffer to be used to store decoded chunk data
38 void setPayloadBuffer(MemBuf
*parsedContent
) {theOut
= parsedContent
;}
40 bool needsMoreSpace() const;
42 /* Http1::Parser API */
44 virtual bool parse(const SBuf
&);
45 virtual Parser::size_type
firstLineSize() const {return 0;} // has no meaning with multiple chunks
48 bool parseChunkSize(Http1::Tokenizer
&tok
);
49 bool parseChunkExtension(Http1::Tokenizer
&tok
, bool skipKnown
);
50 bool parseChunkBody(Http1::Tokenizer
&tok
);
51 bool parseChunkEnd(Http1::Tokenizer
&tok
);
54 uint64_t theChunkSize
;
55 uint64_t theLeftBodySize
;
58 int64_t useOriginBody
;
64 #endif /* SQUID_SRC_HTTP_ONE_TeChunkedParser_H */