Skip to content
Browse files

Updated to reflect changes in Plack::Request API

  • Loading branch information...
1 parent 88a060e commit eb24698bb5653f44fa1e865effc71eca8fe3d87e @patspam patspam committed
Showing with 13 additions and 32 deletions.
  1. +1 −1 lib/WebGUI.pm
  2. +10 −12 lib/WebGUI/Session/Http.pm
  3. +2 −19 lib/WebGUI/Session/Plack.pm
View
2 lib/WebGUI.pm
@@ -165,7 +165,7 @@ sub handler {
my ($server, $config);
if ($request->isa('WebGUI::Session::Plack')) {
$server = $request->server;
- $config = WebGUI->config;
+ $config = WebGUI->config; # use our cached version
} else {
$request = Apache2::Request->new($request);
$server = Apache2::ServerUtil->server; #instantiate the server api
View
22 lib/WebGUI/Session/Http.pm
@@ -93,7 +93,7 @@ sub getCookies {
my $self = shift;
if ($self->session->request) {
if ($self->session->request->isa('WebGUI::Session::Plack')) {
- return $self->session->request->get_request_cookies;
+ return $self->session->request->{request}->cookies;
}
# Have to require this instead of using it otherwise it causes problems for command-line scripts on some platforms (namely Windows)
@@ -389,17 +389,15 @@ sub setCookie {
$ttl = (defined $ttl ? $ttl : '+10y');
if ($self->session->request) {
- if ( $self->session->request->isa('WebGUI::Session::Plack') ) {
- $self->session->request->set_response_cookie(
- $name => {
- value => $value,
- path => '/',
- expires => $ttl ne 'session' ? $ttl : undef,
- domain => $domain,
- }
- );
- return;
- }
+ if ( $self->session->request->isa('WebGUI::Session::Plack') ) {
+ $self->session->request->{response}->cookies->{$name} = {
+ value => $value,
+ path => '/',
+ expires => $ttl ne 'session' ? $ttl : undef,
+ domain => $domain,
+ };
+ }
+ return;
require Apache2::Cookie;
my $cookie = Apache2::Cookie->new($self->session->request,
View
21 lib/WebGUI/Session/Plack.pm
@@ -39,9 +39,9 @@ sub AUTOLOAD {
}
# Emulate/delegate/fake Apache2::* subs
-sub uri { shift->{request}->request_uri(@_) }
+sub uri { shift->{request}->path_info }
sub param { shift->{request}->param(@_) }
-sub params { shift->{request}->params(@_) }
+sub params { shift->{request}->prameters->mixed(@_) }
sub headers_in { shift->{request}->headers(@_) }
sub headers_out { shift->{headers_out} }
sub protocol { shift->{request}->protocol(@_) }
@@ -60,23 +60,6 @@ sub content_type {
$self->{headers_out}->set( 'Content-Type' => $ct );
}
-# These two cookie subs are called from our wG Plack-specific code
-sub get_request_cookies {
-
- # Get the hash of { name => CGI::Simple::Cookie }
- my $cookies = shift->{request}->cookies;
-
- # Convert into { name => value } as expected by wG
- my %c = map { $_->name => $_->value } values %{$cookies};
-
- return \%c;
-}
-
-sub set_response_cookie {
- my ( $self, $name, $val ) = @_;
- $self->{response}->cookies->{$name} = $val;
-}
-
# TODO: I suppose this should do some sort of IO::Handle thing
sub print {
my $self = shift;

0 comments on commit eb24698

Please sign in to comment.
Something went wrong with that request. Please try again.