Http::One Namespace Reference

common part of ParseBws() and ParseStrctBws()

Classes

class  ChunkExtensionValueParser
 
class  Parser
 
class  RequestParser
 
class  ResponseParser
 
class  Server
 Manages a connection from an HTTP/1 or HTTP/0.9 client. More...
 
class  TeChunkedParser
 

Typedefs

typedef RefCount< Http::One::ParserParserPointer
 
typedef RefCount< Http::One::RequestParserRequestParserPointer
 
typedef RefCount< Http::One::ResponseParserResponseParserPointer
 

Enumerations

enum  ParseState {
  HTTP_PARSE_NONE,
  HTTP_PARSE_FIRST,
  HTTP_PARSE_CHUNK_SZ,
  HTTP_PARSE_CHUNK_EXT,
  HTTP_PARSE_CHUNK,
  HTTP_PARSE_MIME,
  HTTP_PARSE_DONE
}
 

Functions

const SBufCrLf ()
 CRLF textual representation. More...
 
static void ParseBws_ (Parser::Tokenizer &tok, const CharacterSet &bwsChars)
 
void ParseBws (Parser::Tokenizer &)
 
void ParseStrictBws (Parser::Tokenizer &)
 
int ErrorLevel ()
 the right debugs() level for logging HTTP violation messages More...
 
SBuf tokenOrQuotedString (Parser::Tokenizer &tok, const bool http1p0=false)
 

Typedef Documentation

◆ ParserPointer

Definition at line 21 of file forward.h.

◆ RequestParserPointer

◆ ResponseParserPointer

Enumeration Type Documentation

◆ ParseState

Enumerator
HTTP_PARSE_NONE 

initialized, but nothing usefully parsed yet

HTTP_PARSE_FIRST 

HTTP/1 message first-line.

HTTP_PARSE_CHUNK_SZ 

HTTP/1.1 chunked encoding chunk-size.

HTTP_PARSE_CHUNK_EXT 

HTTP/1.1 chunked encoding chunk-ext.

HTTP_PARSE_CHUNK 

HTTP/1.1 chunked encoding chunk-data.

HTTP_PARSE_MIME 

HTTP/1 mime-header block.

HTTP_PARSE_DONE 

parsed a message header, or reached a terminal syntax error

Definition at line 22 of file Parser.h.

Function Documentation

◆ CrLf()

◆ ErrorLevel()

◆ ParseBws()

void Http::One::ParseBws ( Parser::Tokenizer tok)

skips and, if needed, warns about RFC 7230 BWS ("bad" whitespace)

Exceptions
InsufficientInputwhen the end of BWS cannot be confirmed
See also
WhitespaceCharacters() for the definition of BWS characters
ParseStrictBws() that avoids WhitespaceCharacters() uncertainties

Definition at line 297 of file Parser.cc.

References ParseBws_(), and Http::One::Parser::WhitespaceCharacters().

Referenced by Http::One::TeChunkedParser::parseChunkExtensions(), and Http::One::TeChunkedParser::parseOneChunkExtension().

◆ ParseBws_()

static void Http::One::ParseBws_ ( Parser::Tokenizer tok,
const CharacterSet bwsChars 
)
static

Definition at line 277 of file Parser.cc.

References debugs, and ErrorLevel().

Referenced by ParseBws(), and ParseStrictBws().

◆ ParseStrictBws()

void Http::One::ParseStrictBws ( Parser::Tokenizer tok)

Like ParseBws() but only skips CharacterSet::WSP characters. This variation must be used if the next element may start with CR or any other character from RelaxedDelimiterCharacters().

Definition at line 303 of file Parser.cc.

References ParseBws_(), and CharacterSet::WSP.

Referenced by Http::One::TeChunkedParser::parseChunkMetadataSuffix().

◆ tokenOrQuotedString()

SBuf Http::One::tokenOrQuotedString ( Parser::Tokenizer tok,
const bool  http1p0 = false 
)

Extracts either an HTTP/1 token or quoted-string while dealing with possibly incomplete input typical for incremental text parsers. Unescapes escaped characters in HTTP/1.1 quoted strings.

Parameters
http1p0whether to prohibit -escaped characters in quoted strings
Exceptions
InsufficientInputas appropriate, including on unterminated tokens
Returns
extracted token or quoted string (without quotes)

Governed by:

  • RFC 1945 section 2.1 " A string of text is parsed as a single word if it is quoted using double-quote marks.

    quoted-string  = ( <"> *(qdtext) <"> )
    
    qdtext         = <any CHAR except <"> and CTLs,
                     but including LWS>
    

    Single-character quoting using the backslash ("\") character is not permitted in HTTP/1.0. "

  • RFC 7230 section 3.2.6 " A string of text is parsed as a single value if it is quoted using double-quote marks.

    quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE qdtext = HTAB / SP /x21 / x23-5B / x5D-7E / obs-text obs-text = x80-FF "

Definition at line 89 of file Tokenizer.cc.

References parseQuotedStringSuffix(), CharacterSet::TCHAR, and TexcHere.

Referenced by Http::One::ChunkExtensionValueParser::Ignore().

 

Introduction

Documentation

Support

Miscellaneous