if (res == 0) {
debugs(58, 2, "HttpMsg::parse: strange, need more data near '" <<
buf->content() << "'");
+ *error = HTTP_INVALID_HEADER;
return false; // but this should not happen due to headersEnd() above
}
/* pre-set these values to make aborting simpler */
*method_p = METHOD_NONE;
+ /* NP: don't be tempted to move this down or remove again.
+ * It's the only DDoS protection old-String has against long URL */
+ if ( hp->bufsiz <= 0) {
+ debugs(33, 5, "Incomplete request, waiting for end of request line");
+ return NULL;
+ }
+ else if ( (size_t)hp->bufsiz >= Config.maxRequestHeaderSize && headersEnd(hp->buf, Config.maxRequestHeaderSize) == 0) {
+ debugs(33, 5, "parseHttpRequest: Too large request");
+ return parseHttpRequestAbort(conn, "error:request-too-large");
+ }
+
/* Attempt to parse the first line; this'll define the method, url, version and header begin */
r = HttpParserParseReqLine(hp);
surrogateNoStore = false;
fd = fwd->server_fd;
readBuf = new MemBuf;
- readBuf->init(4096, SQUID_TCP_SO_RCVBUF);
+ readBuf->init();
orig_request = HTTPMSGLOCK(fwd->request);
if (fwd->servers)