#include <ContentLengthInterpreter.h>

Collaboration diagram for Http::ContentLengthInterpreter:

Public Member Functions

 ContentLengthInterpreter ()
bool checkField (const String &field)
void applyStatusCodeRules (const StatusCode code)
 prohibits Content-Length in 1xx and 204 responses More...
void applyTrailerRules ()
 prohibits Content-Length in GET/HEAD requests More...
const char * prohibitedAndIgnored () const

Public Attributes

int64_t value
const char * headerWideProblem
 worst header-wide problem found (or nil) More...
const int debugLevel
 debugging level for certain warnings More...
bool sawBad
 whether a malformed Content-Length value was present More...
bool needsSanitizing
bool sawGood

Protected Member Functions

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 More...
bool checkValue (const char *start, const int size)
bool checkList (const String &list)
 handles Content-Length: a, b, c More...

Private Attributes

const char * prohibitedAndIgnored_
 whether and why Content-Length is prohibited More...

Detailed Description

Finds the intended Content-Length value while parsing message-header fields. Deals with complications such as value lists and/or repeated fields.

Definition at line 21 of file ContentLengthInterpreter.h.

Constructor & Destructor Documentation

◆ ContentLengthInterpreter()

Http::ContentLengthInterpreter::ContentLengthInterpreter ( )

Definition at line 22 of file ContentLengthInterpreter.cc.

Member Function Documentation

◆ applyStatusCodeRules()

void Http::ContentLengthInterpreter::applyStatusCodeRules ( const StatusCode  code)

◆ applyTrailerRules()

void Http::ContentLengthInterpreter::applyTrailerRules ( )

prohibits Content-Length in trailer

Definition at line 42 of file ContentLengthInterpreter.h.

References prohibitedAndIgnored_.

Referenced by Adaptation::Icap::TrailerParser::parse().

◆ checkField()

bool Http::ContentLengthInterpreter::checkField ( const String field)

updates history based on the given message-header field

true iff the field should be added/remembered for future use

Definition at line 153 of file ContentLengthInterpreter.cc.

References String::pos(), String::rawBuf(), and String::size().

Referenced by HttpHeader::parse().

◆ checkList()

bool Http::ContentLengthInterpreter::checkList ( const String list)

◆ checkValue()

bool Http::ContentLengthInterpreter::checkValue ( const char *  rawValue,
const int  valueSize 

handles a single-token Content-Length value rawValue null-termination requirements are those of httpHeaderParseOffset()

Definition at line 71 of file ContentLengthInterpreter.cc.

References Config, DBG_IMPORTANT, debugs, httpHeaderParseOffset(), Must, SquidConfig::onoff, and SquidConfig::relaxed_header_parser.

◆ findDigits()

const char * Http::ContentLengthInterpreter::findDigits ( const char *  prefix,
const char *  valueEnd 
) const

checks whether all characters before the Content-Length number are allowed

the start of the digit sequence (or nil on errors)

Definition at line 36 of file ContentLengthInterpreter.cc.

References CharacterSet::DIGIT, whitespace, and Http::One::Parser::WhitespaceCharacters().

◆ goodSuffix()

bool Http::ContentLengthInterpreter::goodSuffix ( const char *  suffix,
const char *const  end 
) const

◆ prohibitedAndIgnored()

const char* Http::ContentLengthInterpreter::prohibitedAndIgnored ( ) const

Definition at line 47 of file ContentLengthInterpreter.h.

References prohibitedAndIgnored_.

Referenced by HttpHeader::parse().

Member Data Documentation

◆ debugLevel

const int Http::ContentLengthInterpreter::debugLevel

Definition at line 55 of file ContentLengthInterpreter.h.

◆ headerWideProblem

const char* Http::ContentLengthInterpreter::headerWideProblem

Definition at line 54 of file ContentLengthInterpreter.h.

Referenced by HttpHeader::parse().

◆ needsSanitizing

bool Http::ContentLengthInterpreter::needsSanitizing

whether all remembered fields should be removed removed fields ought to be replaced with the intended value (if known) irrelevant if sawBad is set

Definition at line 63 of file ContentLengthInterpreter.h.

Referenced by HttpHeader::parse().

◆ prohibitedAndIgnored_

const char* Http::ContentLengthInterpreter::prohibitedAndIgnored_

◆ sawBad

bool Http::ContentLengthInterpreter::sawBad

Definition at line 58 of file ContentLengthInterpreter.h.

Referenced by HttpHeader::parse().

◆ sawGood

bool Http::ContentLengthInterpreter::sawGood

whether a valid field value was present, possibly among problematic ones irrelevant if sawBad is set

Definition at line 67 of file ContentLengthInterpreter.h.

Referenced by HttpHeader::parse().

◆ value

int64_t Http::ContentLengthInterpreter::value

intended Content-Length value if sawGood is set and sawBad is not set meaningless otherwise

Definition at line 51 of file ContentLengthInterpreter.h.

Referenced by HttpHeader::parse().

The documentation for this class was generated from the following files:






Web Site Translations