Http Namespace Reference

Namespaces

namespace  One
 

Classes

class  ContentLengthInterpreter
 
class  HeaderLookupTable_t
 
class  HeaderTableRecord
 
class  Message
 common parts of HttpRequest and HttpReply More...
 
class  StateFlags
 
class  StatusLine
 
class  Stream
 
class  Tunneler
 
class  TunnelerAnswer
 

Typedefs

typedef RefCount< Http::MessageMessagePointer
 
typedef RefCount< Http::StreamStreamPointer
 
typedef enum Http::_method_t MethodType
 

Enumerations

enum  _method_t {
  METHOD_NONE = 0 ,
  METHOD_GET ,
  METHOD_POST ,
  METHOD_PUT ,
  METHOD_HEAD ,
  METHOD_CONNECT ,
  METHOD_TRACE ,
  METHOD_OPTIONS ,
  METHOD_DELETE ,
  METHOD_LINK ,
  METHOD_UNLINK ,
  METHOD_CHECKOUT ,
  METHOD_CHECKIN ,
  METHOD_UNCHECKOUT ,
  METHOD_MKWORKSPACE ,
  METHOD_VERSION_CONTROL ,
  METHOD_REPORT ,
  METHOD_UPDATE ,
  METHOD_LABEL ,
  METHOD_MERGE ,
  METHOD_BASELINE_CONTROL ,
  METHOD_MKACTIVITY ,
  METHOD_PROPFIND ,
  METHOD_PROPPATCH ,
  METHOD_MKCOL ,
  METHOD_COPY ,
  METHOD_MOVE ,
  METHOD_LOCK ,
  METHOD_UNLOCK ,
  METHOD_SEARCH ,
  METHOD_PRI ,
  METHOD_PURGE ,
  METHOD_OTHER ,
  METHOD_ENUM_END
}
 
enum  HdrType {
  enumBegin_ = 0 ,
  ACCEPT = enumBegin_ ,
  ACCEPT_CHARSET ,
  ACCEPT_ENCODING ,
  ACCEPT_LANGUAGE ,
  ACCEPT_RANGES ,
  AGE ,
  ALLOW ,
  ALTERNATE_PROTOCOL ,
  AUTHENTICATION_INFO ,
  AUTHORIZATION ,
  CACHE_CONTROL ,
  CACHE_STATUS ,
  CDN_LOOP ,
  CONNECTION ,
  CONTENT_BASE ,
  CONTENT_DISPOSITION ,
  CONTENT_ENCODING ,
  CONTENT_LANGUAGE ,
  CONTENT_LENGTH ,
  CONTENT_LOCATION ,
  CONTENT_MD5 ,
  CONTENT_RANGE ,
  CONTENT_TYPE ,
  COOKIE ,
  COOKIE2 ,
  DATE ,
  ETAG ,
  EXPECT ,
  EXPIRES ,
  FORWARDED ,
  FROM ,
  HOST ,
  IF_MATCH ,
  IF_MODIFIED_SINCE ,
  IF_NONE_MATCH ,
  IF_RANGE ,
  IF_UNMODIFIED_SINCE ,
  KEEP_ALIVE ,
  KEY ,
  LAST_MODIFIED ,
  LINK ,
  LOCATION ,
  MAX_FORWARDS ,
  MIME_VERSION ,
  NEGOTIATE ,
  ORIGIN ,
  PRAGMA ,
  PRIORITY ,
  PROXY_AUTHENTICATE ,
  PROXY_AUTHENTICATION_INFO ,
  PROXY_AUTHORIZATION ,
  PROXY_CONNECTION ,
  PROXY_SUPPORT ,
  PUBLIC ,
  RANGE ,
  REFERER ,
  REQUEST_RANGE ,
  RETRY_AFTER ,
  SERVER ,
  SET_COOKIE ,
  SET_COOKIE2 ,
  TE ,
  TITLE ,
  TRAILER ,
  TRANSFER_ENCODING ,
  TRANSLATE ,
  UNLESS_MODIFIED_SINCE ,
  UPGRADE ,
  USER_AGENT ,
  VARY ,
  VIA ,
  WWW_AUTHENTICATE ,
  X_FORWARDED_FOR ,
  X_REQUEST_URI ,
  X_SQUID_ERROR ,
  HDR_X_ACCELERATOR_VARY ,
  X_NEXT_SERVICES ,
  SURROGATE_CAPABILITY ,
  SURROGATE_CONTROL ,
  FRONT_END_HTTPS ,
  FTP_COMMAND ,
  FTP_ARGUMENTS ,
  FTP_PRE ,
  FTP_STATUS ,
  FTP_REASON ,
  OTHER ,
  BAD_HDR ,
  enumEnd_
}
 
