Commit 04bbdbc2 authored by Dietmar Maurer's avatar Dietmar Maurer

disable debug messages in REST.pm by default

parent f5d9dc49
...@@ -34,15 +34,8 @@ my $max_requests = 500; # max requests per worker ...@@ -34,15 +34,8 @@ my $max_requests = 500; # max requests per worker
my $child_terminate = 0; my $child_terminate = 0;
my $child_reload_config = 0; my $child_reload_config = 0;
my $debug_enabled; sub enable_debug { PVE::REST::enable_debug(); }
sub enable_debug { sub debug_msg { PVE::REST::debug_msg(@_); }
$debug_enabled = 1;
}
sub debug_msg {
return if !$debug_enabled;
syslog('info', @_);
}
sub worker_finished { sub worker_finished {
my $cpid = shift; my $cpid = shift;
......
...@@ -28,6 +28,16 @@ my $baseuri = "/api2"; ...@@ -28,6 +28,16 @@ my $baseuri = "/api2";
# http://perl.apache.org/docs/2.0/api/Apache2/SubProcess.html # http://perl.apache.org/docs/2.0/api/Apache2/SubProcess.html
my $debug_enabled;
sub enable_debug {
$debug_enabled = 1;
}
sub debug_msg {
return if !$debug_enabled;
syslog('info', @_);
}
sub extract_auth_cookie { sub extract_auth_cookie {
my ($cookie) = @_; my ($cookie) = @_;
...@@ -181,7 +191,7 @@ sub create_http_request { ...@@ -181,7 +191,7 @@ sub create_http_request {
sub proxy_handler { sub proxy_handler {
my($r, $clientip, $host, $method, $abs_uri, $ticket, $token, $params) = @_; my($r, $clientip, $host, $method, $abs_uri, $ticket, $token, $params) = @_;
syslog('info', "proxy start $method $host:$abs_uri"); debug_msg("proxy start $method $host:$abs_uri");
my $ua = LWP::UserAgent->new( my $ua = LWP::UserAgent->new(
protocols_allowed => [ 'http', 'https' ], protocols_allowed => [ 'http', 'https' ],
...@@ -243,7 +253,7 @@ sub proxy_handler { ...@@ -243,7 +253,7 @@ sub proxy_handler {
$r->headers_out()->add('Content-Length' , length($raw)); $r->headers_out()->add('Content-Length' , length($raw));
$r->print($raw); $r->print($raw);
syslog('info', "proxy end $method $host:$abs_uri ($code)"); debug_msg("proxy end $method $host:$abs_uri ($code)");
return OK; return OK;
} }
...@@ -433,7 +443,7 @@ my $known_methods = { ...@@ -433,7 +443,7 @@ my $known_methods = {
sub handler { sub handler {
my($r) = @_; my($r) = @_;
#syslog('info', "perl handler called"); debug_msg("perl handler called");
my $method = $r->method; my $method = $r->method;
my $clientip = $r->connection->remote_ip(); my $clientip = $r->connection->remote_ip();
...@@ -492,7 +502,7 @@ sub handler { ...@@ -492,7 +502,7 @@ sub handler {
$r->headers_out()->add('Content-Length', length($raw)); $r->headers_out()->add('Content-Length', length($raw));
$r->print($raw); $r->print($raw);
#syslog('info', "perl handler end $res->{status}"); debug_msg("perl handler end $res->{status}");
return OK; return OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment