[Jifty-commit] jifty branch, plack, created. b6ffecc72d1976e0dfaa272d19cfeff32d60f4c3
Jifty commits
jifty-commit at lists.jifty.org
Sun Jan 10 08:36:28 EST 2010
The branch, plack has been created
at b6ffecc72d1976e0dfaa272d19cfeff32d60f4c3 (commit)
- Log -----------------------------------------------------------------
commit bb29cd69a6fda73a1089ad4fe1dfaece8997e103
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Aug 14 14:43:58 2009 -0400
Checkpoint
diff --git a/lib/Jifty/Continuation.pm b/lib/Jifty/Continuation.pm
index 44309fb..9cbce3b 100644
--- a/lib/Jifty/Continuation.pm
+++ b/lib/Jifty/Continuation.pm
@@ -63,6 +63,7 @@ use base qw/Class::Accessor::Fast Jifty::Object/;
__PACKAGE__->mk_accessors(qw(id parent
request response code
+ version
));
=head2 new PARAMHASH
@@ -112,7 +113,8 @@ sub new {
request => Jifty::Request->new(),
response => Jifty::Response->new(),
code => undef,
- @_
+ @_,
+ version => 2,
);
# We don't want refs
@@ -129,6 +131,11 @@ sub new {
my $key = Jifty->web->serial . "_" . int(rand(10)) . int(rand(10)) . int(rand(10)) . int(rand(10)) . int(rand(10)) . int(rand(10));
$self->id($key);
+ # Make sure we don't store any of the connection information
+ local $self->request->{env}{"psgi.input"};
+ local $self->request->{env}{"psgi.errors"};
+ local $self->request->{_body_parser}{input_handle} if defined $self->request->{_body_parser};
+
# Save it into the session
Jifty->web->session->set_continuation($key => $self);
@@ -145,7 +152,7 @@ to ask "are we about to call a continuation?"
sub return_path_matches {
my $self = shift;
- my $called_uri = $ENV{'REQUEST_URI'};
+ my $called_uri = Jifty->web->request->uri;
my $request_path = $self->request->path;
# XXX TODO: WE should be using URI canonicalization
@@ -242,7 +249,12 @@ sub return {
if $self->code;
# Set the current request to the one in the continuation
- return Jifty->web->request($self->request->clone);
+ my $input = Jifty->web->request->env->{"psgi.input"};
+ my $errors = Jifty->web->request->env->{"psgi.errors"};
+ Jifty->web->request($self->request->clone);
+ Jifty->web->request->env->{"psgi.input"} = $input;
+ Jifty->web->request->env->{"psgi.errors"} = $errors;
+ return Jifty->web->request;
}
=head2 delete
diff --git a/lib/Jifty/Dispatcher.pm b/lib/Jifty/Dispatcher.pm
index e6e874a..9f16427 100644
--- a/lib/Jifty/Dispatcher.pm
+++ b/lib/Jifty/Dispatcher.pm
@@ -757,14 +757,7 @@ sub _do_abort {
$self->log->debug("Aborting processing");
if (@_) {
# This is the status code
- my $status = shift;
- my $apache = Jifty->handler->apache;
- $apache->header_out(Status => $status);
- Jifty->handler->send_http_header;
-
- # The body should just be the status
- require HTTP::Status;
- print STDOUT $status, ' ' , HTTP::Status::status_message($status);
+ Jifty->web->response->status( shift );
}
$self->_abort;
}
@@ -866,13 +859,6 @@ sub _do_dispatch {
$self->_handle_stage('RUN' => 'show');
}
- # Close the handle down, so the client can go on their merry way
- unless (Jifty->web->request->is_subrequest) {
- Jifty->handler->buffer->flush_output;
- close(STDOUT);
- $Jifty::SERVER->close_client_sockets if $Jifty::SERVER;
- }
-
# Cleanup
$self->_handle_stage('CLEANUP');
@@ -960,7 +946,7 @@ came in with that method.
sub _match_method {
my ( $self, $method ) = @_;
#$self->log->debug("Matching method ".request->request_method." against ".$method);
- $Request->request_method eq uc($method);
+ $Request->method eq uc($method);
}
=head2 _match_https
diff --git a/lib/Jifty/Handler.pm b/lib/Jifty/Handler.pm
index 924e487..e2d89d5 100644
--- a/lib/Jifty/Handler.pm
+++ b/lib/Jifty/Handler.pm
@@ -12,10 +12,8 @@ Jifty::Handler - Methods related to the finding and returning content
use Jifty;
Jifty->new();
- my $handler = Jifty::Handler->handle_request( cgi => $cgi );
-
- # after each request is handled
- Jifty::Handler->cleanup_request;
+ my $handler = Jifty::Handler->new;
+ $handler->handle_request( request => HTTP::Engine::Request->new(...) );
=head1 DESCRIPTION
@@ -30,27 +28,7 @@ use Jifty::View::Declare::Handler ();
use Class::Trigger;
use String::BufferStack;
-BEGIN {
- # Creating a new CGI object breaks FastCGI in all sorts of painful
- # ways. So wrap the call and preempt it if we already have one
- use CGI ();
-
- # If this file gets reloaded using Module::Refresh, don't do this
- # magic again, or we'll get infinite recursion
- unless (CGI->can('__jifty_real_new')) {
- *CGI::__jifty_real_new = \&CGI::new;
-
- no warnings qw(redefine);
- *CGI::new = sub {
- return Jifty->handler->cgi if Jifty->handler->cgi;
- CGI::__jifty_real_new(@_);
- }
- }
-};
-
-
-
-__PACKAGE__->mk_accessors(qw(dispatcher _view_handlers cgi apache stash buffer));
+__PACKAGE__->mk_accessors(qw(dispatcher _view_handlers stash buffer));
=head2 new
@@ -133,44 +111,22 @@ sub view {
return $self->_view_handlers->{$class};
}
-=head2 cgi
-
-Returns the L<CGI> object for the current request, or C<undef> if
-there is none.
-
-=head2 apache
-
-Returns the L<HTML::Mason::FakeApache> or L<Apache> object for the
-current request, ot C<undef> if there is none.
-
=head2 handle_request
When your server processs (be it Jifty-internal, FastCGI or anything
else) wants to handle a request coming in from the outside world, you
should call C<handle_request>.
-=over
-
-=item cgi
-
-A L<CGI> object that your server has already set up and loaded with
-your request's data.
-
-=back
-
=cut
-
sub handle_request {
my $self = shift;
- my %args = (
- cgi => undef,
- @_
- );
+ my $req = Plack::Request->new(shift);
+ my $response;
$self->setup_view_handlers() unless $self->_view_handlers;
- $self->call_trigger('before_request', $args{cgi});
+ $self->call_trigger('before_request', $req);
# this is scoped deeper because we want to make sure everything is cleaned
# up for the LeakDetector plugin. I tried putting the triggers in the
@@ -187,17 +143,15 @@ sub handle_request {
Jifty::I18N->refresh;
}
- $self->cgi( $args{cgi} );
- $self->apache( HTML::Mason::FakeApache->new( cgi => $self->cgi ) );
-
- Jifty->web->request( Jifty::Request->new()->fill( $self->cgi ) );
+ Jifty->web->request( Jifty::Request->promote( $req ) );
Jifty->web->response( Jifty::Response->new );
+ Jifty->web->response->status(200);
Jifty->api->reset;
for ( Jifty->plugins ) {
$_->new_request;
}
- $self->log->info( Jifty->web->request->request_method . " request for " . Jifty->web->request->path );
+ $self->log->info( Jifty->web->request->method . " request for " . Jifty->web->request->path );
Jifty->web->setup_session;
Jifty::I18N->get_language_handle;
@@ -209,30 +163,14 @@ sub handle_request {
$self->buffer->flush_output;
}
- $self->call_trigger('before_cleanup', $args{cgi});
+ $self->call_trigger('before_cleanup', $req);
$self->cleanup_request();
+ $response = Jifty->web->response;
}
- $self->call_trigger('after_request', $args{cgi});
-}
-
-=head2 send_http_header
-
-Sends any relevent HTTP headers, by calling
-L<HTML::Mason::FakeApache/send_http_header>. If this is running
-inside a standalone server, also sends the HTTP status header first.
-
-Returns false if the header has already been sent.
-
-=cut
-
-sub send_http_header {
- my $self = shift;
- return if $self->apache->http_header_sent;
- $Jifty::SERVER->send_http_status if $Jifty::SERVER;
- $self->apache->send_http_header;
- return 1;
+ $self->call_trigger('after_request', $req);
+ return $response->finalize;
}
=head2 cleanup_request
@@ -250,8 +188,6 @@ sub cleanup_request {
Jifty->web->session->unload();
Jifty::Record->flush_cache if Jifty::Record->can('flush_cache');
- $self->cgi(undef);
- $self->apache(undef);
$self->stash(undef);
$self->buffer->pop for 1 .. $self->buffer->depth;
$self->buffer->clear;
diff --git a/lib/Jifty/Manual/Cookbook.pod b/lib/Jifty/Manual/Cookbook.pod
index c6de50b..fd2d48b 100644
--- a/lib/Jifty/Manual/Cookbook.pod
+++ b/lib/Jifty/Manual/Cookbook.pod
@@ -457,7 +457,7 @@ In a C<Template::Declare> view, do something like this:
# ...
# create dynamic $image, for example using Chart::Clicker
- Jifty->handler->apache->content_type('image/png');
+ Jifty->web->response->content_type('image/png');
Jifty->web->out($image);
};
diff --git a/lib/Jifty/Plugin/CompressedCSSandJS.pm b/lib/Jifty/Plugin/CompressedCSSandJS.pm
index aafcb69..6b28edc 100644
--- a/lib/Jifty/Plugin/CompressedCSSandJS.pm
+++ b/lib/Jifty/Plugin/CompressedCSSandJS.pm
@@ -244,9 +244,9 @@ sub _serve_cas_object {
my ($self, $name, $incoming_key) = @_;
my $key = Jifty::CAS->key('ccjs', $name);
- if ( Jifty->handler->cgi->http('If-Modified-Since') and $incoming_key eq $key ) {
+ if ( Jifty->web->request->header('If-Modified-Since') and $incoming_key eq $key ) {
$self->log->debug("Returning 304 for cached $name");
- Jifty->handler->apache->header_out( Status => 304 );
+ Jifty->web->response->status( 304 );
return;
}
@@ -255,16 +255,15 @@ sub _serve_cas_object {
$compression = 'gzip' if $obj->metadata->{deflate}
&& Jifty::View::Static::Handler->client_accepts_gzipped_content;
- Jifty->handler->apache->content_type($obj->metadata->{content_type});
+ Jifty->web->response->content_type($obj->metadata->{content_type});
Jifty::View::Static::Handler->send_http_header($compression, length($obj->content));
if ( $compression ) {
$self->log->debug("Sending gzipped squished $name");
- binmode STDOUT;
- print $obj->content_deflated;
+ Jifty->web->out($obj->content_deflated);
} else {
$self->log->debug("Sending squished $name");
- print $obj->content;
+ Jifty->web->out($obj->content);
}
}
diff --git a/lib/Jifty/Plugin/ErrorTemplates/View.pm b/lib/Jifty/Plugin/ErrorTemplates/View.pm
index 5c9b934..3f5feae 100644
--- a/lib/Jifty/Plugin/ErrorTemplates/View.pm
+++ b/lib/Jifty/Plugin/ErrorTemplates/View.pm
@@ -2,7 +2,6 @@ package Jifty::Plugin::ErrorTemplates::View;
use strict;
use warnings;
-use vars qw( $r );
use Jifty::View::Declare -base;
@@ -81,7 +80,7 @@ caused by the Jifty app's wrapper, for instance.
template '__jifty/error/error.css' => sub {
- Jifty->handler->apache->content_type("text/css");
+ Jifty->web->response->content_type("text/css");
h1 {
outs('color: red');
};
@@ -112,7 +111,7 @@ sub maybe_page (&;$) {
template '/errors/404' => sub {
my $file = get('path') || Jifty->web->request->path;
Jifty->log->error( "404: user tried to get to " . $file );
- Jifty->handler->apache->header_out( Status => '404' )
+ Jifty->web->response->status( 404 )
unless Jifty->web->request->is_subrequest;
maybe_page { title => _("Something's not quite right") } content {
with( id => "overview" ), div {
diff --git a/lib/Jifty/Plugin/I18N.pm b/lib/Jifty/Plugin/I18N.pm
index c09a39a..0320561 100644
--- a/lib/Jifty/Plugin/I18N.pm
+++ b/lib/Jifty/Plugin/I18N.pm
@@ -82,9 +82,6 @@ sub _i18n_js {
unless ( $current_lang =~ /^$allowed_regex/) {
$self->log->error("user is requesting $current_lang which is not allowed");
- my $headers = Jifty->handler->apache->headers_in;
- use Data::Dumper;
- $self->log->error(Dumper($headers));
}
}
diff --git a/lib/Jifty/Plugin/REST/Dispatcher.pm b/lib/Jifty/Plugin/REST/Dispatcher.pm
index cecc1f4..0f270a1 100644
--- a/lib/Jifty/Plugin/REST/Dispatcher.pm
+++ b/lib/Jifty/Plugin/REST/Dispatcher.pm
@@ -58,11 +58,8 @@ Shows basic help about resources and formats available via this RESTian interfac
=cut
sub show_help {
- my $apache = Jifty->handler->apache;
+ Jifty->web->response->content_type('text/plain; charset=utf-8');
- $apache->header_out('Content-Type' => 'text/plain; charset=UTF-8');
- Jifty->handler->send_http_header;
-
print qq{
Accessing resources:
@@ -115,10 +112,7 @@ sub show_help_specific {
my $method = "show_help_specific_$topic";
__PACKAGE__->can($method) or abort(404);
- my $apache = Jifty->handler->apache;
-
- $apache->header_out('Content-Type' => 'text/plain; charset=UTF-8');
- Jifty->handler->send_http_header;
+ Jifty->web->response->content_type('text/plain; charset=utf-8');
print __PACKAGE__->$method;
last_rule;
@@ -284,12 +278,9 @@ renders the content as yaml, json, javascript, perl, xml or html.
sub outs {
my $prefix = shift;
- my $apache = Jifty->handler->apache;
-
my $format = output_format($prefix);
- $apache->header_out('Content-Type' => $format->{content_type});
- Jifty->handler->send_http_header;
+ Jifty->web->response->content_type($format->{content_type});
print $format->{freezer}->(@_);
last_rule;
@@ -821,31 +812,7 @@ sub _dispatch_to_action {
if defined $rec->id;
}
- # CGI.pm doesn't handle form encoded data in PUT requests, so we have
- # to read the request body from PUTDATA and have CGI.pm parse it
- if ( Jifty->web->request->request_method eq 'PUT'
- and ( $ENV{'CONTENT_TYPE'} =~ m|^application/x-www-form-urlencoded$|
- or $ENV{'CONTENT_TYPE'} =~ m|^multipart/form-data$| ) )
- {
- my $cgi = Jifty->handler->cgi;
- my $length = defined $ENV{'CONTENT_LENGTH'} ? $ENV{'CONTENT_LENGTH'} : 0;
- my $data = $cgi->param('PUTDATA');
-
- if ( defined $data ) {
- my @params = $cgi->all_parameters;
- $cgi->parse_params( $data );
- push @params, $cgi->all_parameters;
-
- my %seen;
- my @uniq = map { $seen{$_}++ == 0 ? $_ : () } @params;
-
- # Add only the newly parsed arguments to the Jifty::Request
- Jifty->web->request->argument( $_ => $cgi->param( $_ ) )
- for @uniq;
- }
- }
-
- Jifty->web->request->request_method('POST');
+ Jifty->web->request->method('POST');
dispatch "/=/action/$action";
}
@@ -979,7 +946,8 @@ sub run_action {
my $url = Jifty->web->url(path => $path);
- Jifty->handler->apache->header_out('Location' => $url);
+ Jifty->web->response->status( 302 );
+ Jifty->web->response->header('Location' => $url);
}
outs(undef, $action->result->as_hash);
diff --git a/lib/Jifty/Plugin/SkeletonApp/View.pm b/lib/Jifty/Plugin/SkeletonApp/View.pm
index 6824f43..ce839e0 100644
--- a/lib/Jifty/Plugin/SkeletonApp/View.pm
+++ b/lib/Jifty/Plugin/SkeletonApp/View.pm
@@ -2,7 +2,6 @@ package Jifty::Plugin::SkeletonApp::View;
use strict;
use warnings;
-use vars qw( $r );
use Jifty::View::Declare -base;
@@ -48,7 +47,7 @@ template '__jifty/empty' => sub :Static {
private template 'header' => sub {
my ($title) = get_current_attr(qw(title));
- Jifty->handler->apache->content_type('text/html; charset=utf-8');
+ Jifty->web->response->content_type('text/html; charset=utf-8');
head {
with(
'http-equiv' => "content-type",
diff --git a/lib/Jifty/Plugin/TestServerWarnings/View.pm b/lib/Jifty/Plugin/TestServerWarnings/View.pm
index 69ff727..c9c1f9e 100644
--- a/lib/Jifty/Plugin/TestServerWarnings/View.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings/View.pm
@@ -19,7 +19,7 @@ client.
template "/__jifty/test_warnings" => sub {
my $plugin = Jifty->find_plugin('Jifty::Plugin::TestServerWarnings');
- Jifty->handler->apache->content_type("application/x-perl");
+ Jifty->web->response->content_type("application/x-perl");
outs_raw($plugin->encoded_warnings);
};
diff --git a/lib/Jifty/Plugin/ViewDeclarePage/Page.pm b/lib/Jifty/Plugin/ViewDeclarePage/Page.pm
index fa8dbc7..dd3b788 100644
--- a/lib/Jifty/Plugin/ViewDeclarePage/Page.pm
+++ b/lib/Jifty/Plugin/ViewDeclarePage/Page.pm
@@ -272,7 +272,7 @@ sub render_header {
$self->render_doctype;
head {
- Jifty->handler->apache->content_type('text/html; charset=utf-8');
+ Jifty->web->response->content_type('text/html; charset=utf-8');
with(
'http-equiv' => "content-type",
content => "text/html; charset=utf-8"
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index 89af7d8..49ae763 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -3,8 +3,17 @@ use strict;
package Jifty::Request;
-use base qw/Jifty::Object Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw(_top_request arguments template_arguments just_validating path continuation_id future_continuation_id continuation_type continuation_path request_method));
+use Any::Moose;
+extends 'Plack::Request', 'Jifty::Object';
+
+has '_top_request' => (is => 'rw');
+has 'arguments' => (is => 'rw');
+has 'template_arguments' => (is => 'rw');
+has 'just_validating' => (is => 'rw');
+has 'continuation_id' => (is => 'rw');
+has 'future_continuation_id' => (is => 'rw');
+has 'continuation_type' => (is => 'rw');
+has 'continuation_path' => (is => 'rw');
use Jifty::JSON;
use Jifty::YAML;
@@ -64,7 +73,7 @@ independent fragments. See L<Jifty::Web::PageRegion>.
=head1 METHODS
-=head2 new PARAMHASH
+=head2 BUILD PARAMHASH
Creates a new request object. For each key in the I<PARAMHASH>, the
method of that name is called, with the I<PARAMHASH>'s value as its
@@ -72,23 +81,20 @@ sole argument.
=cut
-sub new {
- my $class = shift;
- my $self = bless {}, $class;
+sub BUILD {
+ my $self = shift;
+
+ # Copy a bunch of information off of the top Plack request
+ my $env = Jifty->web->request->top_request->env;
+ $self->{env}{$_} = $env->{$_} for qw/psgi.version psgi.multithread psgi.multiprocess psgi.errors/;
+ # Stub in an empty input filehandle
+ $self->{env}{"psgi.input"} = Plack::Util::inline_object( read => sub {0} );
$self->{'actions'} = {};
$self->{'state_variables'} = {};
$self->{'fragments'} = {};
$self->arguments({});
$self->template_arguments({});
- $self->request_method("GET");
-
- my %args = @_;
- for (keys %args) {
- $self->$_($args{$_}) if $self->can($_);
- }
-
- return $self;
}
=head2 clone
@@ -103,39 +109,47 @@ sub clone {
# "Semi-shallow" clone
return bless({map {
my $val = $self->{$_};
- $_ => (ref($val) ? { %$val } : $val);
+ $_ => (ref($val) eq "HASH" ? { %$val } : ref($val) eq "ARRAY" ? [ @$val ] : $val);
} keys %$self}, ref($self));
}
-=head2 fill
+=head2 promote
Attempt to fill in the request from any number of various methods --
-YAML, JSON, etc. Falls back to query parameters. Takes a CGI object.
+YAML, JSON, etc. Falls back to query parameters. Takes a
+L<HTTP::Engine::Request> object.
=cut
-sub fill {
- my $self = shift;
- my ($cgi) = @_;
+sub promote {
+ my $class = shift;
+ my ($req) = @_;
- # Store away request method
- $self->request_method( uc $cgi->request_method );
+ die Carp::longmess("old calling style") unless ref $req;
+
+ # Import all props from HTTP::Engine::Request object
+ my $self = bless $req, $class;
+ $self->{'actions'} = {};
+ $self->{'state_variables'} = {};
+ $self->{'fragments'} = {};
+ $self->arguments({});
+ $self->template_arguments({});
# Grab content type and posted data, if any
- my $ct = $ENV{"CONTENT_TYPE"};
- my $data = $cgi->param('POSTDATA');
+ my $ct = $req->content_type;
+ my $data = $req->raw_body;
# Check it for something appropriate
if ($data) {
if ($ct =~ m{^text/x-json}) {
- return $self->from_data_structure(eval{Jifty::JSON::jsonToObj($data)}, $cgi);
+ return $self->from_data_structure(eval{Jifty::JSON::jsonToObj($data)});
} elsif ($ct =~ m{^text/x-yaml}) {
- return $self->from_data_structure(eval{Jifty::YAML::Load($data)}, $cgi);
+ return $self->from_data_structure(eval{Jifty::YAML::Load($data)});
}
}
- # Fall back on using the mason args
- return $self->from_cgi($cgi);
+ # Fall back on using the straight HTTP arguments
+ return $self->from_args;
}
=head2 from_data_structure
@@ -151,21 +165,11 @@ Returns itself.
sub from_data_structure {
my $self = shift;
my $data = shift;
- my $cgi;
- $cgi = shift if (@_);
my $path = $data->{'path'};
-
- if ($cgi && ! $path) {
- $path = $cgi->path_info;
- $path =~ s/\?.*//;
- };
-
- if (!$path) {
- $path = '/';
- }
+ $path ||= $self->path || '/';
- $self->path( Jifty::Util->canonicalize_path( $path));
+ $self->path( Jifty::Util->canonicalize_path( $path ) );
$self->just_validating( $data->{validating} ) if $data->{validating};
if ( ref $data->{continuation} eq "HASH" ) {
@@ -188,10 +192,7 @@ sub from_data_structure {
for my $arg ( keys %{ $a->{fields} || {} } ) {
if ( ref $a->{fields}{$arg} ) {
- # Double-fallback exists for historical reasons only;
- # Jifty applications after July 10th, 2006 should
- # never generate them.
- for my $type (qw/doublefallback fallback value/) {
+ for my $type (qw/fallback value/) {
$arguments{$arg} = $a->{fields}{$arg}{$type}
if exists $a->{fields}{$arg}{$type};
}
@@ -244,34 +245,27 @@ sub from_data_structure {
return $self;
}
-=head2 from_cgi CGI
+=head2 from_args REQ
-Calls C<from_webform> with the CGI's parameters, after doing Mason
-parameter mapping, and splitting C<|>'s in argument names. See
-L</argument munging>.
+Calls C<from_webform> with the L<HTTP::Engine::Request/parameters>
+after splitting C<|>'s in argument names. See L</argument munging>.
Returns itself.
=cut
-sub from_cgi {
+sub from_args {
my $self = shift;
- my ($cgi) = @_;
- my $path = $cgi->path_info;
- $path =~ s/\?.*//;
- $self->path( $path );
-
- use HTML::Mason::Utils;
- my %args = HTML::Mason::Utils::cgi_request_args( $cgi, $cgi->request_method );
+ my %args = %{ $self->parameters };
# Either CGI.pm or HTML::Mason should really deal with encoding for us.
for my $k (keys %args) {
my $val = $args{$k};
if(ref($val) && ref($val) eq 'ARRAY') {
- $args{$k} = [map {Jifty::I18N->promote_encoding($_, $ENV{CONTENT_TYPE})} @$val];
+ $args{$k} = [map {Jifty::I18N->promote_encoding($_, $self->content_type)} @$val];
} elsif(!ref($val)) {
- $args{$k} = Jifty::I18N->promote_encoding($val, $ENV{CONTENT_TYPE});
+ $args{$k} = Jifty::I18N->promote_encoding($val, $self->content_type);
}
if (ref($val) eq 'Fh') {
@@ -286,8 +280,6 @@ sub from_cgi {
# If your key has a '=', you may just lose
my ($k, $v) = split /=/, $newarg, 2;
$args{$k} = $v;
- # The following breaks page regions and the like, sadly:
- #$args{$k} ? (ref $args{$k} ? [@{$args{$k}},$v] : [$args{$k}, $v] ) : $v;
}
}
return $self->from_webform( %args );
@@ -505,9 +497,7 @@ sub webform_to_data_structure {
# Mapping from argument types to data structure names;
- # Double-fallback exists for historical reasons only; Jifty
- # applications after July 10th, 2006 should never generate them.
- my %types = ("J:A:F:F:F" => "doublefallback", "J:A:F:F" => "fallback", "J:A:F" => "value");
+ my %types = ("J:A:F:F" => "fallback", "J:A:F" => "value");
# The "sort" here is key; it ensures that action registrations
# come before action arguments
@@ -965,9 +955,20 @@ sub top_request {
return $self->_top_request || $self;
}
+no Any::Moose;
+__PACKAGE__->meta->make_immutable;
+
+
package Jifty::Request::Action;
-use base 'Class::Accessor::Fast';
-__PACKAGE__->mk_accessors( qw/moniker arguments class order active modified has_run/);
+use Any::Moose;
+
+has 'moniker';
+has 'arguments';
+has 'class';
+has 'order';
+has 'active';
+has 'modified';
+has 'has_run';
=head2 Jifty::Request::Action
@@ -1010,9 +1011,18 @@ sub delete {
}
+no Any::Moose;
+__PACKAGE__->meta->make_immutable;
+
+
package Jifty::Request::StateVariable;
-use base 'Class::Accessor::Fast';
-__PACKAGE__->mk_accessors (qw/key value/);
+use Any::Moose;
+
+has 'key';
+has 'value';
+
+no Any::Moose;
+__PACKAGE__->meta->make_immutable;
=head2 Jifty::Request::StateVariable
@@ -1025,8 +1035,17 @@ A small package that encapsulates the bits of a state variable:
=cut
package Jifty::Request::Fragment;
-use base 'Class::Accessor::Fast';
-__PACKAGE__->mk_accessors( qw/name path wrapper in_form arguments parent/ );
+use Any::Moose;
+
+has 'name';
+has 'path';
+has 'wrapper';
+has 'in_form';
+has 'arguments';
+has 'parent';
+
+no Any::Moose;
+__PACKAGE__->meta->make_immutable;
=head2 Jifty::Request::Fragment
diff --git a/lib/Jifty/Response.pm b/lib/Jifty/Response.pm
index 6caca4b..e9966b1 100644
--- a/lib/Jifty/Response.pm
+++ b/lib/Jifty/Response.pm
@@ -15,51 +15,10 @@ L<Jifty::Result> objects of each L<Jifty::Action> that ran.
=cut
-use base qw/Jifty::Object Class::Accessor::Fast/;
+use Any::Moose;
+extends 'Plack::Response';
-__PACKAGE__->mk_accessors(qw(error));
-
-=head2 new
-
-Creates a new L<Jifty::Response> object.
-
-=cut
-
-sub new {
- my $class = shift;
- bless {results => {}, headers => []}, $class;
-}
-
-
-=head2 add_header KEY => VALUE
-
-Add an HTTP header to the outgoing HTTP response.
-
-=cut
-
-
-sub add_header {
- my $self = shift;
- Jifty->handler->apache->header_out( @_ ) if Jifty->handler->apache;
-
- # This one is so we can get jifty's headers into mason
- # Otherwise we'd have to wrap mason's output layer
-
- push @{$self->{headers}}, [@_];
-}
-
-=head2 headers
-
-Returns an array of key-value pairs of all the HTTP headers we want to
-stick on the outgoing HTTP request.
-
-
-=cut
-
-sub headers {
- my $self = shift;
- return @{$self->{headers}};
-}
+has 'error' => (is => 'rw');
=head2 result MONIKER [RESULT]
@@ -83,7 +42,7 @@ Returns a hash which maps moniker to its L<Jifty::Result>
sub results {
my $self = shift;
- return %{$self->{results}};
+ return %{$self->{results} || {}};
}
=head2 messages
@@ -112,7 +71,7 @@ L</error> set.
sub success {
my $self = shift;
- return 0 if grep {$_->failure} values %{$self->{results}};
+ return 0 if grep {$_->failure} values %{$self->{results} || {}};
return 1;
}
@@ -128,4 +87,6 @@ sub failure {
return not $self->success;
}
+no Any::Moose;
+__PACKAGE__->meta->make_immutable();
1;
diff --git a/lib/Jifty/Script/Server.pm b/lib/Jifty/Script/Server.pm
index e603786..dad2d87 100755
--- a/lib/Jifty/Script/Server.pm
+++ b/lib/Jifty/Script/Server.pm
@@ -17,6 +17,7 @@ use Test::Builder ();
BEGIN { $SIG{__DIE__} = $x;}
+use HTTP::Engine;
use File::Path ();
use Jifty::Util;
@@ -170,41 +171,40 @@ sub _run_server {
Jifty->new();
# Purge stale mason cache data
- my $data_dir = Jifty->config->framework('Web')->{'DataDir'};
- my $server_class = Jifty->config->framework('Web')->{'ServerClass'}
- || 'Jifty::Server';
- die "--user option only available with Net::Server subclasses\n"
- if $self->{user} and $server_class eq "Jifty::Server";
- die "--group option only available with Net::Server subclasses\n"
- if $self->{group} and $server_class eq "Jifty::Server";
- die "--host option only available with Net::Server subclasses\n"
- if $self->{host} and $server_class eq "Jifty::Server";
-
- Jifty::Util->require($server_class);
-
+ my $data_dir = Jifty->config->framework('Web')->{'DataDir'};
File::Path::rmtree( [ "$data_dir/cache", "$data_dir/obj" ] )
- if Jifty->handler->view('Jifty::View::Mason::Handler')
- and -d $data_dir;
+ if Jifty->handler->view('Jifty::View::Mason::Handler')
+ and -d $data_dir;
- $SIG{TERM} = sub { exit };
- mkdir PIDDIR or die "Can't create directory @{[PIDDIR]}: $!"
+ $SIG{TERM} = sub {exit};
+ mkdir PIDDIR
+ or die "Can't create directory @{[PIDDIR]}: $!"
if !-d PIDDIR;
- open my $fh, '>', PIDFILE or die "Can't open @{[PIDFILE]} for writing: $!";
+ open my $fh, '>', PIDFILE
+ or die "Can't open @{[PIDFILE]} for writing: $!";
print $fh $$;
close $fh;
Jifty->handle->dbh->{Profile} = '6/DBI::ProfileDumper'
- if $self->{dbiprof};
+ if $self->{dbiprof};
$ENV{JIFTY_SERVER_SIGREADY} ||= $self->{sigready}
- if $self->{sigready};
- Log::Log4perl->get_logger($server_class)->less_logging(3)
- if $self->{quiet};
- $Jifty::SERVER = $server_class->new( port => $self->{port} );
- my @args;
- push @args, $_ => $self->{$_}
- for grep { exists $self->{$_} } qw/user group host/;
- $Jifty::SERVER->run(@args);
+ if $self->{sigready};
+
+ Jifty->config->framework('Web')->{'Port'} = $self->{port} if $self->{port};
+ my $port = Jifty->config->framework('Web')->{'Port'} || 8888;
+
+ my %args = ( port => $port );
+ $args{$_} = $self->{$_} for grep defined $self->{$_}, qw/host user group/;
+
+ $Jifty::SERVER = HTTP::Engine->new(
+ interface => {
+ module => 'Standalone',
+ args => \%args,
+ request_handler => sub { Jifty->handler->handle_request(@_) },
+ },
+ );
+ $Jifty::SERVER->run;
}
sub _stop {
diff --git a/lib/Jifty/Server.pm b/lib/Jifty/Server.pm
index 7615ab8..29f894b 100644
--- a/lib/Jifty/Server.pm
+++ b/lib/Jifty/Server.pm
@@ -54,8 +54,8 @@ Sets up the Jifty singleton. This is called automatically by L</new>.
sub setup_jifty {
my $self = shift;
my %args = (
- port => undef,
- @_
+ port => undef,
+ @_
);
Jifty->config->framework('Web')->{'Port'} = $args{port} if $args{port};
@@ -76,16 +76,6 @@ sub handle_request {
Jifty->handler->handle_request( cgi => $cgi );
}
-=head2 send_http_status
-
-Sends the HTTP status header.
-
-=cut
-
-sub send_http_status {
- print STDOUT "HTTP/1.0 ". (Jifty->handler->apache->{headers_out}->{'Status'} || '200 Jifty OK') . "\n";
-}
-
=head2 print_banner
Overrives L<HTML::Server::Simple::Mason>'s print_banner to use the
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index 1eb037c..38cc1b6 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -2,6 +2,7 @@ use strict;
use warnings;
package Jifty::Test::WWW::Mechanize;
+use WWW::Mechanize::HTTPEngineTest;
use base qw/Test::WWW::Mechanize/;
delete $ENV{'http_proxy'}; # Otherwise Test::WWW::Mechanize tries to go through your HTTP proxy
@@ -40,8 +41,14 @@ sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->cookie_jar(HTTP::Cookies->new);
+ $self->WWW::Mechanize::HTTPEngineTest::http_engine_hook(
+ uri => Jifty->web->url,
+ handler => sub {
+ Jifty->handler->handle_request(@_);
+ },
+ );
return $self;
-}
+}
=head2 moniker_for ACTION, FIELD1 => VALUE1, FIELD2 => VALUE2
diff --git a/lib/Jifty/View.pm b/lib/Jifty/View.pm
index 484dc90..34a3da4 100644
--- a/lib/Jifty/View.pm
+++ b/lib/Jifty/View.pm
@@ -35,24 +35,14 @@ sends a header if need be.
sub out_method {
Jifty->web->session->set_cookie;
- my $r = Jifty->handler->apache;
+ my $r = Jifty->web->response;
# Send a header
$r->content_type || $r->content_type('text/html; charset=utf-8'); # Set up a default
- unless ( $r->http_header_sent or not __PACKAGE__->auto_send_headers ) {
- Jifty->handler->send_http_header;
- }
-
- binmode *STDOUT;
# We now install a new, faster out_method that doesn't have to
# keep checking whether headers have been sent.
- my $content;
- if ( my ($enc) = $r->content_type =~ /charset=([\w-]+)$/ ) {
- $content = sub { print STDOUT map Encode::encode($enc, $_), @_; };
- } else {
- $content = sub { print STDOUT @_; };
- }
+ my $content = sub { Jifty->web->response->{body} .= $_ for @_ };
Jifty->handler->buffer->out_method( $content );
$content->(@_);
}
diff --git a/lib/Jifty/View/Declare/BaseClass.pm b/lib/Jifty/View/Declare/BaseClass.pm
index e3f6158..8469e17 100644
--- a/lib/Jifty/View/Declare/BaseClass.pm
+++ b/lib/Jifty/View/Declare/BaseClass.pm
@@ -45,7 +45,6 @@ sub use_mason_wrapper {
my $req = $interp->make_request( comp => '/_elements/wrapper' );
my $wrapper = $interp->load("/_elements/wrapper");
local $HTML::Mason::Commands::m = $req;
- local $HTML::Mason::Commands::r = Jifty->handler->apache;
$req->comp(
{content => sub {$code->()}},
$wrapper,
diff --git a/lib/Jifty/View/Declare/CoreTemplates.pm b/lib/Jifty/View/Declare/CoreTemplates.pm
index fb8fbb8..dec6de5 100644
--- a/lib/Jifty/View/Declare/CoreTemplates.pm
+++ b/lib/Jifty/View/Declare/CoreTemplates.pm
@@ -39,10 +39,9 @@ These templates are still in masonland. we're doign something wrong with escapin
template '__jifty/subs' => sub {
my ($forever) = get(qw(forever)) || 1;
- Jifty->handler->apache->content_type("text/html; charset=utf-8");
- Jifty->handler->apache->headers_out->{'Pragma'} = 'no-cache';
- Jifty->handler->apache->headers_out->{'Cache-control'} = 'no-cache';
- Jifty->handler->send_http_header;
+ Jifty->web->response->content_type("text/html; charset=utf-8");
+ Jifty->web->response->header('Pragma' => 'no-cache');
+ Jifty->web->response->header('Cache-control' => 'no-cache');
my $writer = XML::Writer->new;
$writer->xmlDecl( "UTF-8", "yes" );
@@ -93,7 +92,7 @@ template '__jifty/autocomplete.xml' => sub {
# Note: the only point to this file is to set the content_type; the actual
# behavior is accomplished inside the framework. It will go away once we
# have infrastructure for serving things of various content-types.
- Jifty->handler->apache->content_type('text/xml; charset=UTF-8');
+ Jifty->web->response->content_type('text/xml; charset=utf-8');
my $ref = Jifty->web->response->result('autocomplete')->content;
my @options = @{ $ref->{'completions'} || [] };
body {
@@ -119,7 +118,7 @@ template '__jifty/autocomplete.xml' => sub {
template '__jifty/validator.xml' => sub {
- Jifty->handler->apache->content_type('text/xml; charset=UTF-8');
+ Jifty->web->response->content_type('text/xml; charset=utf-8');
my $output = "";
use XML::Writer;
my $writer = XML::Writer->new( OUTPUT => \$output );
@@ -310,7 +309,7 @@ template '__jifty/webservices/xml' => sub {
}
$writer->endTag();
- Jifty->handler->apache->content_type('text/xml; charset=UTF-8');
+ Jifty->web->response->content_type('text/xml; charset=utf-8');
# For some reason, this line is needed, lest we end up outputting ISO-8859-1 text
utf8::decode($output);
@@ -344,7 +343,7 @@ template '__jifty/webservices/xml' => sub {
template '__jifty/webservices/yaml' => sub {
- Jifty->handler->apache->content_type("text/x-yaml");
+ Jifty->web->response->content_type("text/x-yaml");
outs( Jifty::YAML::Dump( { Jifty->web->response->results } ) );
};
diff --git a/lib/Jifty/View/Declare/Helpers.pm b/lib/Jifty/View/Declare/Helpers.pm
index f17e99b..6004b1a 100644
--- a/lib/Jifty/View/Declare/Helpers.pm
+++ b/lib/Jifty/View/Declare/Helpers.pm
@@ -100,7 +100,7 @@ sub page (&;$) {
my ( $meta, $code ) = @_;
my $ret = sub {
my $self = shift;
- Jifty->handler->apache->content_type('text/html; charset=utf-8');
+ Jifty->web->response->content_type('text/html; charset=utf-8');
my $wrapper = Jifty->app_class('View')->can('wrapper') || \&wrapper;
my @metadata = $meta ? $meta->($self) : ();
my $metadata = $#metadata == 0 ? $metadata[0] : {@metadata};
diff --git a/lib/Jifty/View/Mason/Handler.pm b/lib/Jifty/View/Mason/Handler.pm
index 8f129c7..1a3fe70 100644
--- a/lib/Jifty/View/Mason/Handler.pm
+++ b/lib/Jifty/View/Mason/Handler.pm
@@ -61,7 +61,6 @@ sub new {
my $self = $package->SUPER::new( request_class => 'Jifty::View::Mason::Request',
out_method => sub {Carp::cluck("Mason output skipped Jifty's output stack!") if grep {defined and length} @_},
%p );
- $self->interp->compiler->add_allowed_globals('$r');
$self->interp->set_escape( h => \&escape_utf8 );
$self->interp->set_escape( u => \&escape_uri );
@@ -213,15 +212,11 @@ sub _comp_setup {
Jifty->web->session->set_cookie;
- # Set up the global
- my $r = Jifty->handler->apache;
- $self->interp->set_global('$r', $r);
-
# XXX FIXME This is a kludge to get use_mason_wrapper to work
$self->interp->set_global('$jifty_internal_request', 0);
$self->interp->set_global('$jifty_internal_request', 1) if defined $args;
- return $args ? %$args : $self->request_args($r);
+ return $args ? %$args : $self->request_args;
}
sub handle_comp {
diff --git a/lib/Jifty/View/Mason/Request.pm b/lib/Jifty/View/Mason/Request.pm
index 9b3f23b..884d374 100644
--- a/lib/Jifty/View/Mason/Request.pm
+++ b/lib/Jifty/View/Mason/Request.pm
@@ -39,7 +39,6 @@ running the component, and we're supposed to send headers, sends them.
sub exec
{
my $self = shift;
- my $r = Jifty->handler->apache;
my $retval;
eval { $retval = $self->SUPER::exec(@_) };
@@ -51,14 +50,7 @@ sub exec
rethrow_exception $err;
}
- # On a success code, send headers if they have not been sent and
- # if we are the top-level request. Since the out_method sends
- # headers, this will typically only apply after $m->abort.
- if ($self->auto_send_headers
- and not $r->http_header_sent
- and (!$retval or $retval==200)) {
- Jifty->handler->send_http_header;
- }
+ return $retval;
}
=head2 print
diff --git a/lib/Jifty/View/Static/Handler.pm b/lib/Jifty/View/Static/Handler.pm
index 8023737..087977a 100644
--- a/lib/Jifty/View/Static/Handler.pm
+++ b/lib/Jifty/View/Static/Handler.pm
@@ -92,7 +92,7 @@ sub handle_request {
my $local_path = $self->file_path($path) or return undef;
- if ( my $since = Jifty->handler->cgi->http('If-Modified-Since') ) {
+ if ( my $since = Jifty->web->request->header('If-Modified-Since') ) {
my @file_info = stat($local_path);
# IE appends "; length=N" to If-Modified-Since headers and we need
@@ -124,7 +124,7 @@ Returns true if it looks like the client accepts gzip encoding. Otherwise, retur
sub client_accepts_gzipped_content {
my $self = shift;
no warnings 'uninitialized';
- return Jifty->handler->cgi->http('Accept-Encoding') =~ /\bgzip\b/;
+ return Jifty->web->request->header('Accept-Encoding') =~ /\bgzip\b/;
}
@@ -232,8 +232,7 @@ sub send_file {
Jifty->web->mason->clear_buffer if Jifty->web->mason;
my @file_info = stat($local_path);
- my $apache = Jifty->handler->apache;
- $apache->content_type($mime_type);
+ Jifty->web->response->content_type($mime_type);
$self->send_http_header( $compression, $file_info[7], $file_info[9] );
if ( $compression eq 'gzip' ) {
@@ -244,9 +243,8 @@ sub send_file {
print STDOUT Compress::Zlib::memGzip(<$fh>);
}
else {
- $apache->send_fd($fh);
+ Jifty->web->response->content($fh);
}
- close($fh);
return 1;
}
else {
@@ -265,22 +263,20 @@ sub send_http_header {
my $self = shift;
my ($compression, $length, $modified) = @_;
my $now = time();
- my $apache = Jifty->handler->apache;
- $apache->header_out( Status => 200 );
+ my $response = Jifty->web->response;
+ $response->status( 200 );
# Expire in a year
- $apache->header_out( 'Cache-Control' => 'max-age=31536000, public' );
- $apache->header_out( 'Expires' => HTTP::Date::time2str( $now + 31536000 ) );
-
- $apache->header_out(
+ $response->header( 'Cache-Control' => 'max-age=31536000, public' );
+ $response->header( 'Expires' => HTTP::Date::time2str( $now + 31536000 ) );
+
+ $response->header(
'Last-Modified' => HTTP::Date::time2str( $modified ) ) if $modified;
- $apache->header_out( 'Content-Length' => $length )
+ $response->header( 'Content-Length' => $length )
unless ( $compression eq 'gzip' );
- $apache->header_out( 'Content-Encoding' => "gzip" )
+ $response->header( 'Content-Encoding' => "gzip" )
if ( $compression eq 'gzip' );
-
- Jifty->handler->send_http_header;
}
@@ -292,11 +288,9 @@ Sends a "304 Not modified" response to the browser, telling it to use a cached c
sub send_not_modified {
my $self = shift;
- my $apache = Jifty->handler->apache;
- $apache->header_out( Status => 304 );
- Jifty->handler->send_http_header;
+ my $response = Jifty->web->response;
+ $response->status( 304 );
return 1;
-
}
1;
diff --git a/lib/Jifty/Web.pm b/lib/Jifty/Web.pm
index 677dfb2..87dd8a2 100644
--- a/lib/Jifty/Web.pm
+++ b/lib/Jifty/Web.pm
@@ -106,7 +106,7 @@ sub mason {
=head3 out
-Send a string to the browser. The default implementation uses Mason->out;
+Send a string to the browser.
=cut
@@ -365,7 +365,7 @@ sub _validate_request_actions {
. "'" );
$self->log->warn( Jifty->api->explain($request_action->class ) );
# Possible cross-site request forgery
- $self->log->error("Action " . $request_action->class . " has been denied because the request is a GET") if $self->request->request_method eq "GET";
+ $self->log->error("Action " . $request_action->class . " has been denied because the request is a GET") if $self->request->method eq "GET";
push @denied_actions, $request_action;
next;
}
@@ -749,7 +749,7 @@ sub redirect {
# PATH_INFO, which is what $request->path is normally set to.
# We should replicate that here.
$request->path( URI::Escape::uri_unescape( $page->url ) );
- $request->request_method("GET"); # ..effectively.
+ $request->method("GET"); # ..effectively.
$request->continuation($self->request->continuation);
my $cont = Jifty::Continuation->new(
request => $request,
@@ -793,18 +793,16 @@ sub _redirect {
# Clear out the output, if any
Jifty->handler->buffer->clear;
- my $apache = Jifty->handler->apache;
+ my $response = Jifty->web->response;
$self->log->debug("Execing redirect to $page");
# Headers..
- $apache->header_out( Location => $page );
- $apache->header_out( Status => 302 );
+ $response->header( Location => $page );
+ $response->status( 302 );
# cookie has to be sent or returning from continuations breaks
Jifty->web->session->set_cookie;
- Jifty->handler->send_http_header;
-
# Mason abort, or dispatcher abort out of here
$self->mason->abort if $self->mason;
Jifty::Dispatcher::_abort();
diff --git a/lib/Jifty/Web/Form.pm b/lib/Jifty/Web/Form.pm
index 5913301..7a68dec 100644
--- a/lib/Jifty/Web/Form.pm
+++ b/lib/Jifty/Web/Form.pm
@@ -201,7 +201,7 @@ sub start {
}
my $root = $self->submit_to;
- ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/ unless defined $root;
+ ($root) = Jifty->web->request->uri =~ /([^\?]*)/ unless defined $root;
my $form_start = qq!<form method="post" action="! . Jifty->web->escape( $root ) . qq!"!;
$form_start .= qq! name="@{[ $self->name ]}"! if defined $self->name;
$form_start .= qq! target="@{[ $self->target ]}"! if defined $self->target;
diff --git a/lib/Jifty/Web/Form/Clickable.pm b/lib/Jifty/Web/Form/Clickable.pm
index da26031..ef0572a 100644
--- a/lib/Jifty/Web/Form/Clickable.pm
+++ b/lib/Jifty/Web/Form/Clickable.pm
@@ -155,7 +155,7 @@ get an unexpected error from your browser.
sub new {
my $class = shift;
- my ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/;
+ my $root = Jifty->web->request->path;
my %args = (
parameters => {},
@@ -428,7 +428,7 @@ sub post_parameters {
my %parameters
= ( _map( %{ $self->{fallback} || {} } ), $self->parameters );
- my ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/;
+ my $root = Jifty->web->request->request_uri;
# Submit actions should only show up once
my %uniq;
@@ -479,7 +479,7 @@ sub complete_url {
my %parameters = $self->get_parameters;
- my ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/;
+ my ($root) = Jifty->web->request->request_uri;
my $url = $self->returns ? $root : $self->url;
if (%parameters) {
$url .= ( $url =~ /\?/ ) ? ";" : "?";
diff --git a/lib/Jifty/Web/Form/Link.pm b/lib/Jifty/Web/Form/Link.pm
index e4e064c..c0003f3 100644
--- a/lib/Jifty/Web/Form/Link.pm
+++ b/lib/Jifty/Web/Form/Link.pm
@@ -69,7 +69,7 @@ Any parameter which L<Jifty::Web::Form::Element/new> can take.
sub new {
my $class = shift;
my $args = ref($_[0]) ? $_[0] : {@_};
- my ($root) = $ENV{'REQUEST_URI'} =~ /([^\?]*)/;
+ my ($root) = Jifty->web->request->uri =~ /([^\?]*)/;
my $self = $class->SUPER::new(
{ url => $root,
label => "Click me!",
diff --git a/lib/Jifty/Web/Session.pm b/lib/Jifty/Web/Session.pm
index 320d71c..4415f35 100644
--- a/lib/Jifty/Web/Session.pm
+++ b/lib/Jifty/Web/Session.pm
@@ -315,7 +315,7 @@ sub set_cookie {
# never send a cookie with cached content. misbehaving proxies cause
# terrific problems
- return if Jifty->handler->apache->header_out('Expires');
+ return if Jifty->web->response->header('Expires');
my $cookie_name = $self->cookie_name;
my %cookies = CGI::Cookie->fetch();
@@ -325,12 +325,10 @@ sub set_cookie {
-expires => $self->expires,
);
- # XXX TODO might need to change under mod_perl
if ( not $cookies{$cookie_name}
or ( $cookies{$cookie_name} ne $cookie->as_string ) )
{
- Jifty->web->response->add_header(
- 'Set-Cookie' => $cookie->as_string );
+ Jifty->web->response->cookies->{$cookie->name} = $cookie;
}
}
diff --git a/lib/Jifty/Web/Session/ClientSide.pm b/lib/Jifty/Web/Session/ClientSide.pm
index 3a7c873..dc6d986 100644
--- a/lib/Jifty/Web/Session/ClientSide.pm
+++ b/lib/Jifty/Web/Session/ClientSide.pm
@@ -238,9 +238,7 @@ sub flush {
);
foreach my $cookie ($splitter->split( $data_cookie )) {
- Jifty->web->response->add_header(
- 'Set-Cookie' => $cookie->as_string
- );
+ Jifty->web->response->cookies->{$cookie->name} = $cookie;
}
}
diff --git a/share/web/static/css/autohandler b/share/web/static/css/autohandler
index 4ca73a1..afd5b73 100644
--- a/share/web/static/css/autohandler
+++ b/share/web/static/css/autohandler
@@ -1,5 +1,5 @@
<%init>
-$r->content_type('text/css');
+Jifty->web->response->content_type('text/css');
$m->call_next();
return();
</%init>
diff --git a/share/web/templates/=/subs b/share/web/templates/=/subs
index 6f41b43..2860b2d 100644
--- a/share/web/templates/=/subs
+++ b/share/web/templates/=/subs
@@ -3,9 +3,9 @@ $forever => 1
</%args>
<%init>
-$r->content_type("text/html; charset=utf-8");
-$r->headers_out->{'Pragma'} = 'no-cache';
-$r->headers_out->{'Cache-control'} = 'no-cache';
+Jifty->web->response->content_type("text/html; charset=utf-8");
+Jifty->web->response->header('Pragma' => 'no-cache');
+Jifty->web->response->header('Cache-control' => 'no-cache');
Jifty->handler->send_http_header;
my $writer = XML::Writer->new;
diff --git a/share/web/templates/__jifty/autocomplete.xml b/share/web/templates/__jifty/autocomplete.xml
index 2a6aaf2..c60d199 100644
--- a/share/web/templates/__jifty/autocomplete.xml
+++ b/share/web/templates/__jifty/autocomplete.xml
@@ -2,7 +2,7 @@
# Note: the only point to this file is to set the content_type; the actual
# behavior is accomplished inside the framework. It will go away once we
# have infrastructure for serving things of various content-types.
-$r->content_type('text/xml; charset=UTF-8');
+Jifty->web->response->content_type('text/xml; charset=UTF-8');
unless (Jifty->web->response->result('autocomplete')) {
print "<body />";
return;
diff --git a/share/web/templates/__jifty/error/error.css b/share/web/templates/__jifty/error/error.css
index 09a3c41..e59d88a 100644
--- a/share/web/templates/__jifty/error/error.css
+++ b/share/web/templates/__jifty/error/error.css
@@ -3,11 +3,11 @@ h1 {
}
<%init>
-$r->content_type("text/css");
+Jifty->web->response->content_type("text/css");
</%init>
<%doc>
This exists as a fallback CSS, in case the Jifty app's CSS is causing
the error.
-</%doc>
\ No newline at end of file
+</%doc>
diff --git a/share/web/templates/__jifty/validator.xml b/share/web/templates/__jifty/validator.xml
index 6fb4df1..a6eaab2 100644
--- a/share/web/templates/__jifty/validator.xml
+++ b/share/web/templates/__jifty/validator.xml
@@ -1,5 +1,5 @@
<%init>
-$r->content_type('text/xml; charset=UTF-8');
+Jifty->web->response->content_type('text/xml; charset=UTF-8');
my $output = "";
use XML::Writer;
diff --git a/share/web/templates/__jifty/webservices/json b/share/web/templates/__jifty/webservices/json
index bacde46..25fd10d 100644
--- a/share/web/templates/__jifty/webservices/json
+++ b/share/web/templates/__jifty/webservices/json
@@ -1,4 +1,4 @@
-% $r->content_type("text/x-json");
+% Jifty->web->response->content_type("text/x-json");
<% Jifty::JSON::objToJson(\%results) |n%>
<%INIT>
diff --git a/share/web/templates/__jifty/webservices/xml b/share/web/templates/__jifty/webservices/xml
index e4c8d8d..c4b2ae4 100644
--- a/share/web/templates/__jifty/webservices/xml
+++ b/share/web/templates/__jifty/webservices/xml
@@ -1,7 +1,7 @@
<%init>
my $output = "";
my $writer = XML::Writer->new( OUTPUT => \$output, UNSAFE => 1 );
-$r->content_type('text/xml; charset=utf-8');
+Jifty->web->response->content_type('text/xml; charset=utf-8');
$writer->xmlDecl( "UTF-8", "yes" );
$writer->startTag("response");
@@ -100,7 +100,7 @@ for (keys %results) {
}
$writer->endTag();
-Jifty->handler->apache->content_type('text/xml; charset=UTF-8');
+Jifty->web->response->content_type('text/xml; charset=UTF-8');
Jifty->web->out($output);
</%init>
<%once>
diff --git a/share/web/templates/__jifty/webservices/yaml b/share/web/templates/__jifty/webservices/yaml
index aba0115..35fda5a 100644
--- a/share/web/templates/__jifty/webservices/yaml
+++ b/share/web/templates/__jifty/webservices/yaml
@@ -1,4 +1,4 @@
-% $r->content_type("text/x-yaml");
+% Jifty->web->response->content_type("text/x-yaml");
<% Jifty::YAML::Dump(\%results) |n%>
<%INIT>
diff --git a/share/web/templates/_elements/header b/share/web/templates/_elements/header
index b8e97d3..df87efe 100644
--- a/share/web/templates/_elements/header
+++ b/share/web/templates/_elements/header
@@ -13,5 +13,5 @@
$title => ""
</%args>
<%init>
-$r->content_type('text/html; charset=utf-8');
+Jifty->web->response->content_type('text/html; charset=utf-8');
</%init>
commit 16e109bc911a56b2ce6bae560f0ddfa93a35778d
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 19:50:04 2009 +0800
use Plack.
diff --git a/lib/Jifty/Handler.pm b/lib/Jifty/Handler.pm
index e2d89d5..c161a4d 100644
--- a/lib/Jifty/Handler.pm
+++ b/lib/Jifty/Handler.pm
@@ -13,7 +13,7 @@ Jifty::Handler - Methods related to the finding and returning content
Jifty->new();
my $handler = Jifty::Handler->new;
- $handler->handle_request( request => HTTP::Engine::Request->new(...) );
+ $handler->handle_request( $env );
=head1 DESCRIPTION
@@ -120,8 +120,8 @@ should call C<handle_request>.
=cut
sub handle_request {
- my $self = shift;
- my $req = Plack::Request->new(shift);
+ my ($self, $env) = @_;
+ my $req = Plack::Request->new($env);
my $response;
$self->setup_view_handlers() unless $self->_view_handlers;
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index 49ae763..8c9f45b 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -18,6 +18,7 @@ has 'continuation_path' => (is => 'rw');
use Jifty::JSON;
use Jifty::YAML;
use Jifty::Web::FileUpload;
+use Plack::Util ();
=head1 NAME
@@ -117,7 +118,7 @@ sub clone {
Attempt to fill in the request from any number of various methods --
YAML, JSON, etc. Falls back to query parameters. Takes a
-L<HTTP::Engine::Request> object.
+L<Plack::Request> object.
=cut
@@ -127,7 +128,7 @@ sub promote {
die Carp::longmess("old calling style") unless ref $req;
- # Import all props from HTTP::Engine::Request object
+ # Import all props from Plack::Request object
my $self = bless $req, $class;
$self->{'actions'} = {};
$self->{'state_variables'} = {};
@@ -247,7 +248,7 @@ sub from_data_structure {
=head2 from_args REQ
-Calls C<from_webform> with the L<HTTP::Engine::Request/parameters>
+Calls C<from_webform> with the L<Plack::Request/parameters>
after splitting C<|>'s in argument names. See L</argument munging>.
Returns itself.
diff --git a/lib/Jifty/Script/Server.pm b/lib/Jifty/Script/Server.pm
index dad2d87..8b75f25 100755
--- a/lib/Jifty/Script/Server.pm
+++ b/lib/Jifty/Script/Server.pm
@@ -17,7 +17,7 @@ use Test::Builder ();
BEGIN { $SIG{__DIE__} = $x;}
-use HTTP::Engine;
+use Plack::Loader;
use File::Path ();
use Jifty::Util;
@@ -197,14 +197,10 @@ sub _run_server {
my %args = ( port => $port );
$args{$_} = $self->{$_} for grep defined $self->{$_}, qw/host user group/;
- $Jifty::SERVER = HTTP::Engine->new(
- interface => {
- module => 'Standalone',
- args => \%args,
- request_handler => sub { Jifty->handler->handle_request(@_) },
- },
- );
- $Jifty::SERVER->run;
+ my $app = sub { Jifty->handler->handle_request(@_) };
+
+ $Jifty::SERVER = Plack::Loader->load('Standalone', %args);
+ $Jifty::SERVER->run($app);
}
sub _stop {
diff --git a/lib/Jifty/Test.pm b/lib/Jifty/Test.pm
index f6d3417..f16b122 100644
--- a/lib/Jifty/Test.pm
+++ b/lib/Jifty/Test.pm
@@ -471,7 +471,8 @@ sub make_server {
unshift @Jifty::Server::ISA, 'Jifty::TestServer::Apache';
}
else {
- unshift @Jifty::Server::ISA, 'Test::HTTP::Server::Simple';
+ require Jifty::TestServer::Plack;
+ unshift @Jifty::Server::ISA, 'Jifty::TestServer::Plack';
}
my $server = Jifty::Server->new;
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index 38cc1b6..b9ab223 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -2,7 +2,6 @@ use strict;
use warnings;
package Jifty::Test::WWW::Mechanize;
-use WWW::Mechanize::HTTPEngineTest;
use base qw/Test::WWW::Mechanize/;
delete $ENV{'http_proxy'}; # Otherwise Test::WWW::Mechanize tries to go through your HTTP proxy
@@ -15,6 +14,7 @@ use HTTP::Cookies;
use XML::XPath;
use Hook::LexWrap;
use List::Util qw(first);
+use Plack::Test;
use Carp;
# XXX TODO: We're leaving out FLUFF errors because it complains about non-standard
@@ -41,7 +41,7 @@ sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->cookie_jar(HTTP::Cookies->new);
- $self->WWW::Mechanize::HTTPEngineTest::http_engine_hook(
+ $self->_plack_hook(
uri => Jifty->web->url,
handler => sub {
Jifty->handler->handle_request(@_);
@@ -50,6 +50,32 @@ sub new {
return $self;
}
+sub _plack_hook {
+ my $self = shift;
+ my %args = (
+ uri => "http://localhost:8888/",
+ @_
+ );
+
+ die "No handler provided"
+ unless $args{handler};
+
+ my $cb;
+
+ test_psgi
+ app => $args{handler},
+ client => sub {$cb = shift};
+
+ my $for = URI->new( $args{uri} );
+ $self->add_handler(
+ request_send => $cb,
+ m_scheme => $for->scheme,
+ m_host => $for->host,
+ m_port => $for->port,
+ m_path_prefix => $for->path,
+ );
+}
+
=head2 moniker_for ACTION, FIELD1 => VALUE1, FIELD2 => VALUE2
Finds the moniker of the first action of type I<ACTION> whose
commit 0d0a13d8b6aaca6c01f8fd1ae51fd5e485acc882
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 20:12:46 2009 +0800
make sure first constructor of Jifty::Request works.
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index 8c9f45b..6154585 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -86,10 +86,12 @@ sub BUILD {
my $self = shift;
# Copy a bunch of information off of the top Plack request
- my $env = Jifty->web->request->top_request->env;
- $self->{env}{$_} = $env->{$_} for qw/psgi.version psgi.multithread psgi.multiprocess psgi.errors/;
- # Stub in an empty input filehandle
- $self->{env}{"psgi.input"} = Plack::Util::inline_object( read => sub {0} );
+ if ( Jifty->web->request ) {
+ my $env = Jifty->web->request->top_request->env;
+ $self->{env}{$_} = $env->{$_} for qw/psgi.version psgi.multithread psgi.multiprocess psgi.errors/;
+ # Stub in an empty input filehandle
+ $self->{env}{"psgi.input"} = Plack::Util::inline_object( read => sub {0} );
+ }
$self->{'actions'} = {};
$self->{'state_variables'} = {};
commit 6163ffb4c96c8545d47d9bcea0793cbe8d8feff9
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 20:29:31 2009 +0800
Mouse is not happy with Jifty::Request::Action attributes without "is"
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index 6154585..1b86296 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -965,13 +965,13 @@ __PACKAGE__->meta->make_immutable;
package Jifty::Request::Action;
use Any::Moose;
-has 'moniker';
-has 'arguments';
-has 'class';
-has 'order';
-has 'active';
-has 'modified';
-has 'has_run';
+has 'moniker', is => 'rw';
+has 'arguments', is => 'rw';
+has 'class', is => 'rw';
+has 'order', is => 'rw';
+has 'active', is => 'rw';
+has 'modified', is => 'rw';
+has 'has_run', is => 'rw';
=head2 Jifty::Request::Action
@@ -1040,12 +1040,12 @@ A small package that encapsulates the bits of a state variable:
package Jifty::Request::Fragment;
use Any::Moose;
-has 'name';
-has 'path';
-has 'wrapper';
-has 'in_form';
-has 'arguments';
-has 'parent';
+has 'name', is => 'rw';
+has 'path', is => 'rw';
+has 'wrapper', is => 'rw';
+has 'in_form', is => 'rw';
+has 'arguments', is => 'rw';
+has 'parent', is => 'rw';
no Any::Moose;
__PACKAGE__->meta->make_immutable;
commit fb3629d60abd76039e25081fa02f65b579f77cd6
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 20:37:18 2009 +0800
ignore the restart test
diff --git a/t/TestApp-RestartServer/t/restart.t b/t/TestApp-RestartServer/t/restart.t
index deaae3d..7f44a1a 100644
--- a/t/TestApp-RestartServer/t/restart.t
+++ b/t/TestApp-RestartServer/t/restart.t
@@ -10,6 +10,8 @@ use Cwd;
my $cwd;
BEGIN {
+ plan skip_all => "disabled for psgi";
+
plan skip_all => "live test doesn't work on Win32 at the moment" if $^O eq 'MSWin32';
}
commit b3fdcea04c3ae01d7ba09f589c9829d6f91138c9
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 20:42:59 2009 +0800
Must use our mechanize, no private LWP::UserAgent in tests.
diff --git a/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t b/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
index 8cad243..d2afec5 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
@@ -24,16 +24,15 @@ my $mech = Jifty::Test::WWW::Mechanize->new();
$mech->get_ok("$URL/login","Got login page");
-my $ua = LWP::UserAgent->new;
my $res;
-$ua->default_header('Accept-Language' => "en");
-$res = $ua->get("$URL/login");
+$mech->default_header('Accept-Language' => "en");
+$res = $mech->get("$URL/login");
ok $res->is_success, "can access login page";
like $res->content, qr/Lost your password/, 'en works';
-$ua->default_header('Accept-Language' => "fr");
-$res = $ua->get("$URL/login");
+$mech->default_header('Accept-Language' => "fr");
+$res = $mech->get("$URL/login");
ok $res->is_success, "can access login page";
like adjust($res->content), qr/oublié/,'fr login works';
diff --git a/t/TestApp/t/i18n-standalone.t b/t/TestApp/t/i18n-standalone.t
index 760917b..69d4dec 100644
--- a/t/TestApp/t/i18n-standalone.t
+++ b/t/TestApp/t/i18n-standalone.t
@@ -17,47 +17,47 @@ isa_ok($server, 'Jifty::Server');
my $base = URI->new($server->started_ok);
-my $ua = LWP::UserAgent->new;
+my $mech = Jifty::Test::WWW::Mechanize->new;
my $res;
-$ua->default_header('Accept-Language' => "en");
-$res = $ua->get("$base/__jifty/admin/");
+$mech->default_header('Accept-Language' => "en");
+$res = $mech->get("$base/__jifty/admin/");
ok $res->is_success, "can access admin console";
like $res->content, qr/Models/, 'en works';
-$res = $ua->get("$base/concrete.html");
+$res = $mech->get("$base/concrete.html");
ok $res->is_success, "can access concrete";
like $res->content, qr/2 concrete mixers/, 'en works for an unknown string';
-$res = $ua->get("$base/concrete2.html");
+$res = $mech->get("$base/concrete2.html");
ok $res->is_success, "can access concrete";
like $res->content, qr/2 concrete mixers/, 'en works for an unknown string';
-$ua->default_header('Accept-Language' => "ja");
-$res = $ua->get("$base/__jifty/admin/");
+$mech->default_header('Accept-Language' => "ja");
+$res = $mech->get("$base/__jifty/admin/");
ok $res->is_success, "can access admin console";
like adjust($res->content), qr/ã¢ãã«/, 'ja works';
-$res = $ua->get("$base/concrete.html");
+$res = $mech->get("$base/concrete.html");
ok $res->is_success, "can access concrete";
like $res->content, qr/2 concrete mixers/, 'ja works for an unknown string';
-$res = $ua->get("$base/concrete2.html");
+$res = $mech->get("$base/concrete2.html");
ok $res->is_success, "can access concrete";
like $res->content, qr/2 concrete mixers/, 'en works for an unknown string';
-$ua->default_header('Accept-Language' => "fr");
-$res = $ua->get("$base/__jifty/admin/");
+$mech->default_header('Accept-Language' => "fr");
+$res = $mech->get("$base/__jifty/admin/");
ok $res->is_success, "can access admin console";
like adjust($res->content), qr/Modèles/, 'fr locale works';
-$ua->default_header('Accept-Language' => "zh-cn");
-$res = $ua->get("$base/__jifty/admin/");
+$mech->default_header('Accept-Language' => "zh-cn");
+$res = $mech->get("$base/__jifty/admin/");
ok $res->is_success, "can access admin console";
like adjust($res->content), qr/æ°æ®åº/, 'zh-cn works';
-$ua->default_header('Accept-Language' => "zh-tw");
-$res = $ua->get("$base/__jifty/admin/");
+$mech->default_header('Accept-Language' => "zh-tw");
+$res = $mech->get("$base/__jifty/admin/");
ok $res->is_success, "can access admin console";
like adjust($res->content), qr/è³æ庫/, 'zh-tw works';
commit 38da93af8d3071c763066cb1985d43a15e224855
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 20:58:24 2009 +0800
Make TestServerWarnings work when test client and server are in same process.
diff --git a/lib/Jifty/Plugin/TestServerWarnings.pm b/lib/Jifty/Plugin/TestServerWarnings.pm
index 9740e67..bf39182 100644
--- a/lib/Jifty/Plugin/TestServerWarnings.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings.pm
@@ -124,6 +124,11 @@ sub decoded_warnings {
my $self = shift;
my $base = shift;
+ my $Test = Jifty::Test->builder;
+ if ($Test->{Original_Pid} == $$) {
+ return splice @{ $self->{'stashed_warnings'} };
+ }
+
my $uri = URI->new_abs( "/__jifty/test_warnings", $base );
my $text = LWP::Simple::get($uri);
commit 70b5f938078ba28192fe7569ea7a0d8d86108111
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 21:28:21 2009 +0800
Hello, current_user!
diff --git a/Makefile.PL b/Makefile.PL
index 9d49555..f871291 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -12,6 +12,7 @@ requires('Class::Data::Inheritable');
requires('Class::Trigger' => '0.13');
requires('Clone' => '0.27');
requires('CGI' => '3.30');
+requires('CGI::Simple');
requires('CGI::Cookie::Splitter');
requires('Class::Inspector' => 1.20); # For File::ShareDir on Win32
requires('Crypt::CBC');
diff --git a/lib/Jifty/Web/Session.pm b/lib/Jifty/Web/Session.pm
index 4415f35..8ef822e 100644
--- a/lib/Jifty/Web/Session.pm
+++ b/lib/Jifty/Web/Session.pm
@@ -3,7 +3,7 @@ use strict;
package Jifty::Web::Session;
use base qw/Jifty::Object/;
-use CGI::Cookie ();
+use CGI::Simple::Cookie ();
use DateTime ();
use Storable ();
$Storable::Deparse = 1;
@@ -111,10 +111,11 @@ sub load_by_kv {
sub _get_session_id_from_client {
my $self = shift;
- my %cookies = CGI::Cookie->fetch();
+ my %cookies = CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE});
my $cookie_name = $self->cookie_name;
my $session_id
= $cookies{$cookie_name} ? $cookies{$cookie_name}->value() : undef;
+ return $session_id;
}
=head2 unload
@@ -318,8 +319,8 @@ sub set_cookie {
return if Jifty->web->response->header('Expires');
my $cookie_name = $self->cookie_name;
- my %cookies = CGI::Cookie->fetch();
- my $cookie = CGI::Cookie->new(
+ my %cookies = CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE});
+ my $cookie = CGI::Simple::Cookie->new(
-name => $cookie_name,
-value => $self->id,
-expires => $self->expires,
commit c16b559150dd09119fb12c025dbcf9af6acb8572
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 21:31:17 2009 +0800
only parse cookie if there is psgi request.
diff --git a/lib/Jifty/Web/Session.pm b/lib/Jifty/Web/Session.pm
index 8ef822e..c7b0f36 100644
--- a/lib/Jifty/Web/Session.pm
+++ b/lib/Jifty/Web/Session.pm
@@ -111,7 +111,7 @@ sub load_by_kv {
sub _get_session_id_from_client {
my $self = shift;
- my %cookies = CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE});
+ my %cookies = Jifty->web->request ? CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE}) : ();
my $cookie_name = $self->cookie_name;
my $session_id
= $cookies{$cookie_name} ? $cookies{$cookie_name}->value() : undef;
@@ -319,7 +319,8 @@ sub set_cookie {
return if Jifty->web->response->header('Expires');
my $cookie_name = $self->cookie_name;
- my %cookies = CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE});
+ my %cookies = Jifty->web->request ? CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE}) : ();
+
my $cookie = CGI::Simple::Cookie->new(
-name => $cookie_name,
-value => $self->id,
commit bd700dd563ee945a0e2c495f8d7a036e21d18afd
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 1 21:36:52 2009 +0800
Jifty::Request::StateVariable attributes fixup.
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index 1b86296..a5004e7 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -1021,8 +1021,8 @@ __PACKAGE__->meta->make_immutable;
package Jifty::Request::StateVariable;
use Any::Moose;
-has 'key';
-has 'value';
+has 'key', is => 'rw';
+has 'value', is => 'rw';
no Any::Moose;
__PACKAGE__->meta->make_immutable;
commit 8fc42a9816f6acf12446428682b0dc5072c75640
Author: Chia-liang Kao <clkao at clkao.org>
Date: Thu Dec 3 15:26:35 2009 +0800
add testserver::plack
diff --git a/lib/Jifty/TestServer/Plack.pm b/lib/Jifty/TestServer/Plack.pm
new file mode 100644
index 0000000..850a5b1
--- /dev/null
+++ b/lib/Jifty/TestServer/Plack.pm
@@ -0,0 +1,14 @@
+package Jifty::TestServer::Plack;
+use strict;
+use warnings;
+use base 'Test::HTTP::Server::Simple';
+use Test::More;
+
+sub started_ok {
+ my $self = shift;
+ my $port = $self->port;
+ ok(1, "plack test server ok");
+ return "http://localhost:$port";
+}
+
+1;
commit 4f45934da12b8c99e9319a2d6642ce63d3f90abb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Dec 7 17:38:41 2009 -0500
Add tests to ensure that we didn't enter an infinite redirect loop
diff --git a/t/Continuations/t/01-raw-api.t b/t/Continuations/t/01-raw-api.t
index 82b6b7c..1a8ee41 100644
--- a/t/Continuations/t/01-raw-api.t
+++ b/t/Continuations/t/01-raw-api.t
@@ -9,7 +9,7 @@ Continuations tests
=cut
-use Jifty::Test::Dist tests => 47;
+use Jifty::Test::Dist tests => 49;
use_ok('Jifty::Test::WWW::Mechanize');
@@ -67,6 +67,8 @@ ok($mech->continuation->response->result("cross")->failure, "Action's result was
$mech->get("$URL/index-help.html?J:CALL=$first");
like($mech->uri, qr/index.html/, "Back at original page");
unlike($mech->uri, qr/J:CALL=$first/, "With new continuation parameter");
+is($mech->status, 200, "Got back happily");
+$mech->content_like(qr/Get help/, "Has content after redirect");
my $next = $mech->continuation->id;
# Now with return value
commit 9239ded28ff3aac64ac9e881197089f65f40c55a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Dec 7 17:39:09 2009 -0500
->uri is the full uri, including host; we want request_uri
diff --git a/lib/Jifty/Continuation.pm b/lib/Jifty/Continuation.pm
index 9cbce3b..0ffc3d7 100644
--- a/lib/Jifty/Continuation.pm
+++ b/lib/Jifty/Continuation.pm
@@ -152,7 +152,7 @@ to ask "are we about to call a continuation?"
sub return_path_matches {
my $self = shift;
- my $called_uri = Jifty->web->request->uri;
+ my $called_uri = Jifty->web->request->request_uri;
my $request_path = $self->request->path;
# XXX TODO: WE should be using URI canonicalization
commit d8c6565e99af6e126e0821057304796a16314a64
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 01:32:46 2009 -0500
Restore use of request->request_uri, which is _not_ the same as request->uri
diff --git a/lib/Jifty/Web/Form.pm b/lib/Jifty/Web/Form.pm
index 7a68dec..2f2d26c 100644
--- a/lib/Jifty/Web/Form.pm
+++ b/lib/Jifty/Web/Form.pm
@@ -201,7 +201,7 @@ sub start {
}
my $root = $self->submit_to;
- ($root) = Jifty->web->request->uri =~ /([^\?]*)/ unless defined $root;
+ ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/ unless defined $root;
my $form_start = qq!<form method="post" action="! . Jifty->web->escape( $root ) . qq!"!;
$form_start .= qq! name="@{[ $self->name ]}"! if defined $self->name;
$form_start .= qq! target="@{[ $self->target ]}"! if defined $self->target;
diff --git a/lib/Jifty/Web/Form/Clickable.pm b/lib/Jifty/Web/Form/Clickable.pm
index ef0572a..eda8295 100644
--- a/lib/Jifty/Web/Form/Clickable.pm
+++ b/lib/Jifty/Web/Form/Clickable.pm
@@ -155,7 +155,7 @@ get an unexpected error from your browser.
sub new {
my $class = shift;
- my $root = Jifty->web->request->path;
+ my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
my %args = (
parameters => {},
@@ -428,7 +428,7 @@ sub post_parameters {
my %parameters
= ( _map( %{ $self->{fallback} || {} } ), $self->parameters );
- my $root = Jifty->web->request->request_uri;
+ my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
# Submit actions should only show up once
my %uniq;
@@ -479,7 +479,7 @@ sub complete_url {
my %parameters = $self->get_parameters;
- my ($root) = Jifty->web->request->request_uri;
+ my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
my $url = $self->returns ? $root : $self->url;
if (%parameters) {
$url .= ( $url =~ /\?/ ) ? ";" : "?";
diff --git a/lib/Jifty/Web/Form/Link.pm b/lib/Jifty/Web/Form/Link.pm
index c0003f3..3c0c94e 100644
--- a/lib/Jifty/Web/Form/Link.pm
+++ b/lib/Jifty/Web/Form/Link.pm
@@ -69,7 +69,7 @@ Any parameter which L<Jifty::Web::Form::Element/new> can take.
sub new {
my $class = shift;
my $args = ref($_[0]) ? $_[0] : {@_};
- my ($root) = Jifty->web->request->uri =~ /([^\?]*)/;
+ my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
my $self = $class->SUPER::new(
{ url => $root,
label => "Click me!",
commit 18a1e6ba1652bd89ae65413f749a30705e9d5ba7
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 8 15:28:55 2009 +0800
Disable gzip support as send_file calls print STDOUT.
diff --git a/lib/Jifty/View/Static/Handler.pm b/lib/Jifty/View/Static/Handler.pm
index 087977a..ecea375 100644
--- a/lib/Jifty/View/Static/Handler.pm
+++ b/lib/Jifty/View/Static/Handler.pm
@@ -104,7 +104,10 @@ sub handle_request {
}
my $mime_type = $self->mime_type($local_path);
- if ( $self->client_accepts_gzipped_content and $mime_type =~ m!^(text/|application/x-javascript)! ) {
+ # XXX: gzipped sendfile is printing to STDOUT.
+ # port this to psgi or plack::app::file.
+ # gzip should be a separate middleware as well.
+ if ( 0 && $self->client_accepts_gzipped_content and $mime_type =~ m!^(text/|application/x-javascript)! ) {
return $self->send_file($local_path, $mime_type, 'gzip');
} else {
return $self->send_file($local_path, $mime_type, 'uncompressed');
commit 2e7a69365bf9738f5a9f0480911fb86872cb3060
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 8 15:29:28 2009 +0800
Don't print in REST::outs
diff --git a/lib/Jifty/Plugin/REST/Dispatcher.pm b/lib/Jifty/Plugin/REST/Dispatcher.pm
index 0f270a1..1aae423 100644
--- a/lib/Jifty/Plugin/REST/Dispatcher.pm
+++ b/lib/Jifty/Plugin/REST/Dispatcher.pm
@@ -281,7 +281,7 @@ sub outs {
my $format = output_format($prefix);
Jifty->web->response->content_type($format->{content_type});
- print $format->{freezer}->(@_);
+ Jifty->web->response->body($format->{freezer}->(@_));
last_rule;
}
commit 77be52aaf34a42d44896b1c049a1c41dba7ad9ee
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 8 16:22:26 2009 +0800
Make REST plugin pass tests.
diff --git a/lib/Jifty/Plugin/REST/Dispatcher.pm b/lib/Jifty/Plugin/REST/Dispatcher.pm
index 1aae423..10a61b1 100644
--- a/lib/Jifty/Plugin/REST/Dispatcher.pm
+++ b/lib/Jifty/Plugin/REST/Dispatcher.pm
@@ -15,13 +15,13 @@ use Data::Dumper ();
use XML::Simple;
before qr{^ (/=/ .*) \. (js|json|yml|yaml|perl|pl|xml|html) $}x => run {
- $ENV{HTTP_ACCEPT} = $2;
+ Jifty->web->request->env->{HTTP_ACCEPT} = $2;
dispatch $1;
};
before POST qr{^ (/=/ .*) ! (DELETE|PUT|GET|POST|OPTIONS|HEAD|TRACE|CONNECT) $}x => run {
Jifty->web->request->request_method($2);
- $ENV{REST_REWROTE_METHOD} = 1;
+ Jifty->web->request->env->{REST_REWROTE_METHOD} = 1;
dispatch $1;
};
@@ -113,8 +113,7 @@ sub show_help_specific {
__PACKAGE__->can($method) or abort(404);
Jifty->web->response->content_type('text/plain; charset=utf-8');
-
- print __PACKAGE__->$method;
+ Jifty->web->response->body(__PACKAGE__->$method);
last_rule;
}
@@ -196,7 +195,7 @@ Returns the user's desired output format. Returns a hashref of:
sub output_format {
my $prefix = shift;
- my $accept = ($ENV{HTTP_ACCEPT} || '');
+ my $accept = (Jifty->web->request->env->{HTTP_ACCEPT} || '');
my (@prefix, $url);
if ($prefix) {
@@ -279,7 +278,7 @@ renders the content as yaml, json, javascript, perl, xml or html.
sub outs {
my $prefix = shift;
my $format = output_format($prefix);
-
+ warn "==> using $format->{format}" if $main::DEBUG;
Jifty->web->response->content_type($format->{content_type});
Jifty->web->response->body($format->{freezer}->(@_));
@@ -877,22 +876,20 @@ sub show_action_form {
my ($action) = action(shift);
Jifty::Util->require($action) or abort(404);
$action = $action->new or abort(404);
-
# XXX - Encapsulation? Someone please think of the encapsulation!
no warnings 'redefine';
- local *Jifty::Web::out = sub { shift; print @_ };
local *Jifty::Action::form_field_name = sub { shift; $_[0] };
local *Jifty::Action::register = sub { 1 };
local *Jifty::Web::Form::Field::Unrendered::render = \&Jifty::Web::Form::Field::render;
- print start_html(-encoding => 'UTF-8', -declare_xml => 1, -title => ref($action));
+ Jifty->web->response->{body} .= start_html(-encoding => 'UTF-8', -declare_xml => 1, -title => ref($action));
Jifty->web->form->start;
for my $name ($action->argument_names) {
- print $action->form_field($name);
+ Jifty->web->response->{body} .= $action->form_field($name);
}
Jifty->web->form->submit( label => 'POST' );
Jifty->web->form->end;
- print end_html;
+ Jifty->web->response->{body} .= end_html;
last_rule;
}
diff --git a/t/TestApp-Plugin-REST/t/03-format.t b/t/TestApp-Plugin-REST/t/03-format.t
index 14ca829..50e440c 100644
--- a/t/TestApp-Plugin-REST/t/03-format.t
+++ b/t/TestApp-Plugin-REST/t/03-format.t
@@ -10,6 +10,7 @@ isa_ok($server, 'Jifty::Server');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
+$mech->requests_redirectable([]);
ok(1, 'Loaded the test script');
@@ -52,7 +53,7 @@ sub result_of {
my $method = $request->{mech_method};
my $response = $mech->$method($url, @{ $request->{mech_args} || [] });
- ok($response->is_success, "$method successful");
+ ok($response->is_success || $response->is_redirect, "$method successful");
my @contents = $response->content;
if (my $location = $response->header('Location')) {
@@ -150,7 +151,7 @@ result_of_post '/=/model/user' => {
# on POST '/=/model/*' => \&create_item;
$mech->post( $URL . '/=/model/User', { name => "moose", email => 'moose at example.com' } );
-is($mech->status, 200, "create via POST to model worked");
+is($mech->status, 302, "create via POST to model worked");
$mech->post( $URL . '/=/model/Group', { name => "moose" } );
is($mech->status, 403, "create via POST to model with disallowed create action failed with 403");
commit e175b3f70ec04e5594bacc8892f93c18efe9aeda
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 8 16:24:46 2009 +0800
Another print to Jifty->web->response->body
diff --git a/lib/Jifty/Plugin/REST/Dispatcher.pm b/lib/Jifty/Plugin/REST/Dispatcher.pm
index 10a61b1..3613634 100644
--- a/lib/Jifty/Plugin/REST/Dispatcher.pm
+++ b/lib/Jifty/Plugin/REST/Dispatcher.pm
@@ -60,7 +60,7 @@ Shows basic help about resources and formats available via this RESTian interfac
sub show_help {
Jifty->web->response->content_type('text/plain; charset=utf-8');
- print qq{
+ Jifty->web->response->body(qq{
Accessing resources:
on GET /=/model list models
@@ -96,7 +96,7 @@ or appending one of the extensions to any resource:
HTML is output only if the Accept: header or an extension does not request a
specific format.
-};
+});
last_rule;
}
commit 9bbc98df54853660d8f5700d9f3040be58d21652
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 8 23:57:53 2009 +0800
Make TestApp-Dispatcher/t/under.t pass
diff --git a/lib/Jifty/Plugin/CompressedCSSandJS.pm b/lib/Jifty/Plugin/CompressedCSSandJS.pm
index 6b28edc..20d1fc4 100644
--- a/lib/Jifty/Plugin/CompressedCSSandJS.pm
+++ b/lib/Jifty/Plugin/CompressedCSSandJS.pm
@@ -190,6 +190,7 @@ sub _generate_javascript {
my $fh;
if ( open $fh, '<', $include ) {
+ local $_;
$js .= "/* Including '$file' */\n\n";
$js .= $_ while <$fh>;
$js .= "\n/* End of '$file' */\n\n";
commit 45167d5b98b783a1596efcc0a749319d354eb144
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 12:38:22 2009 -0500
Update test file for new request format
diff --git a/t/03-form-protocol.t b/t/03-form-protocol.t
index bd949b4..d84b106 100644
--- a/t/03-form-protocol.t
+++ b/t/03-form-protocol.t
@@ -10,8 +10,7 @@ J:A:F-id-mymoniker: 23
J:A:F-something-mymoniker: else
J:ACTIONS: mymoniker
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -39,8 +38,7 @@ J:A:F-id-second: 42
J:A:F-something-second: bla
J:ACTIONS: mymoniker!second
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -79,8 +77,7 @@ J:A:F-id-second: 42
J:A:F-something-second: bla
J:ACTIONS: mymoniker!second
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -118,8 +115,7 @@ J:A:F-id-second: 42
J:A:F-something-second: bla
J:ACTIONS: mymoniker!second
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -149,8 +145,7 @@ J:A:F-id-second: 42
J:A:F-something-second: bla
J:ACTIONS: second
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -188,8 +183,7 @@ J:A-second: DoThat
J:A:F-id-second: 42
J:A:F-something-second: bla
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -230,8 +224,7 @@ J:A-second: DoThat
J:A:F-id-second: 42
J:A:F-something-second: bla
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -272,8 +265,7 @@ J:A-second: DoThat
J:A:F-something-mymoniker: else
J:A-mymoniker: DoSomething
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -309,8 +301,7 @@ J:A:F:F-id-mymoniker: 96
J:A:F-something-mymoniker: else
J:ACTIONS: mymoniker
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -337,8 +328,7 @@ J:A:F-id-mymoniker: 23
J:A:F-something-mymoniker: else
J:ACTIONS: mymoniker
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -364,8 +354,7 @@ J:A:F:F-id-mymoniker: 96
J:A:F-something-mymoniker: else
J:ACTIONS: mymoniker
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -394,8 +383,7 @@ J:A:F-id-second: 42
J:A:F-something-second: feepy
J:ACTIONS: mymoniker!second
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
@@ -436,8 +424,7 @@ J:A:F-id-second: 42
J:A:F-something-second: bla
J:ACTIONS: mymoniker;second
--- request
-request_method: GET
-path: /
+uri: http:///
state_variables: {}
actions:
mymoniker:
commit 1ac608cedbefafce58cdd597579d72e893b29b9b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 12:41:50 2009 -0500
Update dependencies
diff --git a/META.yml b/META.yml
index 5c74f0e..db53a34 100644
--- a/META.yml
+++ b/META.yml
@@ -42,9 +42,11 @@ recommends:
Test::MockObject: 1.07
Test::WWW::Declare: 0.01
requires:
+ Any::Moose: 0
App::CLI: 0.08
CGI: 3.30
CGI::Cookie::Splitter: 0
+ CGI::Simple: 0
CSS::Squish: 0.07
Cache::Cache: 0
Calendar::Simple: 0
@@ -109,6 +111,8 @@ requires:
Module::ScanDeps: 0
Object::Declare: 0.13
Params::Validate: 0
+ Plack: 0
+ Plack::Request: 0
SQL::ReservedWords: 0
SUPER: 0
Scalar::Defer: 0.12
diff --git a/Makefile.PL b/Makefile.PL
index f871291..9815d17 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,6 +2,7 @@ use inc::Module::Install 0.46;
name('Jifty');
license('Perl');
perl_version '5.8.3';
+requires('Any::Moose');
requires('App::CLI' => 0.08 ); # App::CLI::Command::Help App::CLI::Command
requires('Cache::Cache'); #Cache::FileCache
requires('Calendar::Simple');
@@ -12,7 +13,7 @@ requires('Class::Data::Inheritable');
requires('Class::Trigger' => '0.13');
requires('Clone' => '0.27');
requires('CGI' => '3.30');
-requires('CGI::Simple');
+requires('CGI::Simple'); # CGI::Simple::Cookie
requires('CGI::Cookie::Splitter');
requires('Class::Inspector' => 1.20); # For File::ShareDir on Win32
requires('Crypt::CBC');
@@ -67,6 +68,8 @@ requires('Module::Refresh');
requires('Module::ScanDeps');
requires('Object::Declare' => '0.13');
requires('Params::Validate');
+requires('Plack'); # Plack::Loader Plack::Test Plack::Util
+requires('Plack::Request');
requires('Scalar::Defer' => '0.12');
requires('Shell::Command');
requires('String::BufferStack' => '1.12');
commit 062c22ee6223b94c4dc21152ce4ab277fd417091
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 13:28:03 2009 -0500
I18N::LangTags::Detect goes looking for CGI environment variables
Make client-side language negotiation work again, by faking the CGI
environment variables that I18N::LangTags::Detect looks at.
diff --git a/lib/Jifty/I18N.pm b/lib/Jifty/I18N.pm
index 8bc6197..f60b201 100644
--- a/lib/Jifty/I18N.pm
+++ b/lib/Jifty/I18N.pm
@@ -198,6 +198,8 @@ sub get_language_handle {
}
}
+ local $ENV{REQUEST_METHOD} = Jifty->web->request->method;
+ local $ENV{HTTP_ACCEPT_LANGUAGE} = Jifty->web->request->header("Accept-Language") || "";
$$DynamicLH = $self->get_handle($lang ? $lang : ()) if $DynamicLH;
}
commit f550b42af1a31390de89393b9d4d781176362716
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 14:18:21 2009 -0500
Creat users as the superuser; this only worked because of AdminMode
diff --git a/t/TestApp-Plugin-ActorMetadata/t/actormetadata.t b/t/TestApp-Plugin-ActorMetadata/t/actormetadata.t
index 5dbb105..8a174a6 100644
--- a/t/TestApp-Plugin-ActorMetadata/t/actormetadata.t
+++ b/t/TestApp-Plugin-ActorMetadata/t/actormetadata.t
@@ -9,11 +9,11 @@ my $has_mock_time;
eval "use Test::MockTime qw/set_relative_time/";
$has_mock_time = 1 unless $@;
-$user_foo = TestApp::Plugin::ActorMetadata::Model::User->new;
+$user_foo = TestApp::Plugin::ActorMetadata::Model::User->new->as_superuser;
$user_foo->create( name => 'foo', email => 'foo at example.com' );
ok( $user_foo->id, 'created user foo' );
-$user_bar = TestApp::Plugin::ActorMetadata::Model::User->new;
+$user_bar = TestApp::Plugin::ActorMetadata::Model::User->new->as_superuser;
$user_bar->create( name => 'bar', email => 'bar at example.com' );
ok( $user_bar->id, 'created user bar' );
commit 40f5321abb8ff2b8bba2bc2071c96834e1a960b5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 14:20:17 2009 -0500
Turn off AdminMode and DevelMode on test apps whenever possible
This turns off halos, for example, which makes it easier to look for
specific content -- as well as providing a small speedup to all the
tests.
diff --git a/t/TestApp-Collection-Select/etc/config.yml b/t/TestApp-Collection-Select/etc/config.yml
index 0bca5ef..833635a 100644
--- a/t/TestApp-Collection-Select/etc/config.yml
+++ b/t/TestApp-Collection-Select/etc/config.yml
@@ -15,7 +15,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-JiftyJS/etc/config.yml b/t/TestApp-JiftyJS/etc/config.yml
index c6f34e5..a7c14cb 100644
--- a/t/TestApp-JiftyJS/etc/config.yml
+++ b/t/TestApp-JiftyJS/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::JiftyJS
ApplicationName: TestApp::JiftyJS
ApplicationUUID: F43CA57E-A4BE-11DC-A07C-465A83BE23AB
@@ -14,7 +14,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
AllowedLang:
diff --git a/t/TestApp-Mason/etc/config.yml b/t/TestApp-Mason/etc/config.yml
index 304c7bc..4f034c8 100644
--- a/t/TestApp-Mason/etc/config.yml
+++ b/t/TestApp-Mason/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Mason
ApplicationName: TestApp-Mason
ApplicationUUID: 691A2590-F25E-11DD-9995-406635203BE5
@@ -15,7 +15,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-Plugin-ActorMetadata/etc/config.yml b/t/TestApp-Plugin-ActorMetadata/etc/config.yml
index 33abd94..dd53423 100644
--- a/t/TestApp-Plugin-ActorMetadata/etc/config.yml
+++ b/t/TestApp-Plugin-ActorMetadata/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::ActorMetadata
ApplicationName: TestApp::Plugin::ActorMetadata
ApplicationUUID: C4418A2E-DE0B-11DD-96DC-F9E9C3E98ACD
@@ -15,7 +15,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-Plugin-AppPluginHasModels/etc/config.yml b/t/TestApp-Plugin-AppPluginHasModels/etc/config.yml
index 507ae79..b7e1fe0 100644
--- a/t/TestApp-Plugin-AppPluginHasModels/etc/config.yml
+++ b/t/TestApp-Plugin-AppPluginHasModels/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::AppPluginHasModels
ApplicationName: TestApp-Plugin-AppPluginHasModels
ApplicationUUID: 646FD662-32DD-11DC-AD79-2A0157C3B83B
@@ -15,7 +15,7 @@ framework:
RecordUUIDs: active
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-Plugin-CompressedCSSandJS/etc/config.yml b/t/TestApp-Plugin-CompressedCSSandJS/etc/config.yml
index 272e37d..44a4101 100644
--- a/t/TestApp-Plugin-CompressedCSSandJS/etc/config.yml
+++ b/t/TestApp-Plugin-CompressedCSSandJS/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::CompressedCSSandJS
ApplicationName: TestApp::Plugin::CompressedCSSandJS
ApplicationUUID: DC3B58E4-4F3C-11DC-9ECB-E5DB6F105773
@@ -15,7 +15,7 @@ framework:
RecordUUIDs: active
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: DEBUG
diff --git a/t/TestApp-Plugin-News/etc/config.yml b/t/TestApp-Plugin-News/etc/config.yml
index a14c0af..2412cbc 100644
--- a/t/TestApp-Plugin-News/etc/config.yml
+++ b/t/TestApp-Plugin-News/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::News
ApplicationName: TestApp-Plugin-News
ApplicationUUID: 09757060-0564-11DC-AD52-CB2C768159CC
@@ -13,7 +13,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-Plugin-OnClick/etc/config.yml b/t/TestApp-Plugin-OnClick/etc/config.yml
index 9851fc4..d914140 100644
--- a/t/TestApp-Plugin-OnClick/etc/config.yml
+++ b/t/TestApp-Plugin-OnClick/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::OnClick
ApplicationName: TestApp-Plugin-OnClick
ApplicationUUID: 45E1B0FE-820A-11DC-9905-76B28F38D863
@@ -14,7 +14,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-Plugin-PasswordAuth/etc/config.yml b/t/TestApp-Plugin-PasswordAuth/etc/config.yml
index 308ee3b..a655abb 100644
--- a/t/TestApp-Plugin-PasswordAuth/etc/config.yml
+++ b/t/TestApp-Plugin-PasswordAuth/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::PasswordAuth
ApplicationName: TestApp-Plugin-PasswordAuth
ApplicationUUID: E6B4180A-C68F-11DB-893B-FEFB1AECF28B
@@ -13,7 +13,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: DEBUG
diff --git a/t/TestApp-Plugin-SinglePage/etc/config.yml b/t/TestApp-Plugin-SinglePage/etc/config.yml
index 971e87d..c14e78e 100644
--- a/t/TestApp-Plugin-SinglePage/etc/config.yml
+++ b/t/TestApp-Plugin-SinglePage/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::Plugin::SinglePage
ApplicationName: TestApp::Plugin::SinglePage
ApplicationUUID: DC3B58E4-4F3C-11DC-9ECB-E5DB6F105773
@@ -15,7 +15,7 @@ framework:
RecordUUIDs: active
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
diff --git a/t/TestApp-RestartServer/etc/config.yml b/t/TestApp-RestartServer/etc/config.yml
index cd37d5e..6188904 100644
--- a/t/TestApp-RestartServer/etc/config.yml
+++ b/t/TestApp-RestartServer/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp::RestartServer
ApplicationName: TestApp-RestartServer
ApplicationUUID: 691A2590-F25E-11DD-9995-406635203BE5
@@ -15,7 +15,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: FATAL
diff --git a/t/TestApp-Template-Declare/etc/config.yml b/t/TestApp-Template-Declare/etc/config.yml
index 0d6da8b..93c1e91 100644
--- a/t/TestApp-Template-Declare/etc/config.yml
+++ b/t/TestApp-Template-Declare/etc/config.yml
@@ -1,6 +1,6 @@
---
framework:
- AdminMode: 1
+ AdminMode: 0
ApplicationClass: TestApp
ApplicationName: TestApp
ApplicationUUID: CE9AD926-F2A1-11DD-BB2C-5CD7FE13D77C
@@ -15,7 +15,7 @@ framework:
RecordBaseClass: Jifty::DBI::Record::Cachable
User: ''
Version: 0.0.1
- DevelMode: 1
+ DevelMode: 0
L10N:
PoDir: share/po
LogLevel: INFO
commit 5034f3c056b234f0baa7b7dd4cc06965e9a692bf
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 8 14:41:35 2009 -0500
Only set CGI-like headers for I18N if we have a Jifty->web->request
diff --git a/lib/Jifty/I18N.pm b/lib/Jifty/I18N.pm
index f60b201..a8e484d 100644
--- a/lib/Jifty/I18N.pm
+++ b/lib/Jifty/I18N.pm
@@ -198,8 +198,10 @@ sub get_language_handle {
}
}
- local $ENV{REQUEST_METHOD} = Jifty->web->request->method;
- local $ENV{HTTP_ACCEPT_LANGUAGE} = Jifty->web->request->header("Accept-Language") || "";
+ local $ENV{REQUEST_METHOD} = Jifty->web->request->method
+ if Jifty->web->request;
+ local $ENV{HTTP_ACCEPT_LANGUAGE} = Jifty->web->request->header("Accept-Language") || ""
+ if Jifty->web->request;
$$DynamicLH = $self->get_handle($lang ? $lang : ()) if $DynamicLH;
}
commit 17bfc0f4687cbdfc8960f0159ceff856258e5aae
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 22 21:11:59 2009 +0800
encode perl strings to utf8 bytes in out_method.
diff --git a/lib/Jifty/View.pm b/lib/Jifty/View.pm
index 34a3da4..9cb56b4 100644
--- a/lib/Jifty/View.pm
+++ b/lib/Jifty/View.pm
@@ -4,6 +4,8 @@ use warnings;
use base qw/Jifty::Object/;
+use Encode ();
+
=head1 NAME
Jifty::View - Base class for view modules
@@ -42,7 +44,12 @@ sub out_method {
# We now install a new, faster out_method that doesn't have to
# keep checking whether headers have been sent.
- my $content = sub { Jifty->web->response->{body} .= $_ for @_ };
+ my $content = sub {
+ Jifty->web->response->{body} .= $_
+ for map { Encode::is_utf8($_) ? Encode::encode('utf8', $_)
+ : $_ }
+ @_;
+ };
Jifty->handler->buffer->out_method( $content );
$content->(@_);
}
commit 155ed402ea6e5334cb6a2650e8d1a97659be3ef3
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 22 21:38:46 2009 +0800
Correct uri for dispatch-https test.
diff --git a/t/TestApp/t/02-dispatch-https.t b/t/TestApp/t/02-dispatch-https.t
index e544e06..1b61305 100644
--- a/t/TestApp/t/02-dispatch-https.t
+++ b/t/TestApp/t/02-dispatch-https.t
@@ -13,6 +13,7 @@ isa_ok($server, 'Jifty::Server');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
+$URL =~ s/http:/https:/;
$mech->get_ok("$URL/dispatch/protocol", "Got /dispatch/protocol");
$mech->content_contains("HTTPS");
commit 49050648de139f7d9b0d563f8b68c68ca7b9368d
Author: Chia-liang Kao <clkao at clkao.org>
Date: Tue Dec 22 21:39:12 2009 +0800
skip tests requiring actual connecting to test servers for now.
diff --git a/t/08-client.t b/t/08-client.t
index 7afadc3..48ac6af 100644
--- a/t/08-client.t
+++ b/t/08-client.t
@@ -8,6 +8,11 @@ use_ok ('Jifty::Client');
my $server=Jifty::Test->make_server;
isa_ok($server, 'Jifty::Server');
+if ($server->isa('Jifty::TestServer::Plack')) {
+ Jifty::Test->builder->todo_skip("This test is not using the test framework, and requires a server to connect to. This doesn't work yet") for 1..2;
+ exit 0;
+}
+
my $URL = $server->started_ok;
my $client = Jifty::Client->new;
@@ -16,4 +21,4 @@ $client->get($URL);
ok($client->success(), "Jifty client can connect to the server");
# XXX TODO need more tests to make sure that our client can connect
-# and do meaningful operations with a Jifty server
\ No newline at end of file
+# and do meaningful operations with a Jifty server
diff --git a/t/TestApp/t/07-sandboxing.t b/t/TestApp/t/07-sandboxing.t
index 59d0bab..d28d10c 100644
--- a/t/TestApp/t/07-sandboxing.t
+++ b/t/TestApp/t/07-sandboxing.t
@@ -11,6 +11,11 @@ my $server = Jifty::Test->make_server;
isa_ok($server, 'Jifty::Server');
+if ($server->isa('Jifty::TestServer::Plack')) {
+ Jifty::Test->builder->todo_skip("This test is not using the test framework, and requires a server to connect to. This doesn't work yet") for 1..124;
+ exit 0;
+}
+
my $uri = URI->new($server->started_ok);
my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings");
diff --git a/t/TestApp/t/18-test-www-declare.t b/t/TestApp/t/18-test-www-declare.t
index 9918c1c..17687e2 100644
--- a/t/TestApp/t/18-test-www-declare.t
+++ b/t/TestApp/t/18-test-www-declare.t
@@ -9,6 +9,8 @@ BEGIN {
unless (eval { require Test::WWW::Declare }) {
plan skip_all => "Test::WWW::Declare isn't installed";
}
+ plan skip_all => "This test is not using the test framework, and requires a server to connect to. This doesn't work yet";
+
}
use Jifty::Test::WWW::Declare tests => 2;
commit 2a0329c87ff5b8a06a13e36a2158f62542bff8a8
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 12:27:46 2010 +0800
compat plugin to provide old handler->apache methods
diff --git a/lib/Jifty/Plugin/Compat.pm b/lib/Jifty/Plugin/Compat.pm
new file mode 100644
index 0000000..68c86e6
--- /dev/null
+++ b/lib/Jifty/Plugin/Compat.pm
@@ -0,0 +1,52 @@
+use strict;
+use warnings;
+
+package Jifty::Plugin::Compat;
+use base 'Jifty::Plugin';
+use Hook::LexWrap;
+require Jifty::View::Mason::Handler;
+
+*Jifty::Handler::apache = sub {
+ return 'Jifty::Plugin::Compat::Apache';
+};
+
+wrap 'Jifty::View::Mason::Handler::new',
+ post => sub { my $self = shift;
+ $self->interp->compiler->add_allowed_globals('$r');
+ $self->interp->set_global('$r', 'Jifty::Plugin::Compat::Apache');
+ };
+
+package Jifty::Plugin::Compat::Apache;
+use Carp;
+
+sub header_out {
+ my ($class, $key, $val) = @_;
+ if ($key eq 'Status') {
+ Jifty->web->response->status( $val );
+ return;
+ }
+
+ if ($key eq 'Content-Type') {
+ Jifty->web->response->content_type( $val );
+ return;
+ }
+
+ if ($key eq 'Location') {
+ Jifty->web->response->status( 302 );
+ }
+
+ Jifty->web->response->header( $key, $val );
+}
+
+sub content_type {
+ my $class = shift;
+ Jifty->web->response->content_type( @_ );
+}
+
+sub AUTOLOAD {
+ our $AUTOLOAD;
+ croak "compat apache does not handle $AUTOLOAD";
+}
+
+1;
+
commit dc23bd1b55f58ebdea5890e9be14aac6f289d80c
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 15:02:25 2010 +0800
Make Jifty::Request::method a mutator again, and handle path argument in constructor.
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index a5004e7..b66159a 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -6,6 +6,7 @@ package Jifty::Request;
use Any::Moose;
extends 'Plack::Request', 'Jifty::Object';
+has 'env' => (is => "ro", isa => "HashRef", default => sub { {} });
has '_top_request' => (is => 'rw');
has 'arguments' => (is => 'rw');
has 'template_arguments' => (is => 'rw');
@@ -15,6 +16,13 @@ has 'future_continuation_id' => (is => 'rw');
has 'continuation_type' => (is => 'rw');
has 'continuation_path' => (is => 'rw');
+around 'method' => sub {
+ my ($orig, $self, $arg) = @_;
+ $self->{env}{REQUEST_METHOD} = $arg
+ if $arg;
+ $orig->($self, $arg ? $arg : ());
+};
+
use Jifty::JSON;
use Jifty::YAML;
use Jifty::Web::FileUpload;
@@ -82,6 +90,16 @@ sole argument.
=cut
+sub BUILDARGS {
+ my ($class, %args) = @_;
+
+ if (my $path = delete $args{path}) {
+ $args{env}{REQUEST_URI} ||= $path;
+ }
+
+ return \%args;
+}
+
sub BUILD {
my $self = shift;
@@ -96,6 +114,10 @@ sub BUILD {
$self->{'actions'} = {};
$self->{'state_variables'} = {};
$self->{'fragments'} = {};
+ $self->{env}{'REQUEST_METHOD'} ||= 'GET';
+ $self->{env}{'REQUEST_URI'} ||= '/';
+
+ $self->path($self->{env}{REQUEST_URI});
$self->arguments({});
$self->template_arguments({});
}
diff --git a/t/Jifty.pm b/t/Jifty.pm
index b628416..37edbb5 100644
--- a/t/Jifty.pm
+++ b/t/Jifty.pm
@@ -15,6 +15,8 @@ use Test::Base::Filter -Base;
sub request_from_webform {
my $form = shift;
- Jifty::Request->new->from_webform(%$form);
+ my $r = Jifty::Request->new->from_webform(%$form);
+ delete $r->{env};
+ return $r;
}
commit e42e4c3517d5a9245acef816e48d88d72a19cb45
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 16:35:31 2010 +0800
Plack::Request requires post with content-length. reset fragment request query as well.
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index b9ab223..3600ff2 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -321,10 +321,9 @@ sub fragment_request {
my $uri = $self->uri->clone;
$uri->path("__jifty/webservices/xml");
+ $uri->query('');
- my $request = HTTP::Request->new(
- POST => $uri,
- [ 'Content-Type' => 'text/x-yaml' ],
+ my $body =
Jifty::YAML::Dump(
{ path => $uri->path,
fragments => {
@@ -335,9 +334,17 @@ sub fragment_request {
}
}
}
- )
+ );
+
+ my $request = HTTP::Request->new(
+ POST => $uri,
+ [ 'Content-Type' => 'text/x-yaml',
+ 'Content-Length' => length($body) ],
+ $body
);
+
my $result = $self->request( $request );
+
use XML::Simple;
my $content = eval { XML::Simple::XMLin($result->content, SuppressEmpty => '')->{fragment}{content} } || '';
$self->back;
commit 21bca60b9a6106346475903941a1494c83b4977d
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 16:37:43 2010 +0800
load session before set_cookie if unloaded.
diff --git a/lib/Jifty/Web/Session.pm b/lib/Jifty/Web/Session.pm
index c7b0f36..64ab825 100644
--- a/lib/Jifty/Web/Session.pm
+++ b/lib/Jifty/Web/Session.pm
@@ -318,6 +318,8 @@ sub set_cookie {
# terrific problems
return if Jifty->web->response->header('Expires');
+ $self->load unless $self->loaded;
+
my $cookie_name = $self->cookie_name;
my %cookies = Jifty->web->request ? CGI::Simple::Cookie->parse(Jifty->web->request->env->{HTTP_COOKIE}) : ();
commit e831f9dcb399dd597326c8984d45fd6fb57e0c85
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 17:23:32 2010 +0800
Refactor fragment_request and make send_action provide content-length as well.
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index 3600ff2..ca5bbab 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -277,30 +277,39 @@ using the "back button" after making the webservice request.
=cut
+sub _build_webservices_request {
+ my ($self, $endpoint, $data) = @_;
+
+ my $uri = $self->uri->clone;
+ $uri->path($endpoint);
+ $uri->query('');
+
+ my $body = Jifty::YAML::Dump({ path => $endpoint, %$data});
+
+ HTTP::Request->new(
+ POST => $uri,
+ [ 'Content-Type' => 'text/x-yaml',
+ 'Content-Length' => length($body) ],
+ $body
+ );
+}
+
sub send_action {
my $self = shift;
my $class = shift;
my %args = @_;
-
- my $uri = $self->uri->clone;
- $uri->path("__jifty/webservices/yaml");
-
- my $request = HTTP::Request->new(
- POST => $uri,
- [ 'Content-Type' => 'text/x-yaml' ],
- Jifty::YAML::Dump(
- { path => $uri->path,
- actions => {
- action => {
- moniker => 'action',
- class => $class,
- fields => \%args
- }
+ my $request = $self->_build_webservices_request
+ ( "__jifty/webservices/yaml",
+ { actions => {
+ action => {
+ moniker => 'action',
+ class => $class,
+ fields => \%args
}
}
- )
- );
+ });
+
my $result = $self->request( $request );
my $content = eval { Jifty::YAML::Load($result->content)->{action} } || undef;
$self->back;
@@ -319,29 +328,16 @@ sub fragment_request {
my $path = shift;
my %args = @_;
- my $uri = $self->uri->clone;
- $uri->path("__jifty/webservices/xml");
- $uri->query('');
-
- my $body =
- Jifty::YAML::Dump(
- { path => $uri->path,
- fragments => {
- fragment => {
- name => 'fragment',
- path => $path,
- args => \%args
- }
+ my $request = $self->_build_webservices_request
+ ( "__jifty/webservices/xml",
+ { fragments => {
+ fragment => {
+ name => 'fragment',
+ path => $path,
+ args => \%args
}
}
- );
-
- my $request = HTTP::Request->new(
- POST => $uri,
- [ 'Content-Type' => 'text/x-yaml',
- 'Content-Length' => length($body) ],
- $body
- );
+ });
my $result = $self->request( $request );
commit b4926fafe54b32b8ad123dd3774a25213995e8c2
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 17:29:36 2010 +0800
apply _plack_hook when cloning mech objects.
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index ca5bbab..251bad5 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -50,6 +50,18 @@ sub new {
return $self;
}
+sub clone {
+ my $self = shift;
+ my $clone = $self->SUPER::clone($self);
+ $clone->_plack_hook(
+ uri => Jifty->web->url,
+ handler => sub {
+ Jifty->handler->handle_request(@_);
+ },
+ );
+ return $clone;
+}
+
sub _plack_hook {
my $self = shift;
my %args = (
commit 2908cec6ddbc38c51e63038c4b828f03af310fec
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 1 17:39:12 2010 +0800
provide response->add_header for compatibility.
diff --git a/lib/Jifty/Response.pm b/lib/Jifty/Response.pm
index e9966b1..a0607c2 100644
--- a/lib/Jifty/Response.pm
+++ b/lib/Jifty/Response.pm
@@ -20,6 +20,17 @@ extends 'Plack::Response';
has 'error' => (is => 'rw');
+=head2 add_header NAME VALUE
+
+Deprecated. Use header(NAME, VALUE)
+
+=cut
+
+sub add_header {
+ my $self = shift;
+ $self->header(@_);
+}
+
=head2 result MONIKER [RESULT]
Gets or sets the L<Jifty::Result> of the L<Jifty::Action> with the given
commit 547edb43b781403fcd18a63c36c5040df2dcc1b7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Jan 6 00:52:00 2010 -0500
Add a ->header_in and ->params to compat plugin
diff --git a/lib/Jifty/Plugin/Compat.pm b/lib/Jifty/Plugin/Compat.pm
index 68c86e6..23fda1c 100644
--- a/lib/Jifty/Plugin/Compat.pm
+++ b/lib/Jifty/Plugin/Compat.pm
@@ -19,6 +19,11 @@ wrap 'Jifty::View::Mason::Handler::new',
package Jifty::Plugin::Compat::Apache;
use Carp;
+sub header_in {
+ my $class = shift;
+ return Jifty->web->request->header(@_);
+}
+
sub header_out {
my ($class, $key, $val) = @_;
if ($key eq 'Status') {
@@ -48,5 +53,10 @@ sub AUTOLOAD {
croak "compat apache does not handle $AUTOLOAD";
}
+sub params {
+ my $class = shift;
+ return %{ Jifty->web->request->parameters };
+}
+
1;
commit a4c5c0ce895139d9bc80b8170ed86694e84cf566
Author: Chia-liang Kao <clkao at clkao.org>
Date: Wed Jan 6 18:03:14 2010 +0800
use new test::www::mechanize::psgi instead of plack hook hacks.
diff --git a/Makefile.PL b/Makefile.PL
index 9815d17..ea6dc1a 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -84,6 +84,7 @@ requires('Test::More' => 0.62 );
requires('Test::Pod::Coverage');
requires('Test::Script::Run' => 0.03);
requires('Test::WWW::Mechanize' => 1.04 );
+requires('Test::WWW::Mechanize::PSGI' => 0.35 );
requires('Test::WWW::Selenium' => 1.18 );
requires('WWW::Mechanize' => 1.51 );
requires('UNIVERSAL::require');
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index 251bad5..ffce267 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -2,7 +2,7 @@ use strict;
use warnings;
package Jifty::Test::WWW::Mechanize;
-use base qw/Test::WWW::Mechanize/;
+use base qw/Test::WWW::Mechanize::PSGI/;
delete $ENV{'http_proxy'}; # Otherwise Test::WWW::Mechanize tries to go through your HTTP proxy
@@ -39,53 +39,12 @@ bot a cookie jar.
sub new {
my $class = shift;
- my $self = $class->SUPER::new(@_);
- $self->cookie_jar(HTTP::Cookies->new);
- $self->_plack_hook(
- uri => Jifty->web->url,
- handler => sub {
- Jifty->handler->handle_request(@_);
- },
- );
- return $self;
-}
-
-sub clone {
- my $self = shift;
- my $clone = $self->SUPER::clone($self);
- $clone->_plack_hook(
- uri => Jifty->web->url,
- handler => sub {
- Jifty->handler->handle_request(@_);
- },
- );
- return $clone;
-}
+ my $app = sub { Jifty->handler->handle_request(@_) };
-sub _plack_hook {
- my $self = shift;
- my %args = (
- uri => "http://localhost:8888/",
- @_
- );
-
- die "No handler provided"
- unless $args{handler};
-
- my $cb;
-
- test_psgi
- app => $args{handler},
- client => sub {$cb = shift};
+ my $self = $class->SUPER::new(@_, app => $app);
+ $self->cookie_jar(HTTP::Cookies->new);
- my $for = URI->new( $args{uri} );
- $self->add_handler(
- request_send => $cb,
- m_scheme => $for->scheme,
- m_host => $for->host,
- m_port => $for->port,
- m_path_prefix => $for->path,
- );
+ return $self;
}
=head2 moniker_for ACTION, FIELD1 => VALUE1, FIELD2 => VALUE2
commit 4a8eecd5b07ef79f5e3e71bad720f8bbab698d97
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 8 20:37:34 2010 -0500
Clone requests more deeply, now that ->uri is a ref
Previously, cloning a request made the ->path of each be independent.
However, now that ->path mutates ->uri, which is itself an object,
this is no longer the case. When cloning, it is thus necessary to
clone the URI object as well.
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index b66159a..1550d50 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -132,10 +132,13 @@ sub clone {
my $self = shift;
# "Semi-shallow" clone
- return bless({map {
+ my $ret = bless({map {
my $val = $self->{$_};
$_ => (ref($val) eq "HASH" ? { %$val } : ref($val) eq "ARRAY" ? [ @$val ] : $val);
} keys %$self}, ref($self));
+
+ $ret->uri( $self->uri->clone );
+ return $ret;
}
=head2 promote
commit bd9a6f75d1c42655c638a13b089dbd7e421d9a8a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 8 20:30:19 2010 -0500
Keep trailing slashes in Jifty->web->request->path
Removing trailing slashes from Jifty->web->request->path makes it
unsuitable for providing web URLs; specifically, they do not work for
"self-links." While the same template may render for "/splash" and
"/splash/", relative links will resolve differently in each.
Trailing slashes had been being stripped by
Jifty::Util::canonicalize_path, which is primarily meant for file
paths. In addition to File::Spec->catdir ignoring trailing slashes,
they were explicitly ignored while walking through ->splitdir.
In order to preserve the behavior of t/TestApp/t/14-template-paths.t,
trailing slashes need to be stripped off of template paths before view
objects are asked to resolve them to templates.
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index 1550d50..e06d56b 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -197,7 +197,7 @@ sub from_data_structure {
my $path = $data->{'path'};
$path ||= $self->path || '/';
- $self->path( Jifty::Util->canonicalize_path( $path ) );
+ $self->path( Jifty::Util->canonicalize_path( $path, 1 ) );
$self->just_validating( $data->{validating} ) if $data->{validating};
if ( ref $data->{continuation} eq "HASH" ) {
diff --git a/lib/Jifty/Util.pm b/lib/Jifty/Util.pm
index e0ee289..dbeb5fc 100644
--- a/lib/Jifty/Util.pm
+++ b/lib/Jifty/Util.pm
@@ -50,6 +50,7 @@ both C</> and C<\> as valid separators in PATH.
sub canonicalize_path {
my $self = shift;
my $path = shift;
+ my $keepempty = shift;
my @path = File::Spec->splitdir($path);
@@ -65,13 +66,10 @@ sub canonicalize_path {
} else {
pop @newpath;
}
-
}
-
- return File::Spec::Unix->catdir(@newpath);
-
-
+ push @newpath, '' if $keepempty and @path and $path[-1] eq '';
+ return join("/", at newpath);
}
diff --git a/lib/Jifty/Web.pm b/lib/Jifty/Web.pm
index 87dd8a2..5cd408a 100644
--- a/lib/Jifty/Web.pm
+++ b/lib/Jifty/Web.pm
@@ -948,6 +948,9 @@ sub template_exists {
my $value = ref $template ? $$template : $template;
+ # Strip trailing slashes
+ $value =~ s{/$}{} if $value ne "/";
+
foreach my $handler ( map {Jifty->handler->view($_)} Jifty->handler->view_handlers ) {
if ( my $path = $handler->template_exists($value) ) {
$$template = $path if ref $template;
commit 746285797e5bc0961f5e6344d5653cc812c619a1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 8 16:34:32 2010 -0500
Continuations: Clean up return_path_matches logic
The previous "URI unescape until we can't anymore, then match" logic
was necessary because different server request methods had different
standards of escaping. PSGI has a clear standard, so we can do the
much simpler check of if the paths match, the only argument is
J:RETURN, and it is set correctly.
diff --git a/lib/Jifty/Continuation.pm b/lib/Jifty/Continuation.pm
index 0ffc3d7..5173245 100644
--- a/lib/Jifty/Continuation.pm
+++ b/lib/Jifty/Continuation.pm
@@ -152,20 +152,15 @@ to ask "are we about to call a continuation?"
sub return_path_matches {
my $self = shift;
- my $called_uri = Jifty->web->request->request_uri;
- my $request_path = $self->request->path;
- # XXX TODO: WE should be using URI canonicalization
+ return unless Jifty->web->request->path eq $self->request->path;
- my $escape;
- $called_uri =~ s{/+}{/}g;
- $called_uri = Encode::encode_utf8($called_uri);
- $called_uri = $escape while $called_uri ne ($escape = URI::Escape::uri_unescape($called_uri));
- $request_path =~ s{/+}{/}g;
- $request_path = Encode::encode_utf8($request_path);
- $request_path = $escape while $request_path ne ($escape = URI::Escape::uri_unescape($request_path));
+ my $args = Jifty->web->request->arguments;
+ return unless scalar keys %{$args} == 1;
- return $called_uri =~ /^\Q$request_path\E[?&;]J:RETURN=@{[$self->id]}$/;
+ return unless exists $args->{"J:RETURN"} and $args->{"J:RETURN"} eq $self->id;
+
+ return 1;
}
=head2 call
commit d0c066efb2346370235a58a0d9559b214c8b283f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 8 20:40:12 2010 -0500
Use Jifty->web->request->top_request->path instead of ->request_uri
request_uri is URI-encoded, and is not updated when ->path is. This
also avoids the dance of having to trim off the request parameters.
diff --git a/lib/Jifty/Request.pm b/lib/Jifty/Request.pm
index e06d56b..b6f36fa 100644
--- a/lib/Jifty/Request.pm
+++ b/lib/Jifty/Request.pm
@@ -89,17 +89,6 @@ method of that name is called, with the I<PARAMHASH>'s value as its
sole argument.
=cut
-
-sub BUILDARGS {
- my ($class, %args) = @_;
-
- if (my $path = delete $args{path}) {
- $args{env}{REQUEST_URI} ||= $path;
- }
-
- return \%args;
-}
-
sub BUILD {
my $self = shift;
@@ -115,9 +104,8 @@ sub BUILD {
$self->{'state_variables'} = {};
$self->{'fragments'} = {};
$self->{env}{'REQUEST_METHOD'} ||= 'GET';
- $self->{env}{'REQUEST_URI'} ||= '/';
- $self->path($self->{env}{REQUEST_URI});
+ $self->path("/") unless $self->path;
$self->arguments({});
$self->template_arguments({});
}
diff --git a/lib/Jifty/Web.pm b/lib/Jifty/Web.pm
index 5cd408a..31ff39d 100644
--- a/lib/Jifty/Web.pm
+++ b/lib/Jifty/Web.pm
@@ -144,7 +144,7 @@ sub url {
$http_host_env = (Jifty->web->is_ssl ? "https" : "http") ."://$http_host_env";
}
$uri = URI->new($http_host_env);
- if ($dirty && (my $req_uri_env = $ENV{REQUEST_URI})) {
+ if ($dirty && Jifty->web->request && (my $req_uri_env = Jifty->web->request->request_uri)) {
my $req_uri = URI->new($req_uri_env);
$uri->scheme($req_uri->scheme) if $req_uri->can('scheme');
$dirty = $uri->scheme;
diff --git a/lib/Jifty/Web/Form.pm b/lib/Jifty/Web/Form.pm
index 2f2d26c..d8aae26 100644
--- a/lib/Jifty/Web/Form.pm
+++ b/lib/Jifty/Web/Form.pm
@@ -200,8 +200,7 @@ sub start {
}
}
- my $root = $self->submit_to;
- ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/ unless defined $root;
+ my $root = $self->submit_to || Jifty->web->request->top_request->path;
my $form_start = qq!<form method="post" action="! . Jifty->web->escape( $root ) . qq!"!;
$form_start .= qq! name="@{[ $self->name ]}"! if defined $self->name;
$form_start .= qq! target="@{[ $self->target ]}"! if defined $self->target;
diff --git a/lib/Jifty/Web/Form/Clickable.pm b/lib/Jifty/Web/Form/Clickable.pm
index eda8295..9235958 100644
--- a/lib/Jifty/Web/Form/Clickable.pm
+++ b/lib/Jifty/Web/Form/Clickable.pm
@@ -155,7 +155,6 @@ get an unexpected error from your browser.
sub new {
my $class = shift;
- my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
my %args = (
parameters => {},
@@ -170,7 +169,7 @@ sub new {
my $self = $class->SUPER::new(
{ class => '',
label => 'Click me!',
- url => $root,
+ url => Jifty->web->request->top_request->path,
escape_label => 1,
tooltip => '',
continuation => Jifty->web->request->continuation,
@@ -428,15 +427,13 @@ sub post_parameters {
my %parameters
= ( _map( %{ $self->{fallback} || {} } ), $self->parameters );
- my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
-
# Submit actions should only show up once
my %uniq;
$self->submit( [ grep { not $uniq{$_}++ } @{ $self->submit } ] )
if $self->submit;
# Add a redirect, if this isn't to the right page
- if ( $self->url ne $root and not $self->returns ) {
+ if ( $self->url ne Jifty->web->request->top_request->path and not $self->returns ) {
Jifty::Util->require('Jifty::Action::Redirect');
my $redirect = Jifty::Action::Redirect->new(
arguments => { url => $self->url } );
@@ -479,8 +476,7 @@ sub complete_url {
my %parameters = $self->get_parameters;
- my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
- my $url = $self->returns ? $root : $self->url;
+ my $url = $self->returns ? Jifty->web->request->top_request->path : $self->url;
if (%parameters) {
$url .= ( $url =~ /\?/ ) ? ";" : "?";
$url .= Jifty->web->query_string(%parameters);
diff --git a/lib/Jifty/Web/Form/Link.pm b/lib/Jifty/Web/Form/Link.pm
index 3c0c94e..be5078c 100644
--- a/lib/Jifty/Web/Form/Link.pm
+++ b/lib/Jifty/Web/Form/Link.pm
@@ -69,9 +69,8 @@ Any parameter which L<Jifty::Web::Form::Element/new> can take.
sub new {
my $class = shift;
my $args = ref($_[0]) ? $_[0] : {@_};
- my ($root) = Jifty->web->request->request_uri =~ /([^\?]*)/;
my $self = $class->SUPER::new(
- { url => $root,
+ { url => Jifty->web->request->top_request->path,
label => "Click me!",
tooltip => undef,
escape_label => 1,
commit d0c380a6a4e5b5a338b95207b814b32246a85974
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Jan 8 23:00:43 2010 -0500
Add a test for the REQUEST_URI bug that d0c066e fixed by using ->path
diff --git a/t/TestApp/lib/TestApp/Dispatcher.pm b/t/TestApp/lib/TestApp/Dispatcher.pm
index c485c46..ddb6a01 100644
--- a/t/TestApp/lib/TestApp/Dispatcher.pm
+++ b/t/TestApp/lib/TestApp/Dispatcher.pm
@@ -116,5 +116,11 @@ before '/content-type-bug' => run {
};
+before '/someplace' => run {
+ my $result = Jifty::Result->new;
+ $result->action_class("TestApp::Action::DoSomething");
+ Jifty->web->response->result(foo => $result);
+ redirect '/otherplace';
+};
1;
diff --git a/t/TestApp/lib/TestApp/View.pm b/t/TestApp/lib/TestApp/View.pm
index 6614745..e4eb256 100644
--- a/t/TestApp/lib/TestApp/View.pm
+++ b/t/TestApp/lib/TestApp/View.pm
@@ -151,6 +151,8 @@ template 'use_mason_wrapper' => page {
};
-
+template 'otherplace' => page {
+ form { }
+};
1;
diff --git a/t/TestApp/t/09-redirect.t b/t/TestApp/t/09-redirect.t
index 862e704..6c7f20e 100644
--- a/t/TestApp/t/09-redirect.t
+++ b/t/TestApp/t/09-redirect.t
@@ -10,7 +10,7 @@ still get run.
=cut
-use Jifty::Test::Dist tests => 6;
+use Jifty::Test::Dist tests => 8;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
@@ -26,5 +26,9 @@ $mech->fill_in_action_ok('go', url => $URL."/index.html");
$mech->submit_html_ok();
like($mech->uri, qr|/index.html|, "At index");
+# Forms should submit to their current URL after a continuation call
+$mech->get_ok("$URL/someplace", "Explicit redirect");
+$mech->content_like(qr{action="/otherplace"});
+
1;
commit da3a61aafcfe9f6c302fd305a768b38f585ef2f4
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 8 21:14:19 2010 +0800
Jifty::Handler->psgi_app.
diff --git a/lib/Jifty/Handler.pm b/lib/Jifty/Handler.pm
index c161a4d..725dff5 100644
--- a/lib/Jifty/Handler.pm
+++ b/lib/Jifty/Handler.pm
@@ -111,6 +111,17 @@ sub view {
return $self->_view_handlers->{$class};
}
+=head2 psgi_app
+
+Returns a closure for L<PSGI> application.
+
+=cut
+
+sub psgi_app {
+ my $self = shift;
+ return sub { $self->handle_request(@_) };
+}
+
=head2 handle_request
When your server processs (be it Jifty-internal, FastCGI or anything
diff --git a/lib/Jifty/Script/Server.pm b/lib/Jifty/Script/Server.pm
index 8b75f25..5e9806f 100755
--- a/lib/Jifty/Script/Server.pm
+++ b/lib/Jifty/Script/Server.pm
@@ -197,10 +197,8 @@ sub _run_server {
my %args = ( port => $port );
$args{$_} = $self->{$_} for grep defined $self->{$_}, qw/host user group/;
- my $app = sub { Jifty->handler->handle_request(@_) };
-
$Jifty::SERVER = Plack::Loader->load('Standalone', %args);
- $Jifty::SERVER->run($app);
+ $Jifty::SERVER->run(Jifty->handler->psgi_app);
}
sub _stop {
commit b05b1fba1e9bc0f833fd24505d048f98ff997fb1
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 8 21:15:51 2010 +0800
Remove Jifty::Server::*
diff --git a/lib/Jifty/Server/Fork.pm b/lib/Jifty/Server/Fork.pm
deleted file mode 100644
index e0c53bb..0000000
--- a/lib/Jifty/Server/Fork.pm
+++ /dev/null
@@ -1,28 +0,0 @@
-package Jifty::Server::Fork;
-use Net::Server::Fork ();
-use base 'Jifty::Server';
-
-=head1 NAME
-
-Jifty::Server::Fork - Jifty::Server that supports multiple connections
-
-=head1 SYNOPSIS
-
-In your F<etc/config.yml>:
-
- framework:
- Web:
- ServerClass: Jifty::Server::Fork
-
-=head1 METHODS
-
-=head2 net_server
-
-This module depends on the L<Net::Server::Fork> module, which is part of
-the L<Net::Server> CPAN distribution.
-
-=cut
-
-sub net_server { 'Jifty::Server::Fork::NetServer' }
-
-1;
diff --git a/lib/Jifty/Server/Fork/NetServer.pm b/lib/Jifty/Server/Fork/NetServer.pm
deleted file mode 100644
index 2a10ac3..0000000
--- a/lib/Jifty/Server/Fork/NetServer.pm
+++ /dev/null
@@ -1,70 +0,0 @@
-package Jifty::Server::Fork::NetServer;
-
-use base 'Net::Server::Fork';
-
-=head1 NAME
-
-Jifty::Server::Fork::NetServer - Sets up children for Jifty::Server::Fork
-
-=head1 METHODS
-
-=head2 new
-
-Store the created L<Net::Server::Fork> object away after creating it.
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = $class->SUPER::new(@_);
- $Jifty::SERVER->{net_server} = $self;
- return $self;
-}
-
-=head2 pre_loop_hook
-
-Tear down the database connection before falling into the accept loop,
-so that there is no shared database connection for children to
-inherit.
-
-=cut
-
-sub pre_loop_hook {
- Jifty->handle(undef);
-}
-
-=head2 post_accept_hook
-
-After forking every connection, resetup the database connections.
-
-=cut
-
-sub post_accept_hook {
- Jifty->setup_database_connection;
-}
-
-=head2 log
-
-Log messages should use Jifty's L<Log::Log4perl> infrastructure, not
-STDERR.
-
-=cut
-
-sub log {
- my $self = shift;
- my ($level, $msg) = @_;
- chomp $msg;
- my @levels = (
- $Log::Log4perl::FATAL,
- $Log::Log4perl::WARN,
- $Log::Log4perl::INFO,
- $Log::Log4perl::DEBUG,
- $Log::Log4perl::TRACE,
- $Log::Log4perl::TRACE,
- );
- $Log::Log4perl::caller_depth++;
- Log::Log4perl->get_logger(ref $self)->log($levels[$level],$msg);
- $Log::Log4perl::caller_depth--;
-}
-
-1;
diff --git a/lib/Jifty/Server/Prefork.pm b/lib/Jifty/Server/Prefork.pm
deleted file mode 100644
index 0b847fe..0000000
--- a/lib/Jifty/Server/Prefork.pm
+++ /dev/null
@@ -1,29 +0,0 @@
-package Jifty::Server::Prefork;
-use Net::Server::PreFork ();
-use base 'Jifty::Server';
-
-=head1 NAME
-
-Jifty::Server::Prefork - Jifty::Server that supports multiple connections
-
-=head1 SYNOPSIS
-
-In your F<etc/config.yml>:
-
- framework:
- Web:
- ServerClass: Jifty::Server::Prefork
-
-=head1 METHODS
-
-=head2 net_server
-
-This module depends on the L<Net::Server::PreFork> module, which is part of
-the L<Net::Server> CPAN distribution.
-
-=cut
-
-sub net_server { 'Jifty::Server::Prefork::NetServer' }
-
-
-1;
diff --git a/lib/Jifty/Server/Prefork/NetServer.pm b/lib/Jifty/Server/Prefork/NetServer.pm
deleted file mode 100644
index a53e992..0000000
--- a/lib/Jifty/Server/Prefork/NetServer.pm
+++ /dev/null
@@ -1,70 +0,0 @@
-package Jifty::Server::Prefork::NetServer;
-
-use base 'Net::Server::PreFork';
-
-=head1 NAME
-
-Jifty::Server::Prefork::NetServer - Sets up children for Jifty::Server::Prefork
-
-=head1 METHODS
-
-=head2 new
-
-Store the created L<Net::Server::PreFork> object away after creating it.
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = $class->SUPER::new(@_);
- $Jifty::SERVER->{net_server} = $self;
- return $self;
-}
-
-=head2 pre_loop_hook
-
-Tear down the database connection before falling into the accept loop,
-so that there is no shared database connection for children to
-inherit.
-
-=cut
-
-sub pre_loop_hook {
- Jifty->handle(undef);
-}
-
-=head2 child_init_hook
-
-Sets up the database connection when spawning a new child.
-
-=cut
-
-sub child_init_hook {
- Jifty->setup_database_connection;
-}
-
-=head2 log
-
-Log messages should use Jifty's L<Log::Log4perl> infrastructure, not
-STDERR.
-
-=cut
-
-sub log {
- my $self = shift;
- my ($level, $msg) = @_;
- chomp $msg;
- my @levels = (
- $Log::Log4perl::FATAL,
- $Log::Log4perl::WARN,
- $Log::Log4perl::INFO,
- $Log::Log4perl::DEBUG,
- $Log::Log4perl::TRACE,
- $Log::Log4perl::TRACE,
- );
- $Log::Log4perl::caller_depth++;
- Log::Log4perl->get_logger(ref $self)->log($levels[$level],$msg);
- $Log::Log4perl::caller_depth--;
-}
-
-1;
commit 2a760d3780f8692d70f2cdb3303d21c596648368
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 8 21:16:59 2010 +0800
at end of test, only check TestServerWarnings if the test server has TD view enabled.
diff --git a/lib/Jifty/Test.pm b/lib/Jifty/Test.pm
index f16b122..702bdfa 100644
--- a/lib/Jifty/Test.pm
+++ b/lib/Jifty/Test.pm
@@ -658,7 +658,9 @@ sub _ending {
return if $Test->{Original_Pid} != $$;
my $should_die = 0;
- if ($Jifty::SERVER && (my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings"))) {
+ if ($Jifty::SERVER &&
+ (my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings")) &&
+ grep { $_ eq 'Jifty::View::Declare::Handler' } Jifty->handler->view_handlers) { # testserverwarnings plugin requires TD handler to work properly.
my @warnings = $plugin->decoded_warnings( 'http://localhost:'.$Jifty::SERVER->port );
$Test->diag("Uncaught warning: $_") for @warnings;
commit 744673bcca98e6c8b24b0bb95869715d4b9f00d5
Author: Chia-liang Kao <clkao at clkao.org>
Date: Sun Jan 10 20:19:34 2010 +0800
Let Jifty::Test->import do plan() for us.
diff --git a/lib/Jifty/Test/WWW/Declare.pm b/lib/Jifty/Test/WWW/Declare.pm
index e8cdaca..fd32d2e 100644
--- a/lib/Jifty/Test/WWW/Declare.pm
+++ b/lib/Jifty/Test/WWW/Declare.pm
@@ -14,11 +14,8 @@ sub import
{
my $class = shift;
- # examine the plan
- Test::More->import(@_);
-
# set up database and other things
- Jifty::Test->setup(\@_);
+ Jifty::Test->import(@_);
# export the DSL-ey functions
Test::WWW::Declare->export_to_level(2);
commit e282bdae5cd67ee53d7aae40beb599f37bde3383
Author: Chia-liang Kao <clkao at clkao.org>
Date: Sun Jan 10 20:56:08 2010 +0800
Make Jifty test work with psgi inline and forked test server.
diff --git a/Makefile.PL b/Makefile.PL
index ea6dc1a..02a69b5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -118,7 +118,6 @@ feature 'Development of a jifty application' =>
recommends('DBD::SQLite' => 1.11),
recommends('Test::Base' => 0.44), # Test::Base::Filter
recommends('Module::Install::Admin' => '0.50'),
- recommends('Test::HTTP::Server::Simple' => '0.10'),
recommends('Test::HTML::Lint' => 0),
recommends('Test::MockModule' => '0.05'),
recommends('Test::MockObject' => '1.07'),
diff --git a/lib/Jifty.pm b/lib/Jifty.pm
index c835cb8..9df681b 100644
--- a/lib/Jifty.pm
+++ b/lib/Jifty.pm
@@ -538,7 +538,7 @@ sub background {
} else {
close STDOUT;
close STDIN;
- $Jifty::SERVER->close_client_sockets if $Jifty::SERVER;
+ # XXX: make $Jifty::SERVER close client sockets if exists
Jifty->handle->dbh->{InactiveDestroy} = 1;
Jifty->setup_database_connection();
$sub->();
diff --git a/lib/Jifty/Everything.pm b/lib/Jifty/Everything.pm
index 8ad1ae5..6918c1a 100644
--- a/lib/Jifty/Everything.pm
+++ b/lib/Jifty/Everything.pm
@@ -69,11 +69,6 @@ use Jifty::Result ();
use Jifty::Response ();
use Jifty::CurrentUser ();
-# We can _not_ load Server.pm unless we're in a Server context because
-# HTTP::Server::Simple::Mason bastardizes HTML::Mason::FakeApache::send_http_header
-# with hook::lexwrap
-#use Jifty::Server;
-
use Jifty::Web ();
use Jifty::Web::Session ();
use Jifty::Web::PageRegion ();
diff --git a/lib/Jifty/Plugin/Config/View.pm b/lib/Jifty/Plugin/Config/View.pm
index 3aafd37..d82c82b 100644
--- a/lib/Jifty/Plugin/Config/View.pm
+++ b/lib/Jifty/Plugin/Config/View.pm
@@ -102,7 +102,7 @@ EOF
};
Jifty->handler->buffer->flush_output();
- $Jifty::SERVER->restart;
+ # XXX: hook into plack::loader to restart server
};
1;
diff --git a/lib/Jifty/Plugin/TestServerWarnings.pm b/lib/Jifty/Plugin/TestServerWarnings.pm
index bf39182..d170350 100644
--- a/lib/Jifty/Plugin/TestServerWarnings.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings.pm
@@ -125,7 +125,8 @@ sub decoded_warnings {
my $base = shift;
my $Test = Jifty::Test->builder;
- if ($Test->{Original_Pid} == $$) {
+
+ if ($Jifty::SERVER && $Jifty::SERVER->isa('Jifty::TestServer::Inline')) {
return splice @{ $self->{'stashed_warnings'} };
}
diff --git a/lib/Jifty/Server.pm b/lib/Jifty/Server.pm
deleted file mode 100644
index 29f894b..0000000
--- a/lib/Jifty/Server.pm
+++ /dev/null
@@ -1,177 +0,0 @@
-use warnings;
-use strict;
-
-package Jifty::Server;
-
-=head1 NAME
-
-Jifty::Server - Stand-alone server implementation for Jifty
-
-=head1 SYNOPSIS
-
- use Jifty::Server;
- my $server = Jifty::Server->new();
- $server->run();
-
-=head1 DESCRIPTION
-
-C<Jifty::Server> is a subclass of L<HTTP::Server::Simple> which
-creates a handy standalone web server for a lightweight Jifty application.
-
-=cut
-
-
-use base qw/HTTP::Server::Simple::CGI Jifty::Object/;
-use File::Spec;
-use Log::Log4perl;
-use HTTP::Server::Simple;
-use HTTP::Server::Simple::Recorder;
-
-=head1 METHODS
-
-=head2 new
-
-Creates a new C<Jifty::Server> object.
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = {};
- bless $self, $class;
- $self->setup_jifty(@_);
- $self->recording_on if $ENV{'JIFTY_RECORD'};
-
- return ($self);
-}
-
-=head2 setup_jifty
-
-Sets up the Jifty singleton. This is called automatically by L</new>.
-
-=cut
-
-sub setup_jifty {
- my $self = shift;
- my %args = (
- port => undef,
- @_
- );
-
- Jifty->config->framework('Web')->{'Port'} = $args{port} if $args{port};
- $self->port( Jifty->config->framework('Web')->{'Port'} || 8888 );
-}
-
-=head2 handle_request CGI
-
-Calls L<Jifty::Handler/handle_request> with the CGI object. If
-running tests, send test warnings on specific requests.
-
-=cut
-
-sub handle_request {
- my $self = shift;
- my $cgi = shift;
-
- Jifty->handler->handle_request( cgi => $cgi );
-}
-
-=head2 print_banner
-
-Overrives L<HTML::Server::Simple::Mason>'s print_banner to use the
-logging framework to record the server's startup
-
-=cut
-
-sub print_banner {
- my $self = shift;
- $self->log->info("You can connect to your server at ", Jifty::Web->url);
-}
-
-=head2 recorder_prefix
-
-Returns the filename prefix used if L<HTTP::Server::Simple::Recorder> support is being used.
-
-=cut
-
-sub recorder_prefix {
- # XXX TODO FIXME get from config
- Jifty::Util->absolute_path("log/recorded/jifty-recorded.$$")
-}
-
-=head2 recording_on
-
-Sets this server to use L<HTTP::Server::Simple::Recorder>.
-
-(See also the C<JIFTY_RECORD> environment variable and the C<-r> switch to C<standalone_server>.)
-
-=cut
-
-sub recording_on {
- my $class = shift;
- our @ISA;
- unshift @ISA, "HTTP::Server::Simple::Recorder" unless $class->isa('HTTP::Server::Simple::Recorder');
-}
-
-=head2 after_setup_listener
-
-If C<$ENV{JIFTY_SERVER_SIGREADY}> is set, send the signal to the
-parent when the server is ready for requests.
-
-=cut
-
-sub after_setup_listener {
- my $self = shift;
-
- my $sig = $ENV{JIFTY_SERVER_SIGREADY} or return;
- kill $sig => getppid();
-}
-
-=head2 restart
-
-Sets up the arguments needed for restarting the server using C<jifty server>.
-
-=cut
-
-sub restart {
- my $self = shift;
- local @ARGV = ( 'server', '--restart' );
- $self->SUPER::restart;
-}
-
-=head2 close_client_sockets
-
-Closes all active client connections.
-
-=cut
-
-sub close_client_sockets {
- my $self = shift;
- close STDOUT;
- close STDIN;
- if ($self->{net_server}) {
- close $self->{net_server}{server}{client};
- } else {
- close $self->{_stdio_handle};
- }
-}
-
-=head2 started_ok
-
-After starting, ensure we have a different database socket from the
-server.
-
-=cut
-
-sub started_ok {
- my $self = shift;
- my $ret = $self->SUPER::started_ok(@_);
- if ($ret) {
- Jifty->handle->dbh->{InactiveDestroy} = 1;
- Jifty->setup_database_connection;
- }
- return $ret;
-}
-
-1;
-
diff --git a/lib/Jifty/Test.pm b/lib/Jifty/Test.pm
index 702bdfa..d832cb5 100644
--- a/lib/Jifty/Test.pm
+++ b/lib/Jifty/Test.pm
@@ -14,10 +14,6 @@ use Hash::Merge;
use Digest::MD5 qw/md5_hex/;
use Cwd qw/abs_path cwd/;
-# this is required here because we want Test::HTTP::Server::Simple's
-# END to be at the very last, later than Jifty::Test's
-use Test::HTTP::Server::Simple;
-
=head1 NAME
Jifty::Test - Jifty's test module
@@ -194,6 +190,19 @@ sub setup {
$args ||= [];
my %args = @{$args} % 2 ? (@{$args}, 1) : @{$args};
+ my $server = $ENV{JIFTY_TEST_SERVER} ||= 'Inline';
+
+ if ($server eq 'Inline') {
+ require Jifty::Test::WWW::Mechanize;
+ require Test::WWW::Mechanize::PSGI;
+ unshift @Jifty::Test::WWW::Mechanize::ISA, 'Test::WWW::Mechanize::PSGI';
+ }
+
+ if ($args{actual_server}) {
+ $class->builder->plan(skip_all => "This test requires an actual test server to run. Run with JIFTY_TEST_SERVER=Standalone instead")
+ if $ENV{JIFTY_TEST_SERVER} eq 'Inline';
+ }
+
# Spit out a plan (if we got one) *before* we load modules, in
# case of compilation errors
unless ($class->builder->has_plan) {
@@ -203,7 +212,6 @@ sub setup {
# Require the things we need
require Jifty::YAML;
- require Jifty::Server;
require Jifty::Script::Schema;
$class->builder->{no_handle} = $args{no_handle};
@@ -448,36 +456,22 @@ sub _testfile_to_dbname {
=head2 make_server
-Creates a new L<Jifty::Server> which C<ISA> L<Jifty::TestServer> and
-returns it.
+Creates a new L<Jifty::TestServer> depending on the value of
+$ENV{JIFTY_TEST_SERVER}. If the environment variable is unset or
+C<Inline>, we run tests using PSGI inline wihtout spawning an actual
+server. Otherwise, we fork off a Plack::Server to run tests against.
=cut
sub make_server {
my $class = shift;
+ use Jifty::TestServer;
- # XXX: Jifty::TestServer is not a Jifty::Server, it is actually
- # server controller that invokes bin/jifty server. kill the
- # unshift here once we fix all the tests expecting it to be
- # jifty::server.
- if ($ENV{JIFTY_TESTSERVER_PROFILE} ||
- $ENV{JIFTY_TESTSERVER_COVERAGE} ||
- $ENV{JIFTY_TESTSERVER_DBIPROF} ||
- $^O eq 'MSWin32') {
- require Jifty::TestServer;
- unshift @Jifty::Server::ISA, 'Jifty::TestServer';
- } elsif ($ENV{JIFTY_APACHETEST}) {
- require Jifty::TestServer::Apache;
- unshift @Jifty::Server::ISA, 'Jifty::TestServer::Apache';
- }
- else {
- require Jifty::TestServer::Plack;
- unshift @Jifty::Server::ISA, 'Jifty::TestServer::Plack';
- }
+ my $server_class = $ENV{JIFTY_TEST_SERVER} eq 'Inline'
+ ? 'Jifty::TestServer::Inline' : 'Jifty::TestServer';
+ Jifty::Util->require($server_class) or die $!;
- my $server = Jifty::Server->new;
- $Jifty::SERVER = $server;
- return $server;
+ $Jifty::SERVER = $server_class->new;
}
=head2 web
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index ffce267..8a2a47b 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -2,7 +2,7 @@ use strict;
use warnings;
package Jifty::Test::WWW::Mechanize;
-use base qw/Test::WWW::Mechanize::PSGI/;
+use base qw/Test::WWW::Mechanize/;
delete $ENV{'http_proxy'}; # Otherwise Test::WWW::Mechanize tries to go through your HTTP proxy
@@ -37,11 +37,15 @@ bot a cookie jar.
=cut
+my $plack_server_pid;
+
sub new {
- my $class = shift;
- my $app = sub { Jifty->handler->handle_request(@_) };
+ my ($class, @args) = @_;
+
+ push @args, app => Jifty->handler->psgi_app
+ if $class->isa('Test::WWW::Mechanize::PSGI');
- my $self = $class->SUPER::new(@_, app => $app);
+ my $self = $class->SUPER::new(@args);
$self->cookie_jar(HTTP::Cookies->new);
return $self;
diff --git a/lib/Jifty/TestServer.pm b/lib/Jifty/TestServer.pm
index a3fdee8..17d165a 100644
--- a/lib/Jifty/TestServer.pm
+++ b/lib/Jifty/TestServer.pm
@@ -1,10 +1,14 @@
package Jifty::TestServer;
+use Any::Moose;
use strict;
use warnings;
use File::Spec;
use Test::Builder;
use Test::Script::Run 'get_perl_cmd';
+use Plack::Loader;
+
+has port => (is => "rw", isa => "Int");
=head1 NAME
@@ -21,6 +25,12 @@ return the URL.
=cut
+sub BUILD {
+ my $self = shift;
+ Jifty->config->framework('Web')->{'Port'} = $self->port if $self->port;
+ $self->port( Jifty->config->framework('Web')->{'Port'} || 8888 );
+}
+
sub started_ok {
my $self = shift;
my $text = shift;
@@ -45,12 +55,23 @@ sub started_ok {
exit(0);
}
+ $self->{plack_server} = Plack::Loader->load
+ ($ENV{JIFTY_TEST_SERVER},
+ port => $self->port,
+ server_ready => sub {
+ kill 'USR1' => getppid();
+ });
+ $Jifty::SERVER = $self;
+
if (my $pid = fork()) {
- # We are expecting a USR1 from the child Jifty::Server
- # after it's ready to listen.
- $SIG{USR1} = sub { };
+ # We are expecting a USR1 from the child process after it's
+ # ready to listen.
+ my $handled;
+ $SIG{USR1} = sub { $handled = 1};
sleep 15;
- $self->{started} = 1;
+ Test::More::diag "did not get expected USR1 for test server readiness"
+ unless $handled;
+ $self->{cleanup} = [sub { kill TERM => $pid }];
my $Tester = Test::Builder->new;
$Tester->ok(1, $text);
# XXX: pull from jifty::config maybe
@@ -66,28 +87,14 @@ sub started_ok {
or die "Can't start a new session: $!";
}
- my @extra;
- if (my $profile_file = $ENV{JIFTY_TESTSERVER_PROFILE}) {
- push @extra, '-d:DProf';
- $ENV{"PERL_DPROF_OUT_FILE_NAME"} = $profile_file;
- }
- if ($ENV{JIFTY_TESTSERVER_NAMED_ACCESSOR}) {
- push @extra, '-MClass::Accessor::Named';
- }
- if (my $coverage = $ENV{JIFTY_TESTSERVER_COVERAGE}) {
- push @extra, '-MDevel::Cover'.($coverage =~ m/,/ ? "=$coverage" : '');
- }
-
- exec(get_perl_cmd(), @extra, '-MJifty::Util', '-MJifty::Script',
- '-e', 'Jifty::Script->dispatch', 'server', '--quiet',
- '--sigready', 'USR1',
- $ENV{JIFTY_TESTSERVER_DBIPROF} ? ('--dbiprof') : (),
- );
+ $self->{plack_server}->run(Jifty->handler->psgi_app);
+ exit;
}
-sub DESTROY {
- return unless $_[0]->{started};
- exec(get_perl_cmd('jifty'), 'server', '--stop');
+sub DEMOLISH {
+ $_->() for @{$_[0]->{cleanup}}
}
+__PACKAGE__->meta->make_immutable;
+no Any::Moose;
1;
diff --git a/lib/Jifty/TestServer/Apache.pm b/lib/Jifty/TestServer/Apache.pm
deleted file mode 100644
index 5e60b3a..0000000
--- a/lib/Jifty/TestServer/Apache.pm
+++ /dev/null
@@ -1,103 +0,0 @@
-package Jifty::TestServer::Apache;
-
-use strict;
-use warnings;
-use File::Spec;
-use Test::Builder;
-
-# explicitly ignore ClassLoader objects in @INC,
-# which'd be ignored in the end, though.
-my $INC = [grep { defined } map { File::Spec->rel2abs($_) } grep { !ref } @INC ];
-
-=head1 NAME
-
-Jifty::TestServer::Apache - Starting and stopping an apache server for tests
-
-=head1 DESCRIPTION
-
-=head1 METHOD
-
-=head2 started_ok
-
-Like started_ok in C<Test::HTTP::Server::Simple>, start the server and
-return the URL.
-
-=cut
-
-sub started_ok {
- my $self = shift;
- my $text = shift;
- $text = 'started server' unless defined $text;
-
- $self->{pidfile} = File::Temp->new;
- close $self->{pidfile};
- $self->{pidfile} .= "";
- my $ipc = File::Temp::tempdir( CLEANUP => 1 );
- my $errorlog = File::Temp->new;
- my $config = File::Temp->new;
-
- my $PATH = Jifty::Util->absolute_path("bin/jifty");
- my $STATIC = Jifty::Util->absolute_path(Jifty->config->framework('Web')->{StaticRoot});
-
- print $config <<"CONFIG";
-ServerName 127.0.0.1
-Port @{[$self->port]}
-User @{[scalar getpwuid($<)]}
-Group @{[scalar getgrgid($()]}
-MinSpareServers 1
-StartServers 1
-PidFile @{[$self->{pidfile}]}
-ErrorLog $errorlog
-<Location />
- Options FollowSymLinks ExecCGI
-</Location>
-FastCgiIpcDir $ipc
-FastCgiServer $PATH -initial-env JIFTY_COMMAND=fastcgi -idle-timeout 300 -processes 1 -initial-env PERL5LIB=@{[join(":",@{$INC})]}
-ScriptAlias / $PATH/
-Alias /static/ $STATIC/
-CONFIG
- close $config;
-
- if (fork()) {
- my $pid;
- for (1..15) {
- last if $pid = $self->pids;
- sleep 1;
- }
- my $Tester = Test::Builder->new;
- if ($pid) {
- $self->{started} = 1;
- $Tester->ok(1, $text);
- return "http://localhost:".$self->port;
- } else {
- $Tester->ok(0, $text);
- return "";
- }
- }
-
- exec($ENV{JIFTY_APACHETEST}, "-f", $config);
-}
-
-=head2 pids
-
-Returns the process ID of the Apache server.
-
-=cut
-
-sub pids {
- my $self = shift;
- return unless -e $self->{pidfile};
- my $pid = do {local @ARGV = ($self->{pidfile}); scalar <>};
- chomp $pid;
- return ($pid);
-}
-
-sub DESTROY {
- return unless $_[0]->{started};
- my($pid) = $_[0]->pids;
- kill(15, $pid) if $pid;
- 1 while ($_ = wait()) >= 0;
- sleep 1 while kill(0, $pid);
-}
-
-1;
diff --git a/lib/Jifty/TestServer/Inline.pm b/lib/Jifty/TestServer/Inline.pm
new file mode 100644
index 0000000..0fd5039
--- /dev/null
+++ b/lib/Jifty/TestServer/Inline.pm
@@ -0,0 +1,15 @@
+package Jifty::TestServer::Inline;
+use Any::Moose;
+extends 'Jifty::TestServer';
+use Test::More;
+
+sub started_ok {
+ my $self = shift;
+ my $port = $self->port;
+ ok(1, "psgi test server ok");
+ return "http://localhost:$port";
+}
+
+__PACKAGE__->meta->make_immutable;
+no Any::Moose;
+1;
diff --git a/lib/Jifty/TestServer/Plack.pm b/lib/Jifty/TestServer/Plack.pm
deleted file mode 100644
index 850a5b1..0000000
--- a/lib/Jifty/TestServer/Plack.pm
+++ /dev/null
@@ -1,14 +0,0 @@
-package Jifty::TestServer::Plack;
-use strict;
-use warnings;
-use base 'Test::HTTP::Server::Simple';
-use Test::More;
-
-sub started_ok {
- my $self = shift;
- my $port = $self->port;
- ok(1, "plack test server ok");
- return "http://localhost:$port";
-}
-
-1;
diff --git a/t/08-client.t b/t/08-client.t
index 48ac6af..b803091 100644
--- a/t/08-client.t
+++ b/t/08-client.t
@@ -1,17 +1,12 @@
use warnings;
use strict;
-use Jifty::Test tests => 4;
+use Jifty::Test tests => 4, actual_server => 1;
use_ok ('Jifty::Client');
my $server=Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
-
-if ($server->isa('Jifty::TestServer::Plack')) {
- Jifty::Test->builder->todo_skip("This test is not using the test framework, and requires a server to connect to. This doesn't work yet") for 1..2;
- exit 0;
-}
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
diff --git a/t/TestApp-Dispatcher/t/00-basic.t b/t/TestApp-Dispatcher/t/00-basic.t
index 68a24e6..871f275 100644
--- a/t/TestApp-Dispatcher/t/00-basic.t
+++ b/t/TestApp-Dispatcher/t/00-basic.t
@@ -9,7 +9,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
ok($server, 'got a server');
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Dispatcher/t/on.t b/t/TestApp-Dispatcher/t/on.t
index de8487a..69315ec 100644
--- a/t/TestApp-Dispatcher/t/on.t
+++ b/t/TestApp-Dispatcher/t/on.t
@@ -9,7 +9,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
ok($server, 'got a server');
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Dispatcher/t/under.t b/t/TestApp-Dispatcher/t/under.t
index dc695c8..351e219 100644
--- a/t/TestApp-Dispatcher/t/under.t
+++ b/t/TestApp-Dispatcher/t/under.t
@@ -8,7 +8,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
ok($server, 'got a server');
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Mason/t/content.t b/t/TestApp-Mason/t/content.t
index b25327b..bb35f93 100644
--- a/t/TestApp-Mason/t/content.t
+++ b/t/TestApp-Mason/t/content.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
$mech->get_ok($URL . '/outer');
diff --git a/t/TestApp-Mason/t/index_vs_dhandler.t b/t/TestApp-Mason/t/index_vs_dhandler.t
index 021b4e1..7f3af18 100644
--- a/t/TestApp-Mason/t/index_vs_dhandler.t
+++ b/t/TestApp-Mason/t/index_vs_dhandler.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
$mech->get_ok($URL . '/foo');
diff --git a/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t b/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
index 35cfa29..7f031a6 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
@@ -14,7 +14,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t b/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t
index b6d0623..1dd392a 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t
@@ -40,7 +40,7 @@ is($bob->user_object->mygroup, 'admin', "The CurrentUser group is admin");
ok($bob->is_superuser, "CurrentUser is a superuser");
#my $server = Jifty::Test->make_server;
-#isa_ok($server, 'Jifty::Server');
+#isa_ok($server, 'Jifty::TestServer');
#my $URL = $server->started_ok;
#my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t b/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
index d2afec5..4c1fa1a 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
@@ -17,7 +17,7 @@ use LWP::UserAgent;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-PasswordAuth/t/12-signup.t b/t/TestApp-Plugin-PasswordAuth/t/12-signup.t
index 4575949..14e8457 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/12-signup.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/12-signup.t
@@ -14,7 +14,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-REST/t/02-basic-use.t b/t/TestApp-Plugin-REST/t/02-basic-use.t
index d40bfb4..5ac2e0e 100644
--- a/t/TestApp-Plugin-REST/t/02-basic-use.t
+++ b/t/TestApp-Plugin-REST/t/02-basic-use.t
@@ -14,7 +14,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-REST/t/03-format.t b/t/TestApp-Plugin-REST/t/03-format.t
index 50e440c..f6525f8 100644
--- a/t/TestApp-Plugin-REST/t/03-format.t
+++ b/t/TestApp-Plugin-REST/t/03-format.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist tests => 102;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-SetupWizard/t/001-basic.t b/t/TestApp-Plugin-SetupWizard/t/001-basic.t
index cee9446..f9ccad1 100644
--- a/t/TestApp-Plugin-SetupWizard/t/001-basic.t
+++ b/t/TestApp-Plugin-SetupWizard/t/001-basic.t
@@ -4,7 +4,7 @@ use TestApp::Plugin::SetupWizard::Test tests => 14;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Regions/t/01-region.t b/t/TestApp-Regions/t/01-region.t
index d7267ed..1d5ed2b 100644
--- a/t/TestApp-Regions/t/01-region.t
+++ b/t/TestApp-Regions/t/01-region.t
@@ -5,7 +5,7 @@ use Jifty::Test::Dist tests => 5;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
diff --git a/t/TestApp-Template-Declare/t/td.t b/t/TestApp-Template-Declare/t/td.t
index 2dc4953..482f6ce 100644
--- a/t/TestApp-Template-Declare/t/td.t
+++ b/t/TestApp-Template-Declare/t/td.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
plan tests => 9;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
diff --git a/t/TestApp/t/02-dispatch-http.t b/t/TestApp/t/02-dispatch-http.t
index 60bbb46..0ea01cf 100644
--- a/t/TestApp/t/02-dispatch-http.t
+++ b/t/TestApp/t/02-dispatch-http.t
@@ -10,7 +10,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/02-dispatch-https.t b/t/TestApp/t/02-dispatch-https.t
index 1b61305..f3d1522 100644
--- a/t/TestApp/t/02-dispatch-https.t
+++ b/t/TestApp/t/02-dispatch-https.t
@@ -9,11 +9,11 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
-$URL =~ s/http:/https:/;
+#$URL =~ s/http:/https:/;
$mech->get_ok("$URL/dispatch/protocol", "Got /dispatch/protocol");
$mech->content_contains("HTTPS");
diff --git a/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t b/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t
index 52932e4..e702dea 100644
--- a/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t
+++ b/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/02-dispatch.t b/t/TestApp/t/02-dispatch.t
index c4a0414..10df8ef 100644
--- a/t/TestApp/t/02-dispatch.t
+++ b/t/TestApp/t/02-dispatch.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/03-static.t b/t/TestApp/t/03-static.t
index 3b2eb5c..87a861a 100644
--- a/t/TestApp/t/03-static.t
+++ b/t/TestApp/t/03-static.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/05-actions-before-redirect.pm b/t/TestApp/t/05-actions-before-redirect.pm
index 97c7978..b15a989 100644
--- a/t/TestApp/t/05-actions-before-redirect.pm
+++ b/t/TestApp/t/05-actions-before-redirect.pm
@@ -17,7 +17,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/05-editactions-Cachable.t b/t/TestApp/t/05-editactions-Cachable.t
index c933604..f80eb16 100644
--- a/t/TestApp/t/05-editactions-Cachable.t
+++ b/t/TestApp/t/05-editactions-Cachable.t
@@ -22,7 +22,7 @@ ok($id, "User create returned success");
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/05-editactions-Record.t b/t/TestApp/t/05-editactions-Record.t
index 1fe3983..cc9c153 100644
--- a/t/TestApp/t/05-editactions-Record.t
+++ b/t/TestApp/t/05-editactions-Record.t
@@ -22,7 +22,7 @@ is($o->tasty, 1, "User is tasty");
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/06-validation.t b/t/TestApp/t/06-validation.t
index fa09a80..0496ecf 100644
--- a/t/TestApp/t/06-validation.t
+++ b/t/TestApp/t/06-validation.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/07-sandboxing.t b/t/TestApp/t/07-sandboxing.t
index d28d10c..e8cd1ad 100644
--- a/t/TestApp/t/07-sandboxing.t
+++ b/t/TestApp/t/07-sandboxing.t
@@ -2,19 +2,14 @@
use warnings;
use strict;
-use Jifty::Test::Dist tests => 125;
+use Jifty::Test::Dist tests => 125, actual_server => 1;
use Jifty::Test::WWW::Mechanize;
use Net::HTTP;
use URI;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
-
-if ($server->isa('Jifty::TestServer::Plack')) {
- Jifty::Test->builder->todo_skip("This test is not using the test framework, and requires a server to connect to. This doesn't work yet") for 1..124;
- exit 0;
-}
+isa_ok($server, 'Jifty::TestServer');
my $uri = URI->new($server->started_ok);
my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings");
diff --git a/t/TestApp/t/09-redirect.t b/t/TestApp/t/09-redirect.t
index 6c7f20e..74aac9c 100644
--- a/t/TestApp/t/09-redirect.t
+++ b/t/TestApp/t/09-redirect.t
@@ -15,7 +15,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/11-current_user.t b/t/TestApp/t/11-current_user.t
index bd12980..98af941 100644
--- a/t/TestApp/t/11-current_user.t
+++ b/t/TestApp/t/11-current_user.t
@@ -69,7 +69,7 @@ my $dt = Jifty::DateTime->from_epoch(epoch => time);
is($now->time_zone->name, 'America/Anchorage', "from_epoch correctly gets the user's timezone");
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/13-page-regions.t b/t/TestApp/t/13-page-regions.t
index 7227f3a..f61cdf2 100644
--- a/t/TestApp/t/13-page-regions.t
+++ b/t/TestApp/t/13-page-regions.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
diff --git a/t/TestApp/t/14-template-paths.t b/t/TestApp/t/14-template-paths.t
index 9ed366d..26ae51b 100644
--- a/t/TestApp/t/14-template-paths.t
+++ b/t/TestApp/t/14-template-paths.t
@@ -43,7 +43,7 @@ my @tests = (
plan tests => 2 + scalar(@tests) * 2;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
diff --git a/t/TestApp/t/15-template-subclass.t b/t/TestApp/t/15-template-subclass.t
index 565c1cb..8efa53a 100644
--- a/t/TestApp/t/15-template-subclass.t
+++ b/t/TestApp/t/15-template-subclass.t
@@ -62,7 +62,7 @@ new Region('$_[0]',{},'$_[1]',null,null);
plan tests => 2 + scalar(@tests) * 2;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
diff --git a/t/TestApp/t/16-template-region.t b/t/TestApp/t/16-template-region.t
index 7c6984b..aad9943 100644
--- a/t/TestApp/t/16-template-region.t
+++ b/t/TestApp/t/16-template-region.t
@@ -20,7 +20,7 @@ new Region('special',{'id':3},'/foo/item',null,null);
plan tests => 2 + scalar(@tests) * 2;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
use Test::LongString;
diff --git a/t/TestApp/t/17-template-region-internal-redirect.t b/t/TestApp/t/17-template-region-internal-redirect.t
index a39f752..e88f5c0 100644
--- a/t/TestApp/t/17-template-region-internal-redirect.t
+++ b/t/TestApp/t/17-template-region-internal-redirect.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist tests => 7;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
diff --git a/t/TestApp/t/18-test-www-declare.t b/t/TestApp/t/18-test-www-declare.t
index 17687e2..7e76273 100644
--- a/t/TestApp/t/18-test-www-declare.t
+++ b/t/TestApp/t/18-test-www-declare.t
@@ -9,11 +9,9 @@ BEGIN {
unless (eval { require Test::WWW::Declare }) {
plan skip_all => "Test::WWW::Declare isn't installed";
}
- plan skip_all => "This test is not using the test framework, and requires a server to connect to. This doesn't work yet";
-
}
-use Jifty::Test::WWW::Declare tests => 2;
+use Jifty::Test::WWW::Declare tests => 2, actual_server => 1;
# this is a duplication of t/TestApp/t/17-template-region-internal-redirect.t
# if the user sees failures here, then he either saw failures in t/17 OR
diff --git a/t/TestApp/t/20-error-pages.t b/t/TestApp/t/20-error-pages.t
index 5efeafb..9efd026 100644
--- a/t/TestApp/t/20-error-pages.t
+++ b/t/TestApp/t/20-error-pages.t
@@ -13,6 +13,8 @@ use Jifty::Test::Dist tests => 1 + 2 * 29;
use Jifty::Test::WWW::Mechanize;
my $URL = Jifty::Test->make_server->started_ok;
+#my $URL = $s->started_ok;
+diag $URL;
my $mech = Jifty::Test::WWW::Mechanize->new;
for my $path ("", "/td") {
diff --git a/t/TestApp/t/21-js-arguments.t b/t/TestApp/t/21-js-arguments.t
index dea072b..1447442 100644
--- a/t/TestApp/t/21-js-arguments.t
+++ b/t/TestApp/t/21-js-arguments.t
@@ -15,7 +15,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/crud.t b/t/TestApp/t/crud.t
index e5bf794..cf13fc3 100644
--- a/t/TestApp/t/crud.t
+++ b/t/TestApp/t/crud.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist tests => 3;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
diff --git a/t/TestApp/t/i18n-standalone.t b/t/TestApp/t/i18n-standalone.t
index 69d4dec..abea51c 100644
--- a/t/TestApp/t/i18n-standalone.t
+++ b/t/TestApp/t/i18n-standalone.t
@@ -12,7 +12,7 @@ use utf8;
use LWP::UserAgent;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $base = URI->new($server->started_ok);
commit b6ffecc72d1976e0dfaa272d19cfeff32d60f4c3
Author: Chia-liang Kao <clkao at clkao.org>
Date: Sun Jan 10 21:13:45 2010 +0800
Provide app.psgi for newly created apps.
diff --git a/lib/Jifty/Script/App.pm b/lib/Jifty/Script/App.pm
index 5e1a75d..0bf189c 100644
--- a/lib/Jifty/Script/App.pm
+++ b/lib/Jifty/Script/App.pm
@@ -98,6 +98,7 @@ sub run {
$self->_make_directories();
$self->_install_jifty_binary();
$self->_write_makefile();
+ $self->_write_dotpsgi();
$self->_write_config();
@@ -140,6 +141,17 @@ EOT
close MAKEFILE;
}
+sub _write_dotpsgi {
+ my $self = shift;
+ my $prefix = $self->prefix;
+ open(my $fh, ">$prefix/app.psgi") or die "Can't write app.psgi: $!";
+ print $fh <<"EOT";
+use Jifty;
+Jifty->new;
+Jifty->handler->psgi_app;
+EOT
+}
+
sub _make_directories {
my $self = shift;
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list