]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ChunkedCodingParser.h
Remove missed configure.in entry for no_check helper
[thirdparty/squid.git] / src / ChunkedCodingParser.h
CommitLineData
774c051c 1/*
262a0e14 2 * $Id$
26ac0430 3 *
774c051c 4 * SQUID Web Proxy Cache http://www.squid-cache.org/
5 * ----------------------------------------------------------
6 *
7 * Squid is the result of efforts by numerous individuals from
8 * the Internet community; see the CONTRIBUTORS file for full
9 * details. Many organizations have provided support for Squid's
10 * development; see the SPONSORS file for full details. Squid is
11 * Copyrighted (C) 2001 by the Regents of the University of
12 * California; see the COPYRIGHT file for full details. Squid
13 * incorporates software developed and/or copyrighted by other
14 * sources; see the CREDITS file for full details.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
26ac0430 20 *
774c051c 21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26ac0430 25 *
774c051c 26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
29 *
30 */
774c051c 31#ifndef SQUID_CHUNKEDCODINGPARSER_H
32#define SQUID_CHUNKEDCODINGPARSER_H
33
e1f7507e 34class MemBuf;
774c051c 35
e1f7507e
AJ
36#if 0
37#include "RefCount.h"
38#endif
39
40/* for size_t */
41#include "config.h"
42
43/**
44 \ingroup ChunkEncodingAPI Chunked Encoding API
45 \par
46 * ChunkedCodingParser is an incremental parser for chunked transfer coding
47 * used by HTTP and ICAP. The parser shovels content bytes from the raw
48 * input buffer into the content output buffer, both caller-supplied.
49 * Ignores chunk extensions except for ICAP's ieof.
50 * Has a trailer-handling placeholder.
51 */
774c051c 52class ChunkedCodingParser
53{
54
55public:
56 ChunkedCodingParser();
57
58 void reset();
59
e1f7507e
AJ
60 /**
61 \retval true complete success
62 \retval false needs more data
63 \throws ?? error.
64 */
65 bool parse(MemBuf *rawData, MemBuf *parsedContent);
774c051c 66
67 bool needsMoreData() const;
68 bool needsMoreSpace() const;
774c051c 69
70private:
71 typedef void (ChunkedCodingParser::*Step)();
72
73private:
74 bool mayContinue() const;
75
76 void parseChunkBeg();
77 void parseChunkBody();
78 void parseChunkEnd();
79 void parseTrailer();
80 void parseTrailerHeader();
81 void parseMessageEnd();
82
83 bool findCrlf(size_t &crlfBeg, size_t &crlfEnd);
84
85private:
86 static Step psChunkBeg;
87 static Step psChunkBody;
88 static Step psChunkEnd;
89 static Step psTrailer;
90 static Step psMessageEnd;
91
92 MemBuf *theIn;
93 MemBuf *theOut;
94
95 Step theStep;
47f6e231 96 uint64_t theChunkSize;
97 uint64_t theLeftBodySize;
774c051c 98 bool doNeedMoreData;
99};
100
101#endif /* SQUID_CHUNKEDCODINGPARSER_H */