ContentLengthInterpreter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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  bool goodSuffix(const char *suffix, const char * const end) const;
71  bool checkValue(const char *start, const int size);
72  bool checkList(const String &list);
73 
74 private:
76  const char *prohibitedAndIgnored_;
77 };
78 
79 } // namespace Http
80 
81 #endif /* SQUID_SRC_HTTP_CONTENTLENGTH_INTERPRETER_H */
82 
const char * prohibitedAndIgnored() const
bool goodSuffix(const char *suffix, const char *const end) const
checks whether all characters after the Content-Length are allowed
void applyStatusCodeRules(const StatusCode code)
prohibits Content-Length in 1xx and 204 responses
bool ProhibitsContentLength(const StatusCode sc)
whether this response status code prohibits sending Content-Length
Definition: StatusCode.h:94
void applyTrailerRules()
prohibits Content-Length in GET/HEAD requests
const char * headerWideProblem
worst header-wide problem found (or nil)
StatusCode
Definition: StatusCode.h:20
bool checkList(const String &list)
handles Content-Length: a, b, c
const int debugLevel
debugging level for certain warnings
unsigned char code
Definition: html_quote.c:20
bool checkValue(const char *start, const int size)
bool sawBad
whether a malformed Content-Length value was present
const char * prohibitedAndIgnored_
whether and why Content-Length is prohibited
int size
Definition: ModDevPoll.cc:77

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors