From b292372949a557be927a7958a4d6a4702270c022 Mon Sep 17 00:00:00 2001 From: hibari Date: Tue, 11 Sep 2012 20:00:44 +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. --- CHANGES | 1 + l7directord/l7directord | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 4745a528..481302f9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ [Sep. 8 2012] 3.1.0-1 HIBARI Michiro - Add "session_thread_pool_size" option for l7vsadm and l7directord. - Change spec file. Make devel package. + - Fixed bug: Evaluated the header section with the body section in HTTP negotiate check. [Aug. 30 2012] 3.0.4-2 Hiroaki Nakano - Fixed LogLevel at #29144 patch. diff --git a/l7directord/l7directord b/l7directord/l7directord index 2a0db446..8b1ff5d9 100644 --- a/l7directord/l7directord +++ b/l7directord/l7directord @@ -2405,14 +2405,15 @@ sub check_http { $status_line = $res->status_line; $status_line =~ s/[\r\n]//g; + my $response = $v->{httpmethod} eq "HEAD" ? $res->as_string : $res->content; 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->as_string !~ /$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, "Headers " . $res->headers->as_string); + ld_debug(3, "HTTP Response " . $response); ld_debug(2, "check_http: $r->{url} is down\n"); return $SERVICE_DOWN; } -- 2.11.0