enum class  HdrFieldType {
  ftInvalid ,
  ftInt ,
  ftInt64 ,
  ftStr ,
  ftDate_1123 ,
  ftETag ,
  ftPCc ,
  ftPContRange ,
  ftPRange ,
  ftPSc ,
  ftDate_1123_or_ETag
}
 
enum  HdrKind {
  None = 0 ,
  ListHeader = 1 ,
  RequestHeader = 1 << 1 ,
  ReplyHeader = 1 << 2 ,
  HopByHopHeader = 1 << 3 ,
  Denied304Header = 1 << 4 ,
  GeneralHeader = RequestHeader | ReplyHeader ,
  EntityHeader = RequestHeader | ReplyHeader
}
 
enum  StatusCode {
  scNone = 0 ,
  scContinue = 100 ,
  scSwitchingProtocols = 101 ,
  scProcessing = 102 ,
  scEarlyHints = 103 ,
  scOkay = 200 ,
  scCreated = 201 ,
  scAccepted = 202 ,
  scNonAuthoritativeInformation = 203 ,
  scNoContent = 204 ,
  scResetContent = 205 ,
  scPartialContent = 206 ,
  scMultiStatus = 207 ,
  scAlreadyReported = 208 ,
  scImUsed = 226 ,
  scMultipleChoices = 300 ,
  scMovedPermanently = 301 ,
  scFound = 302 ,
  scSeeOther = 303 ,
  scNotModified = 304 ,
  scUseProxy = 305 ,
  scTemporaryRedirect = 307 ,
  scPermanentRedirect = 308 ,
  scBadRequest = 400 ,
  scUnauthorized = 401 ,
  scPaymentRequired = 402 ,
  scForbidden = 403 ,
  scNotFound = 404 ,
  scMethodNotAllowed = 405 ,
  scNotAcceptable = 406 ,
  scProxyAuthenticationRequired = 407 ,
  scRequestTimeout = 408 ,
  scConflict = 409 ,
  scGone = 410 ,
  scLengthRequired = 411 ,
  scPreconditionFailed = 412 ,
  scContentTooLarge = 413 ,
  scUriTooLong = 414 ,
  scUnsupportedMediaType = 415 ,
  scRequestedRangeNotSatisfied = 416 ,
  scExpectationFailed = 417 ,
  scMisdirectedRequest = 421 ,
  scUnprocessableEntity = 422 ,
  scLocked = 423 ,
  scFailedDependency = 424 ,
  scUpgradeRequired = 426 ,
  scPreconditionRequired = 428 ,
  scTooManyRequests = 429 ,
  scRequestHeaderFieldsTooLarge = 431 ,
  scUnavailableForLegalReasons = 451 ,
  scInternalServerError = 500 ,
  scNotImplemented = 501 ,
  scBadGateway = 502 ,
  scServiceUnavailable = 503 ,
  scGatewayTimeout = 504 ,
  scHttpVersionNotSupported = 505 ,
  scVariantAlsoNegotiates = 506 ,
  scInsufficientStorage = 507 ,
  scLoopDetected = 508 ,
  scNotExtended = 510 ,
  scNetworkAuthenticationRequired = 511 ,
  scInvalidHeader = 600 ,
  scHeaderTooLarge = 601
}
 

Functions

std::ostream & operator<< (std::ostream &, const TunnelerAnswer &)
 
const SBufMethodStr (const MethodType m)
 
AnyP::ProtocolVersion ProtocolVersion (unsigned int aMajor, unsigned int aMinor)
 HTTP version label information. More...
 
AnyP::ProtocolVersion ProtocolVersion ()
 
bool any_HdrType_enum_value (const Http::HdrType id)
 match any known header type, including OTHER and BAD More...
 
bool any_valid_header (const Http::HdrType id)
 match any valid header type, including OTHER but not BAD More...
 
bool any_registered_header (const Http::HdrType id)
 
std::ostream & operator<< (std::ostream &, HdrType)
 
const char * StatusCodeString (const Http::StatusCode status)
 
bool Is1xx (const int sc)
 whether this is an informational 1xx response status code More...
 
bool Is4xx (const int sc)
 whether this is a client error 4xx response status code More...
 
bool ProhibitsContentLength (const StatusCode sc)
 whether this response status code prohibits sending Content-Length More...
 
bool IsReforwardableStatus (StatusCode)
 whether to send the request to another peer based on the current response status code More...
 
SBuf SlowlyParseQuotedString (const char *description, const char *start, size_t length)
 
ConnStateDataNewServer (const MasterXactionPointer &xact)
 create a new HTTP connection handler; never returns NULL More...
 

Variables

const SBuf MethodType_sb [] = {SBuf()}
 
const HeaderLookupTable_t HeaderLookupTable
 

Typedef Documentation

◆ MessagePointer

Definition at line 22 of file forward.h.

◆ MethodType

◆ StreamPointer

Definition at line 25 of file forward.h.

Enumeration Type Documentation

◆ _method_t

Enumerator
METHOD_NONE 
METHOD_GET 
METHOD_POST 
METHOD_PUT 
METHOD_HEAD 
METHOD_CONNECT 
METHOD_TRACE 
METHOD_OPTIONS 
METHOD_DELETE 
METHOD_LINK 
METHOD_UNLINK 
METHOD_CHECKOUT 
METHOD_CHECKIN 
METHOD_UNCHECKOUT 
METHOD_MKWORKSPACE 
METHOD_VERSION_CONTROL 
METHOD_REPORT 
METHOD_UPDATE 
METHOD_LABEL 
METHOD_MERGE 
METHOD_BASELINE_CONTROL 
METHOD_MKACTIVITY 
METHOD_PROPFIND 
METHOD_PROPPATCH 
METHOD_MKCOL 
METHOD_COPY 
METHOD_MOVE 
METHOD_LOCK 
METHOD_UNLOCK 
METHOD_SEARCH 
METHOD_PRI 
METHOD_PURGE 
METHOD_OTHER 
METHOD_ENUM_END 

Definition at line 21 of file MethodType.h.

◆ HdrFieldType

possible types for http header fields

Enumerator
ftInvalid 

to catch nasty errors with hdr_id<->fld_type clashes

ftInt 
ftInt64 
ftStr 
ftDate_1123 
ftETag 
ftPCc 
ftPContRange 
ftPRange 
ftPSc 
ftDate_1123_or_ETag 

Definition at line 127 of file RegisteredHeaders.h.

◆ HdrKind

Enumerator
None 
ListHeader 
RequestHeader 
ReplyHeader 
HopByHopHeader 
Denied304Header 
GeneralHeader 
EntityHeader 

Definition at line 141 of file RegisteredHeaders.h.

◆ HdrType

recognized or "known" header fields; and the RFC which defines them (or not) http://www.iana.org/assignments/message-headers/message-headers.xhtml

Enumerator
enumBegin_ 
ACCEPT 

RFC 7231

ACCEPT_CHARSET 

RFC 7231

ACCEPT_ENCODING 

RFC 7231

ACCEPT_LANGUAGE 

RFC 7231

ACCEPT_RANGES 

RFC 7233

AGE 

RFC 9111

ALLOW 

RFC 7231

ALTERNATE_PROTOCOL 

GFE custom header we may have to erase

AUTHENTICATION_INFO 

RFC 2617

AUTHORIZATION 

RFC 7235, 4559

CACHE_CONTROL 

RFC 9111

CACHE_STATUS 

draft-ietf-httpbis-cache-header

CDN_LOOP 

RFC 8586

CONNECTION 

RFC 7230

CONTENT_BASE 

obsoleted RFC 2068

CONTENT_DISPOSITION 

RFC 2183, 6266

CONTENT_ENCODING 

RFC 7231

CONTENT_LANGUAGE 

RFC 7231

CONTENT_LENGTH 

RFC 7230

CONTENT_LOCATION 

RFC 7231

CONTENT_MD5 

deprecated, RFC 2616

CONTENT_RANGE 

RFC 7233

CONTENT_TYPE 

RFC 7231

COOKIE 

RFC 6265 header we may need to erase

COOKIE2 

obsolete RFC 2965 header we may need to erase

DATE 

RFC 7231

ETAG 

RFC 7232

EXPECT 

RFC 7231

EXPIRES 

RFC 9111

FORWARDED 

RFC 7239

FROM 

RFC 7231

HOST 

RFC 7230

IF_MATCH 

RFC 7232

IF_MODIFIED_SINCE 

RFC 7232

IF_NONE_MATCH 

RFC 7232

IF_RANGE 

RFC 7233

IF_UNMODIFIED_SINCE 

RFC 7232

KEEP_ALIVE 

obsoleted RFC 2068 header we may need to erase

KEY 

experimental RFC Draft draft-fielding-http-key-02

LAST_MODIFIED 

RFC 7232

LINK 

RFC 5988

LOCATION 

RFC 7231

MAX_FORWARDS 

RFC 7231

MIME_VERSION 

RFC 2045, 7231

NEGOTIATE 

experimental RFC 2295. Why only this one from 2295?

ORIGIN 
PRAGMA 

deprecated RFC 7234 header

PRIORITY 

RFC 9218

PROXY_AUTHENTICATE 

RFC 7235

PROXY_AUTHENTICATION_INFO 

RFC 2617

PROXY_AUTHORIZATION 

RFC 7235

PROXY_CONNECTION 

obsolete Netscape header we may need to erase.

PROXY_SUPPORT 

RFC 4559

PUBLIC 

RFC 2068

RANGE 

RFC 7233

REFERER 

RFC 7231

REQUEST_RANGE 

some clients use this, sigh

RETRY_AFTER 

RFC 7231

SERVER 

RFC 7231

SET_COOKIE 

RFC 6265 header we may need to erase

SET_COOKIE2 

obsoleted RFC 2965 header we may need to erase

TE 

RFC 7230

TITLE 
TRAILER 

RFC 7230

TRANSFER_ENCODING 

RFC 7230

TRANSLATE 

IIS custom header we may need to erase

UNLESS_MODIFIED_SINCE 

IIS custom header we may need to erase

UPGRADE 

RFC 7230

USER_AGENT 

RFC 7231

VARY 

RFC 7231

VIA 

RFC 7230

WWW_AUTHENTICATE 

RFC 7235, 4559

X_FORWARDED_FOR 

obsolete Squid custom header, RFC 7239

X_REQUEST_URI 

Squid custom header appended if ADD_X_REQUEST_URI is defined

X_SQUID_ERROR 

Squid custom header on generated error responses

HDR_X_ACCELERATOR_VARY 

obsolete Squid custom header.

X_NEXT_SERVICES 

Squid custom ICAP header

SURROGATE_CAPABILITY 

Edge Side Includes (ESI) header

SURROGATE_CONTROL 

Edge Side Includes (ESI) header

FRONT_END_HTTPS 

MS Exchange custom header we may have to add

FTP_COMMAND 

Internal header for FTP command

FTP_ARGUMENTS 

Internal header for FTP command arguments

FTP_PRE 

Internal header containing leading FTP control response lines

FTP_STATUS 

Internal header for FTP reply status

FTP_REASON 

Internal header for FTP reply reason

OTHER 

internal tag value for "unknown" headers

BAD_HDR 

Invalid header

enumEnd_ 

Definition at line 21 of file RegisteredHeaders.h.

◆ StatusCode

These basic HTTP reply status codes are defined by RFC 2616 unless otherwise stated. The IANA registry for HTTP status codes can be found at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

Enumerator
scNone 
scContinue 
scSwitchingProtocols 
scProcessing 

RFC2518 section 10.1

scEarlyHints 

draft-kazuho-early-hints-status-code

scOkay 
scCreated 
scAccepted 
scNonAuthoritativeInformation 
scNoContent 
scResetContent 
scPartialContent 
scMultiStatus 

RFC2518 section 10.2 / RFC4918

scAlreadyReported 

RFC5842

scImUsed 

RFC3229

scMultipleChoices 
scMovedPermanently 
scFound 
scSeeOther 
scNotModified 
scUseProxy 
scTemporaryRedirect 
scPermanentRedirect 

RFC7538

scBadRequest 
scUnauthorized 
scPaymentRequired 
scForbidden 
scNotFound 
scMethodNotAllowed 
scNotAcceptable 
scProxyAuthenticationRequired 
scRequestTimeout 
scConflict 
scGone 
scLengthRequired 
scPreconditionFailed 
scContentTooLarge 
scUriTooLong 
scUnsupportedMediaType 
scRequestedRangeNotSatisfied 
scExpectationFailed 
scMisdirectedRequest 

RFC7540 section 9.1.2

scUnprocessableEntity 

RFC2518 section 10.3 / RFC4918

scLocked 

RFC2518 section 10.4 / RFC4918

scFailedDependency 

RFC2518 section 10.5 / RFC4918

scUpgradeRequired 
scPreconditionRequired 

RFC6585

scTooManyRequests 

RFC6585

scRequestHeaderFieldsTooLarge 

RFC6585

scUnavailableForLegalReasons 

RFC7725

scInternalServerError 
scNotImplemented 
scBadGateway 
scServiceUnavailable 
scGatewayTimeout 
scHttpVersionNotSupported 
scVariantAlsoNegotiates 

RFC2295

scInsufficientStorage 

RFC2518 section 10.6 / RFC4918

scLoopDetected 

RFC5842

scNotExtended 

RFC2774

scNetworkAuthenticationRequired 

RFC6585

scInvalidHeader 

Squid header parsing error

scHeaderTooLarge 

Definition at line 20 of file StatusCode.h.

Function Documentation

◆ any_HdrType_enum_value()

bool Http::any_HdrType_enum_value ( const Http::HdrType  id)
inline

◆ any_registered_header()

◆ any_valid_header()

bool Http::any_valid_header ( const Http::HdrType  id)
inline

Definition at line 212 of file RegisteredHeaders.h.

References ACCEPT, and BAD_HDR.

Referenced by HttpHeader::clean(), and httpHeaderFieldStatDumper().

◆ Is1xx()

bool Http::Is1xx ( const int  sc)
inline

Definition at line 92 of file StatusCode.h.

References sc, scContinue, and scOkay.

Referenced by HttpStateData::processReplyHeader(), and ProhibitsContentLength().

◆ Is4xx()

bool Http::Is4xx ( const int  sc)
inline

Definition at line 94 of file StatusCode.h.

References sc, scBadRequest, and scInternalServerError.

Referenced by CachePeer::noteFailure().

◆ IsReforwardableStatus()

◆ MethodStr()

const SBuf & Http::MethodStr ( const MethodType  m)
inline

Definition at line 100 of file MethodType.h.

References MethodType_sb.

Referenced by clientReplyContext::purgeEntry().

◆ NewServer()

ConnStateData * Http::NewServer ( const MasterXactionPointer xact)

Definition at line 391 of file Http1Server.cc.

Referenced by httpAccept().

◆ operator<<() [1/2]

◆ operator<<() [2/2]

std::ostream & Http::operator<< ( std::ostream &  s,
HdrType  id 
)

◆ ProhibitsContentLength()

bool Http::ProhibitsContentLength ( const StatusCode  sc)
inline

◆ ProtocolVersion() [1/2]

AnyP::ProtocolVersion Http::ProtocolVersion ( )
inline

HTTP version label information.

Squid being conditionally compliant with RFC 7230 on both client and server connections the default value is HTTP/1.1.

Definition at line 32 of file ProtocolVersion.h.

References AnyP::PROTO_HTTP, and ProtocolVersion().

Referenced by ProtocolVersion().

◆ ProtocolVersion() [2/2]

◆ SlowlyParseQuotedString()

SBuf Http::SlowlyParseQuotedString ( const char *  description,
const char *  start,
size_t  length 
)

Parses an HTTP quoted-string sequence (RFC 9110, Section 5.6.4).

Parameters
abrief human-friendly description of the string being parsed
startinput buffer (an opening double-quote is expected at *start)
lengthis the number of characters in the given buffer
Returns
string contents with open/closing quotes stripped and any quoted-pairs decoded

Avoid this slow function on performance-sensitive code paths. TODO: Replace with an efficient, SBuf-friendly implementation.

See also
httpHeaderParseQuotedString() for a String-friendly function.

Definition at line 238 of file HttpHeaderTools.cc.

References Here, httpHeaderParseQuotedString(), StringToSBuf(), and ToSBuf().

Referenced by SlowlyParseQuotedField().

◆ StatusCodeString()

Variable Documentation

◆ HeaderLookupTable

◆ MethodType_sb

const SBuf Http::MethodType_sb = {SBuf()}

Definition at line 58 of file stub_libhttp.cc.

Referenced by HttpRequestMethod::image(), and MethodStr().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors