OSDN Git Service

Fixed bug: Evaluated the header section with the body section in HTTP negotiate check.
authorhibari <l05102@shibaura-it.ac.jp>
Tue, 11 Sep 2012 11:00:44 +0000 (20:00 +0900)
committerhibari <l05102@shibaura-it.ac.jp>
Tue, 11 Sep 2012 11:00:44 +0000 (20:00 +0900)
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
l7directord/l7directord

diff --git a/CHANGES b/CHANGES
index 4745a52..481302f 100644 (file)
--- 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.
index 2a0db44..8b1ff5d 100644 (file)
@@ -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;
         }