[Nagiosplug-devel] [ nagiosplug-Patches-1562572 ] check_http redirection fix

SourceForge.net noreply at sourceforge.net
Thu Sep 21 02:41:57 CEST 2006


Patches item #1562572, was opened at 2006-09-20 19:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1562572&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Aravind Gottipati (gottipati)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_http redirection fix

Initial Comment:
check_http fails to follow http redirects.  It fails in
cases where the return headers have a line that starts
with L like this example below.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
check_http -I 63.245.209.26  -H www.worldfirefoxday.com
-f follow -v -u /
GET / HTTP/1.0
User-Agent: check_http/1.81 (nagios-plugins 1.4.1)
Host: www.worldfirefoxday.com

http://63.245.209.26:80/ is 439 characters
STATUS: HTTP/1.1 302 Found
**** HEADER ****
Date: Wed, 20 Sep 2006 06:12:31 GMT
Server: Apache/2.0.52 (Red Hat)
Last-Modified: Wed, 20 Sep 2006 06:12:31 GMT
Pragma: no-cache
Location: http://www.worldfirefoxday.com/en/
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8
**** CONTENT ****

GET /Last-Modified: HTTP/1.0
User-Agent: check_http/1.81 (nagios-plugins 1.4.1)
Host: www.worldfirefoxday.com

http://www.worldfirefoxday.com:80/Last-Modified: is 483
characters
STATUS: HTTP/1.1 404 Not Found
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

The problem seems to be with this line in the redir
function in check_http.c
if (sscanf (pos,
"%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n",
xx, &i) < 1) {

Checking the value of i seems to be a better indicator
of the match than the return value of sscanf.  The
following patch fixes this problem for me.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1562572&group_id=29880




More information about the Devel mailing list