You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-commits@perl.apache.org by to...@apache.org on 2010/10/04 17:06:09 UTC

svn commit: r1004275 - /perl/Apache-Test/trunk/lib/Apache/TestServer.pm

Author: torsten
Date: Mon Oct  4 15:06:09 2010
New Revision: 1004275

URL: http://svn.apache.org/viewvc?rev=1004275&view=rev
Log:
If LWP is not installed and the server is not running Apache::TestRequest::GET 
returns undef. That is correctly handled by the old code. But if LWP is 
installed even if the server is down a response object is returned. The HTTP 
code of this response is set to 500 by LWP and a response header indicates the 
connection failure. That part is not caught by the old code and hence

  t/TEST -ping=block

returns immediately even if the server is down.

Modified:
    perl/Apache-Test/trunk/lib/Apache/TestServer.pm

Modified: perl/Apache-Test/trunk/lib/Apache/TestServer.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Test/trunk/lib/Apache/TestServer.pm?rev=1004275&r1=1004274&r2=1004275&view=diff
==============================================================================
--- perl/Apache-Test/trunk/lib/Apache/TestServer.pm (original)
+++ perl/Apache-Test/trunk/lib/Apache/TestServer.pm Mon Oct  4 15:06:09 2010
@@ -672,8 +672,10 @@ sub wait_till_is_up {
     my $server_up = sub {
         local $SIG{__WARN__} = sub {}; #avoid "cannot connect ..." warnings
         # avoid fatal errors when LWP is not available
-        my $r = eval { Apache::TestRequest::GET('/index.html') };
-        return !$@ && defined $r ? $r->code : 0;
+        return eval {
+	    my $r=Apache::TestRequest::GET('/index.html');
+	    $r->code!=500 or $r->header('client-warning')!~/internal/i;
+	} || 0;
     };
 
     if ($server_up->()) {