common parts of HttpRequest and HttpReply More...
#include <Message.h>


Public Types | |
enum | Sources { srcUnknown = 0, srcHttps = 1 << 0, srcFtps = 1 << 1, srcIcaps = 1 << 2, srcEcaps = 1 << 3, srcHttp = 1 << (16 + 0), srcFtp = 1 << (16 + 1), srcIcap = 1 << (16 + 2), srcEcap = 1 << (16 + 3), srcGopher = 1 << (16 + 14), srcWhois = 1 << (16 + 15), srcUnsafe = 0xFFFF0000, srcSafe = 0x0000FFFF } |
Who may have created or modified this message? More... | |
enum | ParseState { psReadyToParseStartLine = 0, psReadyToParseHeaders, psParsed, psError } |
parse state of HttpReply or HttpRequest More... | |
Public Member Functions | |
Message (http_hdr_owner_type) | |
virtual | ~Message () |
virtual void | reset ()=0 |
void | packInto (Packable *, bool full_uri) const |
produce a message copy, except for a few connection-specific settings More... | |
virtual Http::Message * | clone () const =0 |
void | setContentLength (int64_t) |
[re]sets Content-Length header and cached value More... | |
bool | persistent () const |
void | putCc (const HttpHdrCc *otherCc) |
copies Cache-Control header to this message More... | |
bool | parse (const char *buf, const size_t sz, bool eol, Http::StatusCode *error) |
bool | parseCharBuf (const char *buf, ssize_t end) |
int | httpMsgParseStep (const char *buf, int len, int atEnd) |
virtual int | httpMsgParseError () |
virtual bool | expectingBody (const HttpRequestMethod &, int64_t &) const =0 |
void | firstLineBuf (MemBuf &) |
useful for debugging More... | |
virtual bool | inheritProperties (const Http::Message *)=0 |
Public Attributes | |
AnyP::ProtocolVersion | http_ver |
HttpHeader | header |
HttpHdrCc * | cache_control = nullptr |
int | hdr_sz = 0 |
int64_t | content_length = 0 |
ParseState | pstate = Http::Message::psReadyToParseStartLine |
the current parsing state More... | |
BodyPipe::Pointer | body_pipe |
optional pipeline to receive message body More... | |
uint32_t | sources = 0 |
The message sources. More... | |
Protected Member Functions | |
virtual bool | sanityCheckStartLine (const char *buf, const size_t hdr_len, Http::StatusCode *error)=0 |
virtual void | packFirstLineInto (Packable *p, bool full_uri) const =0 |
virtual bool | parseFirstLine (const char *blk_start, const char *blk_end)=0 |
virtual void | hdrCacheInit () |
virtual void | configureContentLengthInterpreter (Http::ContentLengthInterpreter &)=0 |
configures the interpreter as needed More... | |
bool | parseHeader (Http1::Parser &, Http::ContentLengthInterpreter &) |
Detailed Description
Member Enumeration Documentation
◆ ParseState
◆ Sources
Constructor & Destructor Documentation
◆ Message()
Http::Message::Message | ( | http_hdr_owner_type | owner | ) |
Definition at line 23 of file Message.cc.
◆ ~Message()
|
virtual |
Definition at line 28 of file Message.cc.
References assert.
Member Function Documentation
◆ clone()
|
pure virtual |
Implemented in HttpRequest, and HttpReply.
Referenced by Adaptation::Message::ShortCircuit().
◆ configureContentLengthInterpreter()
|
protectedpure virtual |
Implemented in HttpRequest, and HttpReply.
◆ expectingBody()
|
pure virtual |
Implemented in HttpRequest, and HttpReply.
Referenced by Adaptation::Icap::ModXact::estimateVirginBody().
◆ firstLineBuf()
void Http::Message::firstLineBuf | ( | MemBuf & | mb | ) |
Definition at line 295 of file Message.cc.
◆ hdrCacheInit()
|
protectedvirtual |
Reimplemented in HttpRequest, and HttpReply.
Definition at line 286 of file Message.cc.
References assert, Http::CONTENT_LENGTH, and NULL.
Referenced by HttpReply::hdrCacheInit(), and HttpRequest::hdrCacheInit().
◆ httpMsgParseError()
|
virtual |
Reimplemented in HttpReply.
Definition at line 246 of file Message.cc.
Referenced by HttpReply::httpMsgParseError().
◆ httpMsgParseStep()
parses a 0-terminated buffer into Http::Message.
- Return values
-
1 success 0 need more data (partial parse) -1 parse error
Definition at line 170 of file Message.cc.
References assert, buf, httpMsgIsolateStart(), len, PROF_start, PROF_stop, psParsed, psReadyToParseHeaders, and psReadyToParseStartLine.
◆ inheritProperties()
|
pure virtual |
Implemented in HttpRequest, and HttpReply.
Referenced by Adaptation::Icap::ModXact::encapsulateHead(), and Adaptation::Icap::ModXact::prepEchoing().
◆ packFirstLineInto()
|
protectedpure virtual |
Implemented in HttpReply, and HttpRequest.
◆ packInto()
void Http::Message::packInto | ( | Packable * | p, |
bool | full_uri | ||
) | const |
Definition at line 278 of file Message.cc.
References Packable::append().
◆ parse()
bool Http::Message::parse | ( | const char * | buf, |
const size_t | sz, | ||
bool | eol, | ||
Http::StatusCode * | error | ||
) |
Definition at line 80 of file Message.cc.
References assert, buf, Config, DBG_IMPORTANT, debugs, error(), headersEnd(), int, SquidConfig::maxReplyHeaderSize, Http::scHeaderTooLarge, Http::scInvalidHeader, Http::scNone, and sz.
Referenced by Adaptation::Icap::Xaction::parseHttpMsg().
◆ parseCharBuf()
bool Http::Message::parseCharBuf | ( | const char * | buf, |
ssize_t | end | ||
) |
parseCharBuf() takes character buffer of HTTP headers (buf), which may not be NULL-terminated, and fills in an Http::Message structure. The parameter 'end' specifies the offset to the end of the reply headers. The caller may know where the end is, but is unable to NULL-terminate the buffer. This function returns true on success.
Definition at line 148 of file Message.cc.
References MemBuf::append(), MemBuf::buf, buf, MemBuf::clean(), MemBuf::init(), MemBuf::size, and MemBuf::terminate().
Referenced by store_client::readBody(), and urnHandleReply().
◆ parseFirstLine()
|
protectedpure virtual |
Implemented in HttpRequest, and HttpReply.
◆ parseHeader()
|
protected |
Definition at line 226 of file Message.cc.
References SBuf::c_str(), Http::One::Parser::headerBlockSize(), Http::One::Parser::messageHeaderSize(), Http::One::Parser::mimeHeader(), psError, and psParsed.
◆ persistent()
bool Http::Message::persistent | ( | ) | const |
- Return values
-
true the message sender asks to keep the connection open. false the message sender will close the connection.
Factors other than the headers may result in connection closure.
Definition at line 261 of file Message.cc.
References httpHeaderHasConnDir(), and Http::ProtocolVersion().
Referenced by clientReplyContext::buildReplyHeader(), HttpReply::hdrCacheInit(), and HttpStateData::sendRequest().
◆ putCc()
void Http::Message::putCc | ( | const HttpHdrCc * | otherCc | ) |
Definition at line 34 of file Message.cc.
References Http::CACHE_CONTROL.
Referenced by HttpReply::make304().
◆ reset()
|
pure virtual |
Implemented in HttpRequest, and HttpReply.
Referenced by Adaptation::Icap::Xaction::parseHttpMsg().
◆ sanityCheckStartLine()
|
protectedpure virtual |
Validate the message start line is syntactically correct. Set HTTP error status according to problems found.
- Return values
-
true Status line has no serious problems. false Status line has a serious problem. Correct response is indicated by error.
Implemented in HttpRequest, and HttpReply.
◆ setContentLength()
void Http::Message::setContentLength | ( | int64_t | clen | ) |
Definition at line 253 of file Message.cc.
References Http::CONTENT_LENGTH.
Member Data Documentation
◆ body_pipe
BodyPipe::Pointer Http::Message::body_pipe |
Definition at line 98 of file Message.h.
Referenced by HttpRequest::bodyNibbled(), FwdState::checkRetriable(), HttpReply::clean(), HttpRequest::clean(), ClientRequestContext::clientRedirectDone(), Adaptation::Ecap::MessageRep::clone(), HttpReply::clone(), HttpRequest::clone(), FwdState::doneWithRetries(), Adaptation::Icap::ModXact::estimateVirginBody(), Adaptation::Icap::ModXact::finalizeLogInfo(), ClientHttpRequest::handleAdaptationFailure(), Client::handleAdaptedHeader(), HttpRequest::init(), ClientHttpRequest::logRequest(), Adaptation::Icap::ModXact::prepEchoing(), HttpStateData::sendRequest(), Adaptation::Icap::InOut::setHeader(), Adaptation::Message::ShortCircuit(), Client::startAdaptation(), Client::startRequestBodyFlow(), Adaptation::Ecap::XactionRep::useAdapted(), and Adaptation::Ecap::XactionRep::useVirgin().
◆ cache_control
HttpHdrCc* Http::Message::cache_control = nullptr |
Definition at line 77 of file Message.h.
Referenced by HttpRequest::clean(), HttpStateData::haveParsedReplyHeaders(), HttpReply::hdrCacheClean(), HttpReply::hdrExpirationTime(), MimeIcon::load(), HttpReply::make304(), HttpRequest::maybeCacheable(), ClientHttpRequest::onlyIfCached(), and HttpStateData::reusableReply().
◆ content_length
int64_t Http::Message::content_length = 0 |
Definition at line 84 of file Message.h.
Referenced by HttpReply::bodySize(), Http::Stream::buildRangeHeader(), HttpHdrRange::canonize(), StoreEntry::checkTooBig(), StoreEntry::checkTooSmall(), clientIsContentLengthValid(), HttpReply::expectingBody(), HttpRequest::expectingBody(), Downloader::handleReply(), HttpReply::hdrCacheInit(), HttpStateData::persistentConnStatus(), HttpReply::redirect(), refreshIsCachable(), HttpStateData::sendRequest(), HttpReply::setHeaders(), storeLog(), clientReplyContext::storeNotOKTransferDone(), HttpStateData::truncateVirginBody(), and HttpReply::validatorsMatch().
◆ hdr_sz
int Http::Message::hdr_sz = 0 |
Definition at line 82 of file Message.h.
Referenced by StoreEntry::append(), HttpReply::clone(), HttpRequest::clone(), StoreEntry::contentLen(), MemObject::expectedReplySize(), Adaptation::Icap::ModXact::finalizeLogInfo(), Http::Tunneler::handleResponse(), MemObject::markEndOfReplyHeaders(), Adaptation::Icap::Xaction::parseHttpMsg(), clientReplyContext::processReplyAccess(), clientReplyContext::processReplyAccessResult(), MemObject::readAheadPolicyCanRead(), MemStore::updateHeadersOrThrow(), and StoreEntry::write().
◆ header
HttpHeader Http::Message::header |
Definition at line 75 of file Message.h.
Referenced by StoreEntry::adjustVary(), Ftp::Gateway::appendSuccessHeader(), Format::Format::assemble(), HttpStateData::blockSwitchingProtocols(), ErrorState::BuildHttpReply(), Http::Stream::buildRangeHeader(), clientReplyContext::buildReplyHeader(), ESIVarState::buildVary(), HttpRequest::canHandle1xx(), HttpReply::clean(), HttpRequest::clean(), ClientRequestContext::clientAccessCheck(), clientGetMoreData(), clientIfRangeMatch(), clientIsContentLengthValid(), Adaptation::Ecap::MessageRep::clone(), HttpReply::clone(), HttpRequest::clone(), ErrorState::compileLegacyCode(), HttpRequest::conditional(), Adaptation::Icap::Options::configure(), Ftp::Relay::createHttpReply(), ErrorState::Dump(), Adaptation::Icap::ModXact::encapsulateHead(), ESIContextNew(), Adaptation::Icap::ModXact::estimateVirginBody(), HttpReply::expectingBody(), HttpRequest::expectingBody(), Mgr::Action::fillEntry(), HttpStateData::forwardUpgrade(), Ftp::Gateway::ftpAuthRequired(), ftpSendStor(), gopherMimeCreate(), Ftp::Server::handleFeatReply(), StoreEntry::hasOneOfEtags(), HttpStateData::haveParsedReplyHeaders(), HttpReply::hdrCacheInit(), HttpRequest::hdrCacheInit(), HttpReply::hdrExpirationTime(), ClientRequestContext::hostHeaderVerify(), ClientRequestContext::hostHeaderVerifyFailed(), HttpStateData::httpBuildRequestHeader(), Log::Format::HttpdCombined(), httpMakeVaryMark(), Ftp::HttpReplyWrapper(), MimeIcon::load(), Ftp::Gateway::loginFailed(), HttpReply::make304(), Adaptation::Icap::ModXact::makeRequestHeaders(), ACLReplyHeaderStrategy< header >::match(), ACLRequestHeaderStrategy< header >::match(), ACLHTTPRepHeaderStrategy::match(), ACLHTTPReqHeaderStrategy::match(), HttpRequest::pack(), HttpReply::packHeadersUsingFastPacker(), HttpRequest::parseHeader(), Adaptation::Icap::OptXact::parseResponse(), peerDigestRequest(), HttpRequest::prefixLen(), Adaptation::Icap::ModXact::prepEchoing(), Ftp::PrintReply(), clientReplyContext::processConditional(), clientReplyContext::processExpired(), HttpStateData::processReplyHeader(), purgeEntriesByHeader(), HttpReply::recreateOnNotModified(), HttpReply::redirect(), HttpReply::removeIrrelevantContentLength(), HttpReply::removeStaleWarnings(), HttpStateData::reusableReply(), HttpReply::setHeaders(), UrnState::setUriResFromRequest(), Log::Format::SquidReferer(), Log::Format::SquidUserAgent(), Mgr::Inquirer::start(), CacheManager::start(), HttpStateData::statusIfComplete(), urlCheckRequest(), urnHandleReply(), Adaptation::Ecap::XactionRep::useAdapted(), Adaptation::Ecap::XactionRep::useVirgin(), HttpReply::validatorsMatch(), varyEvaluateMatch(), Http::One::Server::writeControlMsgAndCall(), Ftp::Server::writeCustomReply(), Ftp::Server::writeErrorReply(), Ftp::Server::writeForwardedReply(), and Ftp::Server::writeForwardedReplyAndCall().
◆ http_ver
AnyP::ProtocolVersion Http::Message::http_ver |
HTTP-Version field in the first line of the message. see RFC 7230 section 3.1
Definition at line 73 of file Message.h.
Referenced by netdbExchangeState::netdbExchangeState(), Format::Format::assemble(), ErrorState::BuildHttpReply(), HttpRequest::canHandle1xx(), ClientRequestContext::clientRedirectDone(), HttpReply::clone(), HttpRequest::clone(), ErrorState::compileLegacyCode(), ErrorState::Dump(), Adaptation::Icap::ModXact::encapsulateHead(), HttpStateData::forwardUpgrade(), HttpReply::hdrCacheInit(), htcpClear(), htcpQuery(), HttpStateData::httpBuildRequestHeader(), HttpRequest::pack(), HttpRequest::packFirstLineInto(), HttpRequest::parseFirstLine(), switchToTunnel(), and tunnelStart().
◆ pstate
ParseState Http::Message::pstate = Http::Message::psReadyToParseStartLine |
Definition at line 95 of file Message.h.
Referenced by HttpReply::clone(), HttpRequest::clone(), HttpReply::init(), and HttpRequest::init().
◆ sources
uint32_t Http::Message::sources = 0 |
Definition at line 100 of file Message.h.
Referenced by Ftp::Gateway::appendSuccessHeader(), Ftp::Relay::forwardReply(), gopherReadReply(), Http::Tunneler::handleResponse(), HttpReply::inheritProperties(), HttpRequest::inheritProperties(), Acl::ConnectionsEncrypted::match(), HttpStateData::processReplyHeader(), WhoisState::setReplyToOK(), Ftp::Relay::startDataDownload(), and Adaptation::Ecap::XactionRep::updateSources().
The documentation for this class was generated from the following files:
- src/http/Message.h
- src/http/Message.cc
- src/tests/stub_libhttp.cc