ContentLengthInterpreter.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
14class String;
15
16namespace Http
17{
18
22{
23public:
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
69protected:
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
75private:
78};
79
80} // namespace Http
81
82#endif /* SQUID_SRC_HTTP_CONTENTLENGTH_INTERPRETER_H */
83
int size
Definition: ModDevPoll.cc:75
const char * findDigits(const char *prefix, const char *valueEnd) const
bool goodSuffix(const char *suffix, const char *const end) const
checks whether all characters after the Content-Length are allowed
bool checkList(const String &list)
handles Content-Length: a, b, c
bool sawBad
whether a malformed Content-Length value was present
const char * prohibitedAndIgnored_
whether and why Content-Length is prohibited
void applyStatusCodeRules(const StatusCode code)
prohibits Content-Length in 1xx and 204 responses
const int debugLevel
debugging level for certain warnings
bool checkValue(const char *start, const int size)
void applyTrailerRules()
prohibits Content-Length in GET/HEAD requests
const char * headerWideProblem
worst header-wide problem found (or nil)
unsigned char code
Definition: html_quote.c:20
Definition: forward.h:22
bool ProhibitsContentLength(const StatusCode sc)
whether this response status code prohibits sending Content-Length
Definition: StatusCode.h:94
StatusCode
Definition: StatusCode.h:20
@ scNoContent
Definition: StatusCode.h:30

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors