#include <HttpHeader.h>

Inheritance diagram for HttpHeader:
Collaboration diagram for HttpHeader:

Public Member Functions

 HttpHeader ()
 
 HttpHeader (const http_hdr_owner_type owner)
 
 HttpHeader (const HttpHeader &other)
 
 ~HttpHeader ()
 
HttpHeaderoperator= (const HttpHeader &other)
 
void clean ()
 
void append (const HttpHeader *src)
 
bool update (HttpHeader const *fresh)
 
void compact ()
 
int parse (const char *header_start, size_t len)
 
int parse (const char *buf, size_t buf_len, bool atEnd, size_t &hdr_sz)
 
void packInto (Packable *p, bool mask_sensitive_info=false) const
 
HttpHeaderEntrygetEntry (HttpHeaderPos *pos) const
 
HttpHeaderEntryfindEntry (Http::HdrType id) const
 
int delByName (const SBuf &name)
 
int delByName (const char *name)
 
int delById (Http::HdrType id)
 
void delAt (HttpHeaderPos pos, int &headers_deleted)
 
void refreshMask ()
 
void addEntry (HttpHeaderEntry *e)
 
void insertEntry (HttpHeaderEntry *e)
 
String getList (Http::HdrType id) const
 
bool getList (Http::HdrType id, String *s) const
 
bool conflictingContentLength () const
 
String getStrOrList (Http::HdrType id) const
 
String getByName (const SBuf &name) const
 
String getByName (const char *name) const
 
String getById (Http::HdrType id) const
 
bool getByIdIfPresent (Http::HdrType id, String *result) const
 
bool hasNamed (const SBuf &s, String *value=0) const
 
bool hasNamed (const char *name, unsigned int namelen, String *value=0) const
 
String getByNameListMember (const char *name, const char *member, const char separator) const
 
String getListMember (Http::HdrType id, const char *member, const char separator) const
 
int has (Http::HdrType id) const
 
void addVia (const AnyP::ProtocolVersion &ver, const HttpHeader *from=0)
 
void putInt (Http::HdrType id, int number)
 
void putInt64 (Http::HdrType id, int64_t number)
 
void putTime (Http::HdrType id, time_t htime)
 
void putStr (Http::HdrType id, const char *str)
 
void putAuth (const char *auth_scheme, const char *realm)
 
void putCc (const HttpHdrCc *cc)
 
void putContRange (const HttpHdrContRange *cr)
 
void putRange (const HttpHdrRange *range)
 
void putSc (HttpHdrSc *sc)
 
void putWarning (const int code, const char *const text)
 add a Warning header More...
 
void putExt (const char *name, const char *value)
 
int getInt (Http::HdrType id) const
 
int64_t getInt64 (Http::HdrType id) const
 
time_t getTime (Http::HdrType id) const
 
const char * getStr (Http::HdrType id) const
 
const char * getLastStr (Http::HdrType id) const
 
HttpHdrCcgetCc () const
 
HttpHdrRangegetRange () const
 
HttpHdrScgetSc () const
 
HttpHdrContRangegetContRange () const
 
const char * getAuth (Http::HdrType id, const char *auth_scheme) const
 
ETag getETag (Http::HdrType id) const
 
TimeOrTag getTimeOrTag (Http::HdrType id) const
 
int hasListMember (Http::HdrType id, const char *member, const char separator) const
 
int hasByNameListMember (const char *name, const char *member, const char separator) const
 
void removeHopByHopEntries ()
 
bool chunked () const
 whether message uses chunked Transfer-Encoding More...
 

Public Attributes

std::vector< HttpHeaderEntry * > entries
 
HttpHeaderMask mask
 
http_hdr_owner_type owner
 
int len
 

Protected Member Functions

void removeConnectionHeaderEntries ()
 
bool needUpdate (const HttpHeader *fresh) const
 check whether the fresh header has any new/changed updatable fields More...
 
bool skipUpdateHeader (const Http::HdrType id) const
 
void updateWarnings ()
 

