23 http_ver(
Http::ProtocolVersion()),
37 header.putCc(*cache_control);
44 const auto slen = strcspn(*parse_start,
"\r\n");
46 if (!(*parse_start)[slen])
49 *blk_start = *parse_start;
51 *blk_end = *blk_start + slen;
53 while (**blk_end ==
'\r')
56 if (**blk_end ==
'\n')
59 *parse_start = *blk_end;
83 if (!sanityCheckStartLine(buf, hdr_len,
error)) {
94 const int res = httpMsgParseStep(buf, sz, eof);
97 debugs(58, 3,
"cannot parse isolated headers in '" << buf <<
"'");
103 debugs(58, 2,
"strange, need more data near '" << buf <<
"'");
109 debugs(58, 9,
"success (" << hdr_len <<
" bytes) near '" << buf <<
"'");
111 if (hdr_sz != (
int)hdr_len) {
112 debugs(58,
DBG_IMPORTANT,
"ERROR: internal Http::Message::parse vs. headersEnd failure: " <<
113 hdr_sz <<
" != " << hdr_len);
114 hdr_sz = (
int)hdr_len;
138 success = httpMsgParseStep(mb.
buf, mb.
size, 0);
153 const char *parse_start = buf;
155 const char *blk_start, *blk_end;
156 const char **parse_end_ptr = &blk_end;
160 *parse_end_ptr = parse_start;
167 if (!parseFirstLine(blk_start, blk_end)) {
168 return httpMsgParseError();
171 *parse_end_ptr = parse_start;
173 hdr_sz = *parse_end_ptr - buf;
174 parse_len = parse_len - hdr_sz;
187 configureContentLengthInterpreter(interpreter);
188 const int parsed = header.parse(parse_start, parse_len, atEnd, hsize, interpreter);
190 return !parsed ? 0 : httpMsgParseError();
206 configureContentLengthInterpreter(clen);
232 content_length = clen;
243 static SBuf close(
"close", 5);
247 static SBuf keepAlive(
"keep-alive", 10);
255 packFirstLineInto(p, full_uri);
264 assert(
nullptr == cache_control);
265 cache_control = header.getCc();
272 packFirstLineInto(&mb,
true);
void error(char *format,...)
virtual void hdrCacheInit()
void packInto(Packable *, bool full_uri) const
produce a message copy, except for a few connection-specific settings
void setContentLength(int64_t)
[re]sets Content-Length header and cached value
int httpMsgParseStep(const char *buf, int len, int atEnd)
Message(http_hdr_owner_type)
virtual int httpMsgParseError()
void firstLineBuf(MemBuf &)
useful for debugging
@ psReadyToParseStartLine
bool parseHeader(Http1::Parser &, Http::ContentLengthInterpreter &)
bool parse(const char *buf, const size_t sz, bool eol, Http::StatusCode *error)
bool parseCharBuf(const char *buf, ssize_t end)
void putCc(const HttpHdrCc &)
size_type headerBlockSize() const
SBuf mimeHeader() const
buffer containing HTTP mime headers, excluding message first-line.
size_type messageHeaderSize() const
void append(const char *c, int sz) override
void init(mb_size_t szInit, mb_size_t szMax)
virtual void append(const char *buf, int size)=0
Appends a c-string to existing packed data.
size_t maxReplyHeaderSize
#define debugs(SECTION, LEVEL, CONTENT)
static int httpMsgIsolateStart(const char **parse_start, const char **blk_start, const char **blk_end)
@ scHeaderTooLarge
Header too large to process.
@ scInvalidHeader
Squid header parsing error.
AnyP::ProtocolVersion ProtocolVersion()