TeChunkedParser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 #ifndef SQUID_SRC_HTTP_ONE_TECHUNKEDPARSER_H
10 #define SQUID_SRC_HTTP_ONE_TECHUNKEDPARSER_H
11 
12 #include "http/one/Parser.h"
13 
14 class MemBuf;
15 
16 namespace Http
17 {
18 namespace One
19 {
20 
21 using ::Parser::InsufficientInput;
22 
23 // TODO: Move this class into http/one/ChunkExtensionValueParser.*
30 {
31 public:
32  typedef ::Parser::Tokenizer Tokenizer;
33 
35  static void Ignore(Tokenizer &tok, const SBuf &extName);
36 
38  virtual void parse(Tokenizer &tok, const SBuf &extName) = 0;
39 };
40 
52 {
53 public:
55  ~TeChunkedParser() override { theOut=nullptr; /* we do not own this object */ }
56 
58  void setPayloadBuffer(MemBuf *parsedContent) {theOut = parsedContent;}
59 
63 
64  bool needsMoreSpace() const;
65 
66  /* Http1::Parser API */
67  void clear() override;
68  bool parse(const SBuf &) override;
69  Parser::size_type firstLineSize() const override {return 0;} // has no meaning with multiple chunks
70 
71 private:
78 
80  uint64_t theChunkSize;
81  uint64_t theLeftBodySize;
82 
86 };
87 
88 } // namespace One
89 } // namespace Http
90 
91 #endif /* SQUID_SRC_HTTP_ONE_TECHUNKEDPARSER_H */
92 
Parser::size_type firstLineSize() const override
size in bytes of the first line including CRLF terminator
void parseOneChunkExtension(Tokenizer &)
Definition: SBuf.h:93
bool parseChunkMetadataSuffix(Tokenizer &)
Definition: forward.h:17
void parseChunkExtensions(Tokenizer &)
SBuf::size_type size_type
Definition: Parser.h:43
ChunkExtensionValueParser * customExtensionValueParser
void parseExtensionValuesWith(ChunkExtensionValueParser *parser)
virtual void parse(Tokenizer &tok, const SBuf &extName)=0
extracts and then interprets (or ignores) the extension value
Definition: MemBuf.h:23
static void Ignore(Tokenizer &tok, const SBuf &extName)
extracts and ignores the value of a named extension
void setPayloadBuffer(MemBuf *parsedContent)
set the buffer to be used to store decoded chunk data
bool parseChunkEnd(Tokenizer &tok)
bool parseChunkBody(Tokenizer &tok)
Definition: parse.c:160
::Parser::Tokenizer Tokenizer
Definition: Parser.h:44
bool parse(const SBuf &) override
bool parseChunkSize(Tokenizer &tok)
RFC 7230 section 4.1 chunk-size.

 

Introduction

Documentation

Support

Miscellaneous