check_http fails when Transfer-Encoding is the last header
Posted: Wed Feb 22, 2017 10:30 pm
After upgrading nagios-plugins from 2.1.4 to 2.2.0 check_http started failing for a couple of sites. This appears to be because there is no trailing \r\n after nTransfer-Encoding header which happens in the failing case to appear last:
The attached patch is one way to solve this.
Code: Select all
(gdb) set print elements 1024
(gdb) p header
$6 = 0x42b52c "Transfer-Encoding"
(gdb) p headers
$7 = 0x8020d5011 "Date: Thu, 23 Feb 2017 03:06:18 GMT\r\nStrict-Transport-Security: max-age=15768000\r\nExpires: Sun, 19 Nov 1978 05:00:00 GMT\r\nCache-Control: no-cache, must-revalidate\r\nContent-Language: en\r\nLink: <https://www.acceleratecarboncapture.org/>; rel=\"canonical\",<https://www.acceleratecarboncapture.org/>; rel=\"shortlink\"\r\nVary: Accept-Encoding\r\nConnection: close\r\nContent-Type: text/html; charset=utf-8\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: SAMEORIGIN\r\nX-Xss-Protection: 1; mode=block\r\nX-Permitted-Cross-Domain-Policies: none\r\nSet-Cookie: TS01c5dffe=0194455fd2f7d13d0dfd3639e913c5be72ad765210444da57e54b28afad4297a495a503548292359a02c479837c2471e44fb798fbd; Path=/\r\nTransfer-Encoding: chunked"