After upgrading to 2.3.2 the -s, -r, and -R flags to check_http no longer work, e.g:
dot 241 % pkg info nagios-plugins | fgrep Version
Version : 2.3.2,1
dot 242 % /usr/local/libexec/nagios/check_http -S -H www.freebsd.org -s operating
HTTP CRITICAL: HTTP/1.1 200 OK - string 'operating' not found on 'https://www.freebsd.org:443/' - 8195 bytes in 0.351 second response time |time=0.350931s;;;0.000000 size=8195B;;;0
This fixed by the patch in this pull request by Sebastian Wolf:
check_http: Fix issue with page length calculation #533
Please see attached patch for the port.
Created attachment 212036 [details]
After deploying this I see it only fixes use with servers that provide a content-length header in the repsonse; my read of the spec:
Applications SHOULD use this field to indicate the transfer-length of the message-body
but I find I have http servers (e.g. embedded devices) that do not provide content-length. I will test and submit a new patch that just reverts the new content-length code in check_http() to the 2.3.1 version.
Created attachment 212040 [details]
Revised patch that reverts most of check_http to the 2.3.1 version. This version works even when a content-length header is not provided by the http server.
This issue is fixed by 2.3.3, committed by mat@ yesterday:
> 2020-03-03 madlohe <firstname.lastname@example.org>
> * plugins/check_http.c: (Handles #535) check_http: Ensure that trailing
> null byte is copied to full_page_new (gets overwritten each loop
> 2020-03-02 madlohe <email@example.com>
> * plugins/check_http.c: Content-Length is not required - don't check it
> if it wasn't included in the headers.