Increase header size to 8KB for HTTP requests

This is the default for Tomcat and Apache too
and avoids problems with cookies and long URLs.

fixes #6355
This commit is contained in:
Michael Friedrich 2018-06-06 20:23:14 +02:00
parent 2dafcfa8a9
commit 447dad91c0
2 changed files with 10 additions and 2 deletions

View File

@ -83,6 +83,8 @@ All requests apart from `GET` require that the following `Accept` header is set:
Each URL is prefixed with the API version (currently "/v1").
HTTP header size is limited to 8KB.
### Responses <a id="icinga2-api-responses"></a>
Successful requests will send back a response body containing a `results`

View File

@ -46,14 +46,20 @@ bool HttpRequest::ParseHeaders(StreamReadContext& src, bool may_wait)
StreamReadStatus srs = m_Stream->ReadLine(&line, src, may_wait);
if (srs != StatusNewItem) {
if (src.Size > 512)
if (src.Size > 8 * 1024)
BOOST_THROW_EXCEPTION(std::invalid_argument("Line length for HTTP header exceeded"));
return false;
}
if (line.GetLength() > 512)
if (line.GetLength() > 8 * 1024) {
#ifdef I2_DEBUG /* I2_DEBUG */
Log(LogDebug, "HttpRequest")
<< "Header size: " << line.GetLength() << " content: '" << line << "'.";
#endif /* I2_DEBUG */
BOOST_THROW_EXCEPTION(std::invalid_argument("Line length for HTTP header exceeded"));
}
if (m_State == HttpRequestStart) {
/* ignore trailing new-lines */