# Add custom healthcheck.
# (checktype=custom, customcheck=exec_command)
# - 2009/02/14 NTT COMWARE
+# 3.0.0-1: Add code related to l7vsd v3.0.0. See below.
+# - Add accesslog option.
+# - Add tproxy option.
+# 3.0.4-1: Change module check rule. Allow module name
+# [a-z]+.
+# 3.1.0-1: Add code related to l7vsd v3.1.0. See below.
+# - Add session_thread_pool_size option.
+#
use 5.006;
use strict;
use Socket6;
# current version
-our $VERSION = '3.0.0-0';
-our $COPYRIGHT = 'Copyright (C) 2010 NTT COMWARE CORPORATION;
+our $VERSION = '3.1.0-1';
+our $COPYRIGHT = 'Copyright (C) 2012 NTT COMWARE CORPORATION';
# default global config values
our %GLOBAL = (
accesslog_rotate_max_filesize => undef,
accesslog_rotate_rotation_timing => undef,
accesslog_rotate_rotation_timing_value => undef,
+ session_thread_pool_size => undef,
other_virtual_key => undef,
# can override
checkcount => undef,
}
}
elsif ($name eq 'scheduler') {
- my $valid_scheduler = qr{lc|rr|wrr};
- $value = lc $value;
- if (!defined $value || $value !~ /^(?:$valid_scheduler)$/) {
+ if ( $value =~ /[^a-z]/ ) {
config_error($line, 'ERR0105', $config);
}
}
}
}
elsif ($name eq 'module') {
- ## V3 Un-offering (url,pfileter).
- my %key_option = ( url => ['--pattern-match', '--uri-pattern-match', '--host-pattern-match'],
- sessionless => [],
- ip => [],
- sslid => [],
- );
my $module = undef;
my $option = undef;
- my $key = q{};
+ my $key = q{};
if (defined $value) {
- $value =~ s/["']//g;
($module, $option) = split /\s+/, $value, 2;
}
- $module = lc $module;
- if ( !defined $module || !exists $key_option{$module} ) {
+ if ( $module =~ /[^a-z]/ ) {
config_error($line, 'ERR0111', $config);
}
- for my $key_opt ( @{$key_option{$module}} ) {
- if (defined $option && $option =~ /$key_opt\s+(\S+)/) {
- $key .= q{ } if $key;
- $key .= $key_opt . q{ } . $1;
- }
- }
- if ( !$key && @{$key_option{$module}} ) {
- # when omit cookie module key option
- my $key_opt = join q{' or `}, @{$key_option{$module}};
- config_error($line, 'ERR0112', $module, $key_opt, $config);
- }
$value = {name => $module, option => $option, key => $key};
}
elsif ($name eq 'sorryserver') {
}
elsif ($name eq 'accesslog_rotate_rotation_timing_value') {
my $check = undef;
- $value =~ s/["']//g;
if (!defined $value ) {
config_error($line, 'ERR0129', $config);
}
config_error($line, 'ERR0129', $config);
}
}
+ elsif ($name eq 'session_thread_pool_size') {
+ if (!defined $value || $value !~ /^\d+$/ || $value == 0 ) {
+ config_error($line, 'ERR0101', $config);
+ }
+ }
}
return ($name, $value);
if ( $option_key_flag == 0 ) {
$v->{other_virtual_key} .= ' none';
}
+ if ( defined $v->{session_thread_pool_size} ) {
+ $v->{option}{flags} .= ' --session-thread-pool-size ' . $v->{session_thread_pool_size};
+ }
}
if ( !defined $v->{fallback} && defined $CONFIG{fallback} ) {
my $service_status = &$health_check_func($v, $r);
if ($service_status == $SERVICE_DOWN) {
+ undef $r->{num_connects};
if (!defined $current_status || $current_status == $SERVICE_UP) {
$r->{fail_counts}++;
- undef $r->{num_connects};
if ($r->{fail_counts} >= $v->{checkcount}) {
ld_log( _message( 'ERR0602', get_ip_port($r) ) );
service_set($v_r_list, 'down');
$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;
}
ERR0103 => "Invalid value (set any word) `%s'.",
ERR0104 => "Invalid value (set `custom', `connect', `negotiate', `ping', `off', `on' "
. "or positive number) `%s'.",
- ERR0105 => "Invalid value (set `lc', `rr' or `wrr') `%s'.",
+ ERR0105 => "Invalid schedule module (should be only lowercase letters (a-z)) `%s'.",
ERR0106 => "Invalid value (set `http', `https', `ftp', `smtp', `pop', `imap', "
. "`ldap', `nntp', `dns', `mysql', `pgsql', `sip', or `none') `%s'.",
ERR0107 => "Invalid value (forwarding mode must be `masq' or `tproxy') `%s'.",
ERR0108 => "Invalid port number `%s'.",
ERR0109 => "Invalid protocol (protocol must be `tcp') `%s'.",
ERR0110 => "Invalid HTTP method (set `GET' or `HEAD') `%s'.",
- ERR0111 => "Invalid module (set `url', `pfilter', `ip', `sslid' or `sessionless') `%s'.",
- # ERR0111 => "Invalid module (set `cinsert', `cpassive', `crewrite', `url', `pfilter', `ip', `sslid' or `sessionless') `%s'.",
+ ERR0111 => "Invalid protocol module (should be only lowercase letters (a-z)) `%s'.",
ERR0112 => "Invalid module key option (`%s' module must set `%s' option) `%s'.",
ERR0113 => "Invalid QoS value (set 0 or 1-999[KMG]. must specify unit(KMG)) `%s'.",
ERR0114 => "Invalid address `%s'.",
string starts with I<http://...> the IP-address and port of the real server
is overridden, otherwise the IP-address and port of the real server is used.
-=item B<module => I<proto-module module-args [opt-module-args]>
+=item B<module => I<proto-module [opt-module-args]>
Indicates the module parameter of B<l7directord>. Here B<proto-module>
-denotes the protocol module name (For example, pfilter). B<module-args> denotes the
-arguments for the protocol module (For example, --pattern-match '*.html*').
-B<module-args> is optional only when set B<sessionless>, B<ip> and B<sslid> module to B<proto-module>.
-The last argument is optional (For example, --reschedule).
+denotes the protocol module name (For example, sessionless).
+The last argument B<opt-module-args> is optional (For example, --reschedule).
=back
=back
+=item B<session_thread_pool_size = >I<n>
+
+Defines the size each of session_thread_pool_size.
+Default is session_thread_pool_size parameter at l7vs.cf.
+
=back