diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 60880eaf6..07399bdd9 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,7 @@ - fixed #11915: Date macro returns hour value w/ leading space - fixed #11901: NotifyAboutVersionTag includes URL, even when inappropriate - fixed #11902: forums bug + - fixed #11912: Corrupt cookie causes server 500 errors 7.10.2 - fixed #11884: Editing Templates impossible / Code editor not loaded diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index 4d6476214..fe6cf96c6 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -28,6 +28,7 @@ use Apache2::RequestUtil (); use Apache2::ServerUtil (); use APR::Request::Apache2; use MIME::Base64 (); +use Scalar::Util qw/blessed/; use WebGUI::Config; use WebGUI::Pluggable; use WebGUI::Session; @@ -94,7 +95,13 @@ sub authen { } $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 my $sessionId = $cookies->{$config->getCookieName}; diff --git a/lib/WebGUI/Session/Http.pm b/lib/WebGUI/Session/Http.pm index 8cad25b1f..c82e707ff 100644 --- a/lib/WebGUI/Session/Http.pm +++ b/lib/WebGUI/Session/Http.pm @@ -17,7 +17,7 @@ package WebGUI::Session::Http; use strict; use WebGUI::Utility; -use Scalar::Util qw( weaken ); +use Scalar::Util qw( weaken blessed ); =head1 NAME @@ -95,8 +95,11 @@ sub getCookies { 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) 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; + if (blessed $@ and $@->isa('APR::Request::Error')) { + return $@->jar; + } return {}; } else {