Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#573 check_http converts semicolon to newline in -k

release-1.4.15
closed-fixed
Holger Weiß
5
2013-08-20
2012-09-24
No

When trying to pass Accept: headers, which are supposed to contain semicolons, using the -k option then the semicolon is converted to a newline (verified using snapshot version 1.4.16-38-g4cdd on RHEL 6.3 and recording request using tcpdump:

call:

./nagios-plugins-1.4.16-38-g4cdd/plugins/check_http -I obfuscated -H obfuscated -k 'Accept: application/json;charset=UTF-8' -u obfuscated

tcpdump / wireshark:

GET ofuscated HTTP/1.1
User-Agent: check_http/v1.4.16-38-g4cdd (nagios-plugins 1.4.16)
Connection: close
Host: obfuscated
Accept: application/json
charset=UTF-8

Discussion

  • Hi,
    as far as I see in the check_http source the semicolon is used as delimiter for multiple header fields.
    So as the semicolon is a valid character in header fields this should be changed.

    Due to the fact multiple -k arguments could be passed I think such a delimiter isn't needed at all.
    Is there an other reason for this delimiter?

    br,
    Richard

     
  • Hi,
    btw: I've opened a pull request for the removal of the semicolon input delimiter from the -k argument.

    br,
    Richard

     
  • I think multiple -k options don't help because there is only ONE header called "Accept:" with a value of "application/json;charset=UTF-8"

     
  • Hi,
    multiple -k options are already implemented in the current check_http.
    Using them you can define multiple HTTP header fields.

    Until now check_http wasn't able to handle semicolons (;) in an header field, due to the fact it split them up into multiple header fields.
    So after my patch the mentioned use of check_http (./nagios-plugins-1.4.16-38-g4cdd/plugins/check_http -I obfuscated -H obfuscated -k 'Accept: application/json;charset=UTF-8' -u obfuscated) will work (I've testes it, I swear^^), but you wouldn't be able to specify multiple Header fields in one -k option.

    Hope this describes it well.
    Otherwise just check the sources at https://github.com/nagios-plugins/nagios-plugins/pull/52/files or the help text of check_http.

    br,
    Richard

     
  • Holger Weiß
    Holger Weiß
    2013-05-30

    • assigned_to: nobody --> hweiss
     
  • Holger Weiß
    Holger Weiß
    2013-08-20

    This problem is now fixed in Git. Thank you for your report.

     
  • Holger Weiß
    Holger Weiß
    2013-08-20

    • status: open --> closed-fixed