]> granicus.if.org Git - icinga2/commitdiff
Increase header size to 8KB for HTTP requests 6357/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 6 Jun 2018 18:23:14 +0000 (20:23 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 6 Jun 2018 18:25:36 +0000 (20:25 +0200)
This is the default for Tomcat and Apache too
and avoids problems with cookies and long URLs.

fixes #6355

doc/12-icinga2-api.md
lib/remote/httprequest.cpp

index d427505ad575667c9bf7e12116887608370ee710..c029aee0e05b78142201ef3b330ab2af3011e754 100644 (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`
index 55d6f0a3fc2884c1f38a1f932fa1684293847a52..f698b2101cb9388d5e9f26c210deedd2e0edf648 100644 (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 */