ContentLengthInterpreter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2020 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_CONTENTLENGTH_INTERPRETER_H
10 #define SQUID_SRC_HTTP_CONTENTLENGTH_INTERPRETER_H
11 
12 #include "http/StatusCode.h"
13 
14 class String;
15 
16 namespace Http
17 {
18 
22 {
23 public:
25 
28  bool checkField(const String &field);
29 
33  prohibitedAndIgnored_ = (code == scNoContent) ? "prohibited and ignored in the 204 response" :
34  "prohibited and ignored the 1xx response";
35  }
36 
37  // TODO: implement
39  // void applyRequestMethodRules(const Http::MethodType method);
40 
44  prohibitedAndIgnored_ = "prohibited in trailers";
45  }
46 
47  const char *prohibitedAndIgnored() const { return prohibitedAndIgnored_; }
48 
51  int64_t value;
52 
53  /* for debugging (declared here to minimize padding) */
54  const char *headerWideProblem;
55  const int debugLevel;
56 
58  bool sawBad;
59 
64 
67  bool sawGood;
68 
69 protected:
70  const char *findDigits(const char *prefix, const char *valueEnd) const;
71  bool goodSuffix(const char *suffix, const char * const end) const;
72  bool checkValue(const char *start, const int size);
73  bool checkList(const String &list);
74 
75 private:
77  const char *prohibitedAndIgnored_;
78 };
79 
80 } // namespace Http
81 
82 #endif /* SQUID_SRC_HTTP_CONTENTLENGTH_INTERPRETER_H */
83 
void applyTrailerRules()
prohibits Content-Length in GET/HEAD requests
bool goodSuffix(const char *suffix, const char *const end) const
checks whether all characters after the Content-Length are allowed
const int debugLevel
debugging level for certain warnings
const char * findDigits(const char *prefix, const char *valueEnd) const
void applyStatusCodeRules(const StatusCode code)
prohibits Content-Length in 1xx and 204 responses
StatusCode
Definition: StatusCode.h:20
Definition: forward.h:21
bool sawBad
whether a malformed Content-Length value was present
int size
Definition: ModDevPoll.cc:77
unsigned char code
Definition: html_quote.c:20
bool checkValue(const char *start, const int size)
bool checkList(const String &list)
handles Content-Length: a, b, c
bool ProhibitsContentLength(const StatusCode sc)
whether this response status code prohibits sending Content-Length
Definition: StatusCode.h:94
@ scNoContent
Definition: StatusCode.h:30
const char * headerWideProblem
worst header-wide problem found (or nil)
const char * prohibitedAndIgnored_
whether and why Content-Length is prohibited

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors