Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ikedas committed Jun 18, 2023
1 parent 57f1ef3 commit 20cae4c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
16 changes: 9 additions & 7 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -1808,18 +1808,20 @@ Sympa::Spool::Listmaster->instance->flush(purge => 1);
## Write to log
sub wwslog {
my $facility = shift;
my $msg = shift;
my $msg = shift;

my $remote = $ENV{'REMOTE_HOST'} || $ENV{'REMOTE_ADDR'};
my $bot = $session->{'is_a_crawler'} || undef if $session;

my $wwsmsg = join ' ',
grep {defined} (
"[robot $robot]",
($session and "[session $session->{'id_session'}]"),
($remote and "[client $remote]"),
($session->{'is_a_crawler'} and "[bot]"),
($rss and "[rss]"),
($param->{'user'}{'email'} and "[user $param->{'user'}{'email'}]"),
($param->{'list'} and "[list $param->{'list'}]")
($session and "[session $session->{'id_session'}]"),
($remote and "[client $remote]"),
($bot and "[bot <$bot>]"),
($rss and "[rss]"),
($param->{'user'}{'email'} and "[user $param->{'user'}{'email'}]"),
($param->{'list'} and "[list $param->{'list'}]")
);

push @_, $wwsmsg;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Sympa/WWW/Crawlers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use strict;
use warnings;

use constant crawler => qr{
(?:
(
Googlebot\/
| Googlebot-Mobile
| Googlebot-Image
Expand Down
11 changes: 5 additions & 6 deletions src/lib/Sympa/WWW/Session.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,10 @@ sub new {

# passive_session are session not stored in the database, they are used
# for crawler bots and action such as css, wsdl, ajax and rss
if (_is_a_crawler($robot)) {
$self->{'is_a_crawler'} = 1;
$self->{'passive_session'} = 1;
}
$self->{'is_a_crawler'} = _is_a_crawler($robot);
$self->{'passive_session'} = 1
if $rss
if $self->{'is_a_crawler'}
or $rss
or $action and ($action eq 'wsdl' or $action eq 'css');

# if a session cookie exist, try to restore an existing session, don't
Expand Down Expand Up @@ -650,7 +648,8 @@ sub _is_a_crawler {

my $ua = $ENV{'HTTP_USER_AGENT'};
return undef unless defined $ua;
return ($ua =~ $crawler_re);
return undef unless $ua =~ $crawler_re;
return $1 || '?';
}

sub confirm_action {
Expand Down
2 changes: 1 addition & 1 deletion support/make_crawlers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ package Sympa::WWW::Crawlers;
use warnings;
use constant crawler => qr{
(?:
(
%s
)
}x;
Expand Down

0 comments on commit 20cae4c

Please sign in to comment.