OSDN Git Service

HTTP::Response->as_string returns all http messages which include all HTTP header... l7directord-negotiate-check-fix
authorKohei TANUMA <tanuma@users.sourceforge.jp>
Mon, 7 Jun 2010 17:03:28 +0000 (02:03 +0900)
committerKohei TANUMA <tanuma@users.sourceforge.jp>
Mon, 7 Jun 2010 17:03:28 +0000 (02:03 +0900)
If HTTP method is 'HEAD', server will send only HTTP header and never send HTTP content.
If HTTP method is 'GET', server will send both HTTP header and HTTP content.
So, use HTTP::Response->as_string when HTTP method is 'HEAD', and use HTTP::Response->content when HTTP method is 'GET'.

l7directord/l7directord

index f986823..518ec5e 100755 (executable)
@@ -2124,15 +2124,7 @@ 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 $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);