From ed2ca6ba240ed06e07e603e8646c7b1d8d106792 Mon Sep 17 00:00:00 2001 From: Shinya TAKEBAYASHI Date: Wed, 7 Oct 2009 11:48:19 +0900 Subject: [PATCH] Fixed bug: Evaluated the header section with the body section in HTTP negotiate check. Normally, evaluates only the body section in GET check. But l7directord was evaluates with body section and header section. This problem was fixed, l7directord become the following operation. * In the case of "httpmethod = HEAD": Evaluates only the header(Includes HTTP response code) section. * In the case of "httpmethod = GET": Evaluates only the body section. --- l7directord/l7directord | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/l7directord/l7directord b/l7directord/l7directord index f628f24..f986823 100755 --- a/l7directord/l7directord +++ b/l7directord/l7directord @@ -2124,12 +2124,21 @@ sub check_http { my $status_line = $res->status_line; $status_line =~ s/[\r\n]//g; + my $response = ""; + my ($res_head, $res_body) = split /\n\n/, $res->as_string, 2; + if ($v->{httpmethod} eq "HEAD") { + $response = $res_head; + } + else { + $response = $res_body; + } + my $recstr = $r->{receive}; if (!$res->is_success) { ld_log( _message( 'WRN1102', $status_line, $r->{server}{ip}, $port ) ) if (!defined $status || $status eq $SERVICE_UP); return $SERVICE_DOWN; } - elsif (defined $recstr && $res->content !~ /$recstr/) { + elsif (defined $recstr && $response !~ /$recstr/) { ld_log( _message( 'WRN1103', $recstr, $r->{server}{ip}, $port ) ) if (!defined $status || $status eq $SERVICE_UP); ld_debug(3, "HTTP Response " . $res->headers->as_string); ld_debug(2, "check_http: $r->{url} is down\n"); -- 2.11.0