mirror of
https://github.com/webmin/webmin.git
synced 2026-03-30 05:50:24 +01:00
Compare commits
1 Commits
2.630
...
dev/no-log
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c5470e3fc |
20
miniserv.pl
20
miniserv.pl
@@ -3351,6 +3351,16 @@ sub reset_byte_count { $write_data_count = 0; }
|
||||
# byte_count()
|
||||
sub byte_count { return $write_data_count; }
|
||||
|
||||
# get_module()
|
||||
# Returns module name from SCRIPT_NAME
|
||||
sub get_module
|
||||
{
|
||||
my $sn = $ENV{'SCRIPT_NAME'} || "";
|
||||
$sn =~ s/^\Q$config{'webprefix'}\E\//\//
|
||||
if (!$config{'webprefixnoredir'} && $config{'webprefix'});
|
||||
return $sn =~ /^\/([^\/]+)\// ? ( $1 ) : ();
|
||||
}
|
||||
|
||||
# log_request(hostname, user, request, code, bytes)
|
||||
# Write an HTTP request to the log file
|
||||
sub log_request
|
||||
@@ -3368,6 +3378,16 @@ if ($config{'nolog'}) {
|
||||
return if ($request_nolog =~ /^$nolog$/);
|
||||
}
|
||||
}
|
||||
my $mod = &get_module();
|
||||
if ($mod) {
|
||||
my $pkg = $mod;
|
||||
$pkg =~ s/[^A-Za-z0-9]/_/g;
|
||||
my $func = $pkg."::no_log";
|
||||
my @patterns = defined(&{$func}) ? eval { &{$func}() } : ();
|
||||
foreach my $nolog (@patterns) {
|
||||
return if ($request_nolog =~ /^$nolog$/);
|
||||
}
|
||||
}
|
||||
if ($config{'log'}) {
|
||||
local $ident = "-";
|
||||
$user ||= "-";
|
||||
|
||||
@@ -112,6 +112,20 @@ if (!defined($gconfig{'noselfwebminup'})) {
|
||||
&has_repos();
|
||||
}
|
||||
|
||||
=head2 no_log
|
||||
|
||||
Returns request regexes that should be excluded from miniserv request logging.
|
||||
|
||||
=cut
|
||||
sub no_log
|
||||
{
|
||||
my $prefix = $gconfig{'webprefixnoredir'} ? "" :
|
||||
($gconfig{'webprefix'} || "");
|
||||
$prefix =~ s/\/+$//;
|
||||
$prefix = quotemeta($prefix);
|
||||
return ( $prefix."/webmin/qr\\.cgi.*" );
|
||||
}
|
||||
|
||||
=head2 has_repos
|
||||
|
||||
Checks if package manager repositories are
|
||||
|
||||
Reference in New Issue
Block a user