[Linux-HA] ldirectord 1.99 fails to recognize HTTPS server being shut down

Horms horms at verge.net.au
Mon Jul 4 22:06:09 MDT 2005


On Tue, Jul 05, 2005 at 12:47:57PM +0900, Horms wrote:
> On Tue, Jul 05, 2005 at 11:14:58AM +0900, Horms wrote:
> > On Mon, Jul 04, 2005 at 11:56:29PM +0200, Volker Dormeyer wrote:
> > > Hi all,
> > > 
> > >  * On Mon, 04 Jul 2005 23:19:23 +0200,
> > >  * Bernhard Erdmann <be at berdmann.de> wrote:
> > > 
> > >  >> Thanks for pointing this out, its clearly broken.
> > >  >> Can you see if the following patch helps your cause?
> > > 
> > >  > Hi, this patch disables every real server, no matter if it's alive or not.
> > > 
> > > I believe this has something to do with the httpmethod patch I sent in
> > > some time ago. Do you use httpmethod=HEAD?
> > > 
> > > If so, this patch might help you:
> > > 
> > > --- ldirectord.orig     2005-03-25 23:49:17.096482151 +0100
> > > +++ ldirectord  2005-03-26 00:02:13.183817291 +0100
> > > @@ -1858,7 +1858,7 @@
> > >                 $port=(defined $$v{checkport}?$$v{checkport}:$$r{port})
> > >         }
> > >         my $virtualhost = (defined $$v{virtualhost} ? $$v{virtualhost} : $host);
> > > -       my ($page, $errors, $cert, $head, $body, $response, $result);
> > > +       my ($page, $errors, $cert, $head, $body, $response);
> > >         my $msg = "$$v{httpmethod}" . " $uri HTTP/1.0" . $CRLF
> > >                 . "Host: " . $virtualhost . $CRLF
> > >                 . "Accept: */*" . $CRLF . $CRLF;
> > > @@ -1879,10 +1879,10 @@
> > >                 ($response, $head) = split /\s?\n/, $head, 2;
> > >                 &ld_debug(2, "Result: $response");
> > >                 my $recstr = $$r{receive};
> > > -               if($result =~ /error/i ||
> > > +               if( !($response =~ /20[0-9]/) ||
> > >                                 ($recstr =~ /.+/ && !($body =~ /$recstr/))) {
> > >                         alarm(0);
> > > -                       die("$result");
> > > +                       die("$response");
> > >                 }
> > >         };
> > > 
> > > It parses the return code. If HTTP return code is 20x (OK) or something
> > > like that, it succeeds. But it fails if you get a redirect return code
> > > (i. e. greater than 300). It works for me.
> > > 
> > > @Horms: Maybe you can remember, some time ago I reported this problem
> > > with the httpmethod patch I sent and the HTTPS check. Maybe the report
> > > was lost within numbers of emails you receive every day. Sure, this
> > > patch is not the best way to do this. That's why I replaced Net::SSLeay
> > > by LWP (shouldn't have a memory leak anymore) in another patch.
> > 
> > Could you please rediff your change against CVS, and send it here
> > again? Appologies, but I am not sure what happened to my last copy. But
> > I am certainly very enthusiastic of anything that leads to not using
> > Net::SSLeay.
> 
> Alan has just announced that he wants last minute changes for 2.0.0 in now.
> With this in mind, I'd like to go with the fix you have above. Bernhard,
> can you test this, I will do the same.

Attached is a redifed version of the above, that should apply aggainst
the current CVS. I checked and it seems to work fine for me. 

-- 
Horms
-------------- next part --------------
Index: ldirectord
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v
retrieving revision 1.108
diff -u -r1.108 ldirectord
--- ldirectord	28 Jun 2005 10:44:53 -0000	1.108
+++ ldirectord	5 Jul 2005 04:04:37 -0000
@@ -1897,7 +1897,7 @@
 		$port=(defined $$v{checkport}?$$v{checkport}:$$r{port})
 	}
 	my $virtualhost = (defined $$v{virtualhost} ? $$v{virtualhost} : $host);
-	my ($page, $errors, $cert, $head, $body, $response, $result);
+	my ($page, $errors, $cert, $head, $body, $response);
 	my $msg = "$$v{httpmethod}" . " $uri HTTP/1.0" . $CRLF
 	        . "Host: " . $virtualhost . $CRLF
 		. "Accept: */*" . $CRLF . $CRLF;
@@ -1918,10 +1918,10 @@
 		($response, $head) = split /\s?\n/, $head, 2;
 		&ld_debug(2, "Result: $response");
 		my $recstr = $$r{receive};
-		if($result =~ /error/i ||
+		if( !($response =~ /20[0-9]/) ||
 				($recstr =~ /.+/ && !($body =~ /$recstr/))) {
 			alarm(0);
-			die("$result");
+			die("$response");
 		}
 	};
 


More information about the Linux-HA mailing list