Getting cookies can croak. Eval the fetching of cookies and do error handling. Fixes bug #11912.
This commit is contained in:
parent
b02aee50d8
commit
aabb9ed214
3 changed files with 14 additions and 3 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
- fixed #11915: Date macro returns hour value w/ leading space
|
- fixed #11915: Date macro returns hour value w/ leading space
|
||||||
- fixed #11901: NotifyAboutVersionTag includes URL, even when inappropriate
|
- fixed #11901: NotifyAboutVersionTag includes URL, even when inappropriate
|
||||||
- fixed #11902: forums bug
|
- fixed #11902: forums bug
|
||||||
|
- fixed #11912: Corrupt cookie causes server 500 errors
|
||||||
|
|
||||||
7.10.2
|
7.10.2
|
||||||
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
- fixed #11884: Editing Templates impossible / Code editor not loaded
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ use Apache2::RequestUtil ();
|
||||||
use Apache2::ServerUtil ();
|
use Apache2::ServerUtil ();
|
||||||
use APR::Request::Apache2;
|
use APR::Request::Apache2;
|
||||||
use MIME::Base64 ();
|
use MIME::Base64 ();
|
||||||
|
use Scalar::Util qw/blessed/;
|
||||||
use WebGUI::Config;
|
use WebGUI::Config;
|
||||||
use WebGUI::Pluggable;
|
use WebGUI::Pluggable;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
|
|
@ -94,7 +95,13 @@ sub authen {
|
||||||
}
|
}
|
||||||
|
|
||||||
$config ||= WebGUI::Config->new($server->dir_config('WebguiRoot'),$request->dir_config('WebguiConfig'));
|
$config ||= WebGUI::Config->new($server->dir_config('WebguiRoot'),$request->dir_config('WebguiConfig'));
|
||||||
my $cookies = APR::Request::Apache2->handle($request)->jar();
|
my $cookies = eval { APR::Request::Apache2->handle($request)->jar(); };
|
||||||
|
if (blessed $@ && $@->isa('APR::Request::Error')) {
|
||||||
|
$cookies = $@->jar;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$cookies = {};
|
||||||
|
}
|
||||||
|
|
||||||
# determine session id
|
# determine session id
|
||||||
my $sessionId = $cookies->{$config->getCookieName};
|
my $sessionId = $cookies->{$config->getCookieName};
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ package WebGUI::Session::Http;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
use Scalar::Util qw( weaken );
|
use Scalar::Util qw( weaken blessed );
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
|
@ -95,8 +95,11 @@ sub getCookies {
|
||||||
if ($self->session->request) {
|
if ($self->session->request) {
|
||||||
# Have to require this instead of using it otherwise it causes problems for command-line scripts on some platforms (namely Windows)
|
# Have to require this instead of using it otherwise it causes problems for command-line scripts on some platforms (namely Windows)
|
||||||
require APR::Request::Apache2;
|
require APR::Request::Apache2;
|
||||||
my $jarHashRef = APR::Request::Apache2->handle($self->session->request)->jar();
|
my $jarHashRef = eval { APR::Request::Apache2->handle($self->session->request)->jar(); };
|
||||||
return $jarHashRef if $jarHashRef;
|
return $jarHashRef if $jarHashRef;
|
||||||
|
if (blessed $@ and $@->isa('APR::Request::Error')) {
|
||||||
|
return $@->jar;
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue