35 surrogate_control(nullptr),
39 content_range(nullptr)
165 MemBuf *rv = temp->pack();
171 const char *ctype, int64_t clen, time_t lmt, time_t expiresTime)
189 if (expiresTime >= 0)
241 if (
one.size()==0 ||
two.size()==0 ||
one.caseCmp(
two)!=0 ) {
255 if (
one.size()==0 ||
two.size()==0 ||
one.caseCmp(
two)!=0 ) {
410 debugs(58, 3,
"Too small reply header (" << hdr_len <<
" bytes)");
419 if (strncmp(buf,
"ICY", 3) == 0) {
425 debugs(58, 3,
"missing protocol prefix (" <<
protoPrefix <<
") in '" << buf <<
"'");
434 while ((
size_t)pos <= hdr_len && (*(buf+pos) ==
'.' ||
xisdigit(*(buf+pos)) ) ) ++pos;
438 debugs(58, 3,
"missing protocol version numbers (ie. " <<
protoPrefix <<
"/1.0) in '" << buf <<
"'");
445 while ((
size_t)pos <= hdr_len && (
char)*(buf+pos) ==
' ') ++pos;
447 if ((
size_t)pos < hdr_len && !
xisdigit(*(buf+pos))) {
448 debugs(58, 3,
"missing or invalid status number in '" << buf <<
"'");
466 const bool eof =
false;
467 if (
parse(terminatedBuf, bufSize, eof, &
error)) {
468 debugs(58, 7,
"success after accumulating " << bufSize <<
" bytes and parsing " <<
hdr_sz);
510 return Message::parseHeader(hp, clen);
530 bool expectBody =
true;
573 int64_t expectedSize = -1;
579 if (expectedSize < 0)
649 debugs(58, 3,
"Removing unexpected Content-Length header");
#define Assure(condition)
#define Here()
source code location of the caller
constexpr bool Less(const A a, const B b)
whether integer a is less than integer b, with correct overflow handling
void error(char *format,...)
Acl::Answer const & fastCheck()
void updateReply(const HttpReply::Pointer &)
representation of a class of Size-limit ACLs
unsigned int major
major version number
static std::ostream & Extra(std::ostream &)
void packInto(Packable *) const
void clear()
clear the HttpBody content
bool hasSMaxAge(int32_t *val=nullptr) const
bool hasMaxAge(int32_t *val=nullptr) const
bool parseFirstLine(const char *start, const char *end) override
size_t parseTerminatedPrefix(const char *, size_t)
time_t hdrExpirationTime()
HttpHdrContRange * content_range
parsed Content-Range; nil for non-206 responses!
const HttpHdrContRange * contentRange() const
int httpMsgParseError() override
void configureContentLengthInterpreter(Http::ContentLengthInterpreter &) override
configures the interpreter as needed
HttpReplyPointer make304() const
bool olderThan(const HttpReply *them) const
bool expectingBody(const HttpRequestMethod &, int64_t &) const override
bool parseHeader(Http1::Parser &hp)
parses reply header using Parser
HttpHdrSc * surrogate_control
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
bool inheritProperties(const Http::Message *) override
void calcMaxBodySize(HttpRequest &request) const
int64_t bodySize(const HttpRequestMethod &) const
MemBuf * packed304Reply() const
void removeIrrelevantContentLength()
Some response status codes prohibit sending Content-Length (RFC 7230 section 3.3.2).
bool receivedBodyTooLarge(HttpRequest &, int64_t receivedBodySize)
void redirect(Http::StatusCode, const char *)
bool sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error) override
int validatorsMatch(HttpReply const *other) const
void hdrCacheInit() override
void packHeadersUsingSlowPacker(Packable &p) const
same as packHeadersUsingFastPacker() but assumes that p cannot quickly process small additions
void packInto(MemBuf &) const
void packHeadersUsingFastPacker(Packable &p) const
Pointer recreateOnNotModified(const HttpReply &reply304) const
bool expectedBodyTooLarge(HttpRequest &request)
HttpReply * clone() const override
static HttpReplyPointer MakeConnectionEstablished()
construct and return an HTTP/200 (Connection Established) response
Http::MethodType id() const
void applyStatusCodeRules(const StatusCode code)
prohibits Content-Length in 1xx and 204 responses
common parts of HttpRequest and HttpReply
virtual void hdrCacheInit()
uint32_t sources
The message sources.
virtual int httpMsgParseError()
@ psReadyToParseStartLine
ParseState pstate
the current parsing state
bool parse(const char *buf, const size_t sz, bool eol, Http::StatusCode *error)
BodyPipe::Pointer body_pipe
optional pipeline to receive message body
HttpHdrCc * cache_control
void putCc(const HttpHdrCc &)
AnyP::ProtocolVersion http_ver
bool parse(const String &protoPrefix, const char *start, const char *end)
void init()
reset this status-line back to empty state
void clean()
reset this status-line back to Internal Server Error state
size_t packedLength() const
expected size of packInto() output
void packInto(Packable *) const
pack fields into a Packable object
AnyP::ProtocolVersion version
breakdown of protocol version label: (HTTP/ICY) and (0.9/1.0/1.1)
void set(const AnyP::ProtocolVersion &newVersion, Http::StatusCode newStatus, const char *newReason=nullptr)
Http::StatusCode status() const
retrieve the status code for this status line
void init(mb_size_t szInit, mb_size_t szMax)
char * content()
start of the added data
mb_size_t contentSize() const
available data size
virtual void append(const char *buf, int size)=0
Appends a c-string to existing packed data.
size_t maxReplyHeaderSize
struct SquidConfig::@90 onoff
AclSizeLimit * ReplyBodySize
int cmp(char const *) const
void assign(const char *str, int len)
an std::runtime_error with thrower location info
#define debugs(SECTION, LEVEL, CONTENT)
char const * visible_appname_string
bool ProhibitsContentLength(const StatusCode sc)
whether this response status code prohibits sending Content-Length
@ scInvalidHeader
Squid header parsing error.
AnyP::ProtocolVersion ProtocolVersion()
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf