[Nagiosplug-devel] [ nagiosplug-Bugs-2082501 ] check_http redirects sporadically endless in version 1.4.12

SourceForge.net noreply at sourceforge.net
Tue Sep 2 10:37:42 CEST 2008


Bugs item #2082501, was opened at 2008-08-29 16:10
Message generated for change (Comment added) made by ewasser
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=2082501&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: General plugin execution
Group: Release (specify)
Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Erik Wasser (ewasser)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_http redirects sporadically endless in version 1.4.12

Initial Comment:
The check_http plugin in version 1.4.12 is brocken. Version 1.4.11 works fine. The plugin messes up the redirection url. The redirection doesn't end and it will result in a "WARNING".

Here's the sample output, the binarys were taken from DAG http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/ but I also recompiled the version 1.4.12 from the official sources.

Plugin Version (-V output): check_http v1991 (nagios-plugins 1.4.12)
Plugin Name: check_http
Plugin Commandline showing issues: see down below
Operating System: Linux
Architecture: i386, x86_64
Compiler: gcc

WORKING VERSION 1.4.11:

% ./check_http-1.4.11-1 --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 0.552 second response time |time=0.551658s;;;0.000000 size=61131B;;;0

This is working everytime.

DEFECT VERSION 1.4.12:

The error itself is not consistent: B-(

% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 1.525 second response time |time=1.525200s;;;0.000000 size=61216B;;;0
% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP WARNING - maximum redirection depth 15 exceeded - http://www.taxi-blog.de:80wordpress/
% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 0.173 second response time |time=0.172721s;;;0.000000 size=61216B;;;0
% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 2.788 second response time |time=2.788378s;;;0.000000 size=61217B;;;0
% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 0.169 second response time |time=0.168843s;;;0.000000 size=61216B;;;0
% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP WARNING - maximum redirection depth 15 exceeded - http://www.taxi-blog.de:80wordpress/
% ./plugins/check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
HTTP WARNING - maximum redirection depth 15 exceeded - http://www.taxi-blog.de:80wordpress/

As you can see the error messages shows a messed up error message (a missing '/').

I think it depends on the header structure/size/order of the HTTP response message. Others URLs are failing
too with the version 1.4.12 so I think it's not an apache problem on the other side.

Greetings and thanks for the good work.


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

>Comment By: Erik Wasser (ewasser)
Date: 2008-09-02 10:37

Message:
Logged In: YES 
user_id=80027
Originator: YES

Here's the patch. The comments are longer than the source itself to so
please feel free to cut something. B-)

% check_http --onredirect=follow -H www.taxi-blog.de -u /wordpress/ -s
Impressum -t 30

is now working everytime.

File Added: nagios-plugins-1.4.12-ommit-default-port.patch

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

Comment By: Holger Weiss (hweiss)
Date: 2008-09-02 10:28

Message:
Logged In: YES 
user_id=759506
Originator: NO

Sure!  Just attach your patch to this tracker item and I'll look into it. 
Should be mostly trivial, just keep the different default ports for HTTP
and HTTPS in mind.

Thank you!

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

Comment By: Erik Wasser (ewasser)
Date: 2008-09-02 10:13

Message:
Logged In: YES 
user_id=80027
Originator: YES

Thanks for verbose answer.

I think you are right it's a wordpress issue but I found a least one other
(customer) application that has the same problem. And I think there were
will be more. B-(((

The symptoms are always the same. You speak to the applikation with
www.foo.invalid:80 and it returns a redirect to www.foo.invalid (without
the port number). check_http add the :80 again and the game begins again.

That makes the plugin pretty incompatible with "my" world. Currently we
can't upgrade to 1.4.12 because of this issue so I would like do to the
patch for myself because we need this feature.

Would that be okay for you?


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

Comment By: Holger Weiss (hweiss)
Date: 2008-09-01 16:58

Message:
Logged In: YES 
user_id=759506
Originator: NO

Thank you very much.  Now I can reproduce the problem: last time, I simply
grabbed the wrong SVN revision of check_http.c.  Sorry about that!

However, as far as I can tell the only bug here is the missing '/' in the
error message.  The URL which the plugin uses for the request includes the
'/', so the error message is misleading and has nothing to do with your
problem.  I now fixed the error message in SVN.  Thanks for the hint!

Regarding your actual problem: With HTTP/1.1, the server extracts the
virtual host name to use from the "Host:" header provided by the client. 
check_http generates the header line "Host: www.taxi-blog.de:80".  Now, the
problem is that the server seems to treat this as a request for a virtual
host different from the host which would be requested using "Host:
www.taxi-blog.de" (without the explicit port) and that the server therefore
redirects the client to "www.taxi-blog.de". Since the plugin then re-adds
the port number to the "Host:" header for the new (redirected) request,
there's an infinite redirection loop.  The standard clearly states that
"Host: foo" and "Host: foo:80" are equivalent for HTTP requests (see:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23).  So, IMO
it's a server issue (or a configuration problem or an issue of PHP or
Wordpress or whoever generates the response).  So I'll set this item's
status to "pending", but I'll put removing the port number from the "Host:"
header if the default port is used on my TODO list (since that shouldn't
hurt).

As to why the server only _sometimes_ behaves like this, I have no idea. 
In any case, this has nothing to do with the plugin.  Try netcat(1):

----------- 8< ------------------------------ 8< -----------

% printf "GET /wordpress/ HTTP/1.0\r\n" > /tmp/request
% printf "Host: www.taxi-blog.de:80\r\n\r\n" >> /tmp/request

% nc www.taxi-blog.de 80 < /tmp/request | head
HTTP/1.1 301 Moved Permanently
Date: Mon, 01 Sep 2008 13:01:27 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.taxi-blog.de/wordpress/xmlrpc.php
Location: http://www.taxi-blog.de/wordpress/
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: close

% nc www.taxi-blog.de 80 < /tmp/request | head
HTTP/1.1 200 OK
Date: Mon, 01 Sep 2008 13:01:25 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.taxi-blog.de/wordpress/xmlrpc.php
Last-Modified: Mon, 01 Sep 2008 13:01:21 GMT
Content-Type: text/html; charset=UTF-8
Connection: close

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

Comment By: Erik Wasser (ewasser)
Date: 2008-09-01 09:21

Message:
Logged In: YES 
user_id=80027
Originator: YES

Thanks for the feedback, that's no problem at all.

I've used the .tar.gz from SourceForge.
% cd /tmp/nagios-plugins-1.4.12
% ./configure
% make
% plugins/check_http --verbose -H www.taxi-blog.de --onredirect=follow -H
www.taxi-blog.de -u /wordpress/ -s Impressum -t 30
option f:4
GET /wordpress/ HTTP/1.0
User-Agent: check_http/v1991 (nagios-plugins 1.4.12)
Connection: close
Host: www.taxi-blog.de:80


http://www.taxi-blog.de:80/wordpress/ is 294 characters
STATUS: HTTP/1.1 301 Moved Permanently
**** HEADER ****
Date: Mon, 01 Sep 2008 07:12:39 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.taxi-blog.de/wordpress/xmlrpc.php
Location: http://www.taxi-blog.de/wordpress/
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Connection: close
**** CONTENT ****

Redirection to http://www.taxi-blog.de:80/wordpress/
GET /wordpress/ HTTP/1.0
User-Agent: check_http/v1991 (nagios-plugins 1.4.12)
Connection: close
Host: www.taxi-blog.de:80


http://www.taxi-blog.de:80/wordpress/ is 294 characters
STATUS: HTTP/1.1 301 Moved Permanently
**** HEADER ****
Date: Mon, 01 Sep 2008 07:12:39 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.taxi-blog.de/wordpress/xmlrpc.php
Location: http://www.taxi-blog.de/wordpress/
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Connection: close
**** CONTENT ****

Redirection to http://www.taxi-blog.de:80/wordpress/
GET /wordpress/ HTTP/1.0
User-Agent: check_http/v1991 (nagios-plugins 1.4.12)
Connection: close
Host: www.taxi-blog.de:80

[...snipped the repeating output...]

http://www.taxi-blog.de:80/wordpress/ is 294 characters
STATUS: HTTP/1.1 301 Moved Permanently
**** HEADER ****
Date: Mon, 01 Sep 2008 07:12:42 GMT
Server: Apache
X-Powered-By: PHP/5.1.6
X-Pingback: http://www.taxi-blog.de/wordpress/xmlrpc.php
Location: http://www.taxi-blog.de/wordpress/
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Connection: close
**** CONTENT ****

HTTP WARNING - maximum redirection depth 15 exceeded -
http://www.taxi-blog.de:80wordpress/
%

I hope that will help.


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

Comment By: Holger Weiss (hweiss)
Date: 2008-08-29 17:43

Message:
Logged In: YES 
user_id=759506
Originator: NO

There's no obvious change in the code between 1.4.11 and 1.4.12 which
could cause this, and so far, I can't reproduce the problem:

% check_http --onredirect=critical -H www.taxi-blog.de -u /wordpress/ -s
Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 0.591 second response time
|time=0.590834s;;;0.000000 size=61229B;;;0

That is, the server doesn't actually redirect this URL.  Using "-u
/wordpress" without a trailing slash redirects to /wordpress/, though.  I
tried the following call 100 times in a loop and always got an OK:

% check_http -H www.taxi-blog.de --onredirect=follow -H www.taxi-blog.de
-u /wordpress/ -s Impressum -t 30
HTTP OK HTTP/1.1 200 OK - 0.761 second response time
|time=0.760912s;;;0.000000 size=61229B;;;0

So, could you please try to reproduce the problem using "--verbose" and
post the output (up to the **** CONTENT **** part)?  (It would be nice if
you could use the version compiled from the official sources for this.)

Thank you!

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

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




More information about the Devel mailing list