Static Protected Member Functions

static bool Isolate (const char **parse_start, size_t l, const char **blk_start, const char **blk_end)
 

Private Member Functions

HttpHeaderEntryfindLastEntry (Http::HdrType id) const
 

Private Attributes

bool conflictingContentLength_
 found different Content-Length fields More...
 

Detailed Description

Definition at line 71 of file HttpHeader.h.

Constructor & Destructor Documentation

HttpHeader::HttpHeader ( )

Definition at line 146 of file HttpHeader.cc.

References httpHeaderMaskInit(), and mask.

HttpHeader::HttpHeader ( const http_hdr_owner_type  owner)
explicit

Definition at line 151 of file HttpHeader.cc.

References assert, debugs, hoEnd, hoNone, httpHeaderMaskInit(), mask, and owner.

HttpHeader::HttpHeader ( const HttpHeader other)

Definition at line 158 of file HttpHeader.cc.

References httpHeaderMaskInit(), mask, and update().

HttpHeader::~HttpHeader ( )

Definition at line 164 of file HttpHeader.cc.

References clean().

Member Function Documentation

void HttpHeader::append ( const HttpHeader src)

Definition at line 232 of file HttpHeader.cc.

References addEntry(), assert, debugs, and entries.

Referenced by HttpRequest::clone(), HttpReply::clone(), and ESIVarState::ESIVarState().

bool HttpHeader::chunked ( ) const
inline
void HttpHeader::compact ( )

Definition at line 717 of file HttpHeader.cc.

References entries.

Referenced by HttpReply::updateOnNotModified().

bool HttpHeader::conflictingContentLength ( ) const
inline

Definition at line 108 of file HttpHeader.h.

References conflictingContentLength_.

Referenced by clientIsContentLengthValid().

int HttpHeader::delByName ( const SBuf name)

deletes all fields with a given name, if any.

Returns
#fields deleted

Definition at line 653 of file HttpHeader.cc.

References CBIT_SET, debugs, delAt(), getEntry(), HttpHeaderInitPos, httpHeaderMaskInit(), and mask.

Referenced by update().

int HttpHeader::delByName ( const char *  name)
inline
Deprecated:
use SBuf method instead. performance regression: reallocates

Definition at line 100 of file HttpHeader.h.

References delByName().

Referenced by delByName().

HttpHeaderEntry * HttpHeader::findLastEntry ( Http::HdrType  id) const
private

Definition at line 633 of file HttpHeader.cc.

References Http::any_registered_header(), assert, CBIT_TEST, entries, Http::HeaderLookupTable, mask, and NULL.

Referenced by getLastStr().

const char * HttpHeader::getAuth ( Http::HdrType  id,
const char *  auth_scheme 
) const
String HttpHeader::getById ( Http::HdrType  id) const

Definition at line 888 of file HttpHeader.cc.

References getByIdIfPresent().

bool HttpHeader::getByIdIfPresent ( Http::HdrType  id,
String result 
) const

returns true iff a [possibly empty] field identified by id is there when returning true, also sets the result parameter (if it is not nil)

Definition at line 902 of file HttpHeader.cc.

References Http::BAD_HDR, getStrOrList(), and has().

Referenced by getById(), and hasNamed().

String HttpHeader::getByName ( const char *  name) const

Definition at line 870 of file HttpHeader.cc.

References hasNamed().

String HttpHeader::getByNameListMember ( const char *  name,
const char *  member,
const char  separator 
) const

Definition at line 948 of file HttpHeader.cc.

References String::append(), assert, getByName(), NULL, and strListGetItem().

Referenced by Format::Format::assemble().

bool HttpHeader::getList ( Http::HdrType  id,
String s 
) const
String HttpHeader::getListMember ( Http::HdrType  id,
const char *  member,
const char  separator 
) const
int HttpHeader::hasByNameListMember ( const char *  name,
const char *  member,
const char  separator 
) const

Definition at line 1689 of file HttpHeader.cc.

