Bug 244510 - net-mgmt/nagios-plugins: 2.3.2 breaks check_http for the -s, -r, and -R flags
Summary: net-mgmt/nagios-plugins: 2.3.2 breaks check_http for the -s, -r, and -R flags
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mathieu Arnold
URL:
Keywords: patch-ready
Depends on:
Blocks:
 
Reported: 2020-02-29 01:18 UTC by Craig Leres
Modified: 2020-03-13 18:09 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (mat)


Attachments
patch (1.30 KB, patch)
2020-02-29 01:18 UTC, Craig Leres
no flags Details | Diff
revised patch (3.02 KB, patch)
2020-02-29 02:08 UTC, Craig Leres
leres: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer freebsd_triage 2020-02-29 01:18:03 UTC
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:

    https://github.com/nagios-plugins/nagios-plugins/pull/533
    check_http: Fix issue with page length calculation #533

Please see attached patch for the port.
Comment 1 Craig Leres freebsd_committer freebsd_triage 2020-02-29 01:18:31 UTC
Created attachment 212036 [details]
patch
Comment 2 Craig Leres freebsd_committer freebsd_triage 2020-02-29 01:59:33 UTC
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:

    https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

    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.
Comment 3 Craig Leres freebsd_committer freebsd_triage 2020-02-29 02:08:12 UTC
Created attachment 212040 [details]
revised patch

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.
Comment 4 Craig Leres freebsd_committer freebsd_triage 2020-03-13 18:09:02 UTC
This issue is fixed by 2.3.3, committed by mat@ yesterday:

(From nagios-plugins-2.3.2/ChangeLog)

> 2020-03-03  madlohe  <swolf@nagios.com>
>
>       * plugins/check_http.c: (Handles #535) check_http: Ensure that trailing
>       null byte is copied to full_page_new (gets overwritten each loop
>       iteration)

> 2020-03-02  madlohe  <swolf@nagios.com>
>
>       * plugins/check_http.c: Content-Length is not required - don't check it
>       if it wasn't included in the headers.