check_http fails when Transfer-Encoding is the last header

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
leres
Posts: 7
Joined: Wed Feb 22, 2017 10:16 pm

check_http fails when Transfer-Encoding is the last header

Post by leres »

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:

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"
The attached patch is one way to solve this.
Attachments
patch-plugins-check_http.c
patch for check_http.c
(533 Bytes) Downloaded 320 times
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_http fails when Transfer-Encoding is the last head

Post by mcapra »

Thanks for providing the patch! I've raised an issue on the github about this:
https://github.com/nagios-plugins/nagio ... issues/240
Former Nagios employee
https://www.mcapra.com/
leres
Posts: 7
Joined: Wed Feb 22, 2017 10:16 pm

Re: check_http fails when Transfer-Encoding is the last head

Post by leres »

Thanks! I would have posted there directly but when I went looking for where to report bugs I started here:
https://nagios-plugins.org/support/
which references the support forums for reporting bugs and does not mention the github repo as far as I can see.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_http fails when Transfer-Encoding is the last head

Post by dwhitfield »

So, my initial reaction was "That's because github isn't for support. :)" That's literally what I typed, along with "https://nagios-plugins.org/development/ does reference github."

But, I now see
The Nagios support forum is the preferred method of communication when reporting bugs
I will let the developers know about this. Thanks for letting us know about both issues!
Locked