Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
4c1e9158
Commit
4c1e9158
authored
Mar 10, 2020
by
IKEDA Soji
Browse files
Adding debug log for CGI variables, and tests.
parent
3761cb68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
4c1e9158
...
...
@@ -31,6 +31,7 @@ check_SCRIPTS = \
t/Language.t
\
t/LockedFile.t
\
t/Regexps.t
\
t/WWW_Tools.t
\
t/compile_modules.t
\
t/compile_executables.t
\
t/compile_scenarios.t
\
...
...
src/cgi/wwsympa.fcgi.in
View file @
4c1e9158
...
...
@@ -1107,6 +1107,15 @@ while ($query = Sympa::WWW::FastCGI->new) {
## Though I don't know why, __DIE__ handler is cleared after INIT.
Sympa::Crash::register_handler();
foreach my $envvar (
qw(ORIG_PATH_INFO ORIG_SCRIPT_NAME
PATH_INFO QUERY_STRING REMOTE_ADDR REMOTE_HOST REQUEST_METHOD
SCRIPT_NAME SERVER_NAME SERVER_PORT
SYMPA_DOMAIN)
) {
$log->syslog('debug', '%s=%s', $envvar, $ENV{$envvar});
}
## Get params in a hash
%in = $query->Vars;
...
...
@@ -1940,8 +1949,6 @@ sub _crash_handler {
sub _split_params {
my $args_string = shift;
$log->syslog('debug', "PATH_INFO: %s", $ENV{'PATH_INFO'});
$args_string =~ s+^/++;
my $ending_slash = 0;
...
...
src/lib/Sympa/WWW/FastCGI.pm
View file @
4c1e9158
...
...
@@ -42,6 +42,8 @@ sub new {
# N.B. As of 6.2.34, wwsympa_url parameter may be optional.
my
@vars
=
Sympa::WWW::Tools::
get_robot
('
http_host
',
'
wwsympa_url
');
if
(
@vars
)
{
@ENV
{
qw(ORIG_SCRIPT_NAME ORIG_PATH_INFO)
}
=
@ENV
{
qw(SCRIPT_NAME PATH_INFO)
};
@ENV
{
qw(SYMPA_DOMAIN SCRIPT_NAME PATH_INFO)
}
=
@vars
;
}
else
{
delete
$ENV
{
SYMPA_DOMAIN
};
...
...
t/WWW_Tools.t
0 → 100644
View file @
4c1e9158
# -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4
use
strict
;
use
warnings
;
use
English
qw(-no_match_vars)
;
use
File::
Path
qw(make_path rmtree)
;
use
Test::
More
;
BEGIN
{
use_ok
'
Sympa::WWW::Tools
';
}
# get_robot()
%
Conf::
Conf
=
(
domain
=>
'
mail.example.org
',
listmaster
=>
'
listmaster@example.org
',
wwsympa_url
=>
'
http://web.example.org/sym/pa
',
etc
=>
'
t/tmp/etc
',
);
make_path
$
Conf::
Conf
{'
etc
'}
or
die
$ERRNO
;
$ENV
{
SERVER_NAME
}
=
'
web.example.org
';
$ENV
{
SCRIPT_NAME
}
=
'
/sym/pa
';
$ENV
{
PATH_INFO
}
=
undef
;
is_deeply
[
Sympa::WWW::Tools::
get_robot
('
wwsympa_url
')],
['
mail.example.org
',
'
/sym/pa
',
''],
'
SCRIPT_NAME & empty PATH_INFO
';
$ENV
{
SERVER_NAME
}
=
'
web.example.org
';
$ENV
{
SCRIPT_NAME
}
=
'
/sym/pa
';
$ENV
{
PATH_INFO
}
=
'
/help
';
is_deeply
[
Sympa::WWW::Tools::
get_robot
('
wwsympa_url
')],
['
mail.example.org
',
'
/sym/pa
',
'
/help
'],
'
SCRIPT_NAME & non-empty PATH_INFO
';
$ENV
{
SERVER_NAME
}
=
'
web.example.org
';
$ENV
{
SCRIPT_NAME
}
=
'
/sym
';
$ENV
{
PATH_INFO
}
=
'
/pa/help
';
is_deeply
[
Sympa::WWW::Tools::
get_robot
('
wwsympa_url
')],
['
mail.example.org
',
'
/sym/pa
',
'
/help
'],
'
split script-path (e.g. mod_proxy_fcgi on httpd)
';
$ENV
{
SERVER_NAME
}
=
'
web.example.org
';
$ENV
{
SCRIPT_NAME
}
=
'
/sym/pa/help
';
$ENV
{
PATH_INFO
}
=
undef
;
is_deeply
[
Sympa::WWW::Tools::
get_robot
('
wwsympa_url
')],
['
mail.example.org
',
'
/sym/pa
',
'
/help
'],
'
no PATH_INFO (e.g. nginx without fastcgi_split_path_info)
';
done_testing
();
rmtree
'
t/tmp
';
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment