Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0c75bd00

Von Moritz Bunkus vor etwa 17 Jahren hinzugefügt

  • ID 0c75bd00cf14a04c9e750c58f289d8688cb579cc
  • Vorgänger dc3cd296
  • Nachfolger 7b2d21f4

Das Erzeugen der HTTP-Antwort in eine eigene Funktion ausgelagert, damit sie auch von anderer Stelle aus benutzt werden kann.

Unterschiede anzeigen:

SL/Form.pm
$main::lxdebug->leave_sub();
}
sub create_http_response {
$main::lxdebug->enter_sub();
my $self = shift;
my %params = @_;
my $cgi = $main::cgi;
$cgi ||= CGI->new('');
my $base_path;
if ($ENV{HTTP_X_FORWARDED_FOR}) {
$base_path = $ENV{HTTP_REFERER};
$base_path =~ s|^.*?://.*?/|/|;
} else {
$base_path = $ENV{REQUEST_URI};
}
$base_path =~ s|[^/]+$||;
$base_path =~ s|/$||;
my $session_cookie;
if (defined $main::auth) {
my $session_cookie_value = $main::auth->get_session_id();
$session_cookie_value ||= 'NO_SESSION';
$session_cookie = $cgi->cookie('-name' => $main::auth->get_session_cookie_name(),
'-value' => $session_cookie_value,
'-path' => $base_path);
}
my %cgi_params = ('-type' => $params{type});
$cgi_params{'-charset'} = $params{charset} if ($parmas{charset});
my $output = $cgi->header('-cookie' => $session_cookie,
%cgi_params);
$main::lxdebug->leave_sub();
return $output;
}
sub header {
$main::lxdebug->enter_sub();
......
return;
}
my $cgi = $main::cgi;
$cgi ||= CGI->new('');
my ($stylesheet, $favicon);
if ($ENV{HTTP_USER_AGENT}) {
......
$ajax .= $item->show_javascript();
}
my $base_path;
if ($ENV{HTTP_X_FORWARDED_FOR}) {
$base_path = $ENV{HTTP_REFERER};
$base_path =~ s|^.*?://.*?/|/|;
} else {
$base_path = $ENV{REQUEST_URI};
}
$base_path =~ s|[^/]+$||;
$base_path =~ s|/$||;
my $session_cookie;
if (defined $main::auth) {
my $session_cookie_value = $main::auth->get_session_id();
$session_cookie_value ||= 'NO_SESSION';
$session_cookie = $cgi->cookie('-name' => $main::auth->get_session_cookie_name(),
'-value' => $session_cookie_value,
'-path' => $base_path);
}
print $cgi->header('-type' => 'text/html',
'-charset' => $db_charset,
'-cookie' => $session_cookie);
print $self->create_http_response('type' => 'text/html',
'charset' => $db_charset,);
print qq|${doctype}<html>
<head>
<title>$self->{titlebar}</title>

Auch abrufbar als: Unified diff