References assert, getByName(), NULL, and strListGetItem().

Referenced by Adaptation::Icap::Options::configure().

int HttpHeader::hasListMember ( Http::HdrType  id,
const char *  member,
const char  separator 
) const
bool HttpHeader::hasNamed ( const SBuf s,
String value = 0 
) const

returns true iff a [possibly empty] named field is there when returning true, also sets the value parameter (if it is not nil)

Definition at line 896 of file HttpHeader.cc.

References SBuf::length(), and SBuf::rawContent().

Referenced by getByName(), ACLHTTPHeaderData::match(), and needUpdate().

bool HttpHeader::Isolate ( const char **  parse_start,
size_t  l,
const char **  blk_start,
const char **  blk_end 
)
staticprotected

either finds the end of headers or returns false If the end was found: *parse_start points to the first character after the header delimiter *blk_start points to the first header character (i.e. old parse_start value) *blk_end points to the first header delimiter character (CR or LF in CR?LF). If block starts where it ends, then there are no fields in the header.

Definition at line 322 of file HttpHeader.cc.

References assert, and headersEnd().

Referenced by parse().

bool HttpHeader::needUpdate ( const HttpHeader fresh) const
protected

Definition at line 246 of file HttpHeader.cc.

References entries, getByName(), hasNamed(), and skipUpdateHeader().

Referenced by update().

HttpHeader & HttpHeader::operator= ( const HttpHeader other)

Definition at line 170 of file HttpHeader.cc.

References assert, clean(), conflictingContentLength_, len, owner, and update().

int HttpHeader::parse ( const char *  buf,
size_t  buf_len,
bool  atEnd,
size_t hdr_sz 
)

Parses headers stored in a buffer.

Returns
1 and sets hdr_sz on success
0 when needs more data
-1 on error

Definition at line 344 of file HttpHeader.cc.

References buf, Isolate(), and parse().

void HttpHeader::putAuth ( const char *  auth_scheme,
const char *  realm 
)
void HttpHeader::putExt ( const char *  name,
const char *  value 
)
void HttpHeader::putRange ( const HttpHdrRange range)
void HttpHeader::putSc ( HttpHdrSc sc)
void HttpHeader::putWarning ( const int  code,
const char *const  text 
)

Definition at line 1143 of file HttpHeader.cc.

References buf, putStr(), visible_appname_string, and Http::WARNING.

Referenced by clientReplyContext::buildReplyHeader().

void HttpHeader::removeConnectionHeaderEntries ( )
protected
bool HttpHeader::skipUpdateHeader ( const Http::HdrType  id) const
protected

Definition at line 273 of file HttpHeader.cc.

References Http::WARNING.

Referenced by needUpdate(), and update().

void HttpHeader::updateWarnings ( )
protected

Definition at line 260 of file HttpHeader.cc.

References delAt(), getEntry(), HttpHeaderInitPos, and Http::WARNING.

Referenced by update().

Member Data Documentation

bool HttpHeader::conflictingContentLength_
private

Definition at line 177 of file HttpHeader.h.

Referenced by clean(), conflictingContentLength(), operator=(), and parse().

std::vector<HttpHeaderEntry *> HttpHeader::entries

parsed fields in raw format

Definition at line 156 of file HttpHeader.h.

Referenced by addEntry(), append(), clean(), compact(), delAt(), findEntry(), findLastEntry(), getEntry(), getList(), insertEntry(), needUpdate(), and refreshMask().

int HttpHeader::len

length when packed, not counting terminating null-byte

Definition at line 159 of file HttpHeader.h.

Referenced by addEntry(), clean(), delAt(), insertEntry(), operator=(), peerDigestRequest(), and HttpRequest::prefixLen().

HttpHeaderMask HttpHeader::mask
http_hdr_owner_type HttpHeader::owner

request or reply

Definition at line 158 of file HttpHeader.h.

Referenced by clean(), getCc(), getSc(), HttpStateData::httpBuildRequestHeader(), HttpHeader(), operator=(), and parse().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors