view release on metacpan or search on metacpan
lib/Plack/Handler/Stomp.pm view on Meta::CPAN
'psgi.url_scheme' => 'http',
'psgi.multithread' => 0,
'psgi.multiprocess' => 0,
'psgi.run_once' => 0,
'psgi.nonblocking' => 0,
'psgi.streaming' => 1,
'psgi.input' => do {
open my $input, '<', \($frame->body);
$input;
},
'psgi.errors' => Plack::Util::inline_object(
lib/Plack/Handler/Stomp.pm view on Meta::CPAN
'psgi.url_scheme' => 'http',
'psgi.multithread' => 0,
'psgi.multiprocess' => 0,
'psgi.run_once' => 0,
'psgi.nonblocking' => 0,
'psgi.streaming' => 1,
In addition, reading from C<psgi.input> will return the message body,
and writing to C<psgi.errors> will log via the L</logger> at level
C<error>.
view all matches for this distribution
view release on metacpan or search on metacpan
- Fix request_duration calculation for delayed responses (nfg)
0.001001 2018-02-08 22:16:54+01:00 Europe/Zurich
- Fix streaming server support
0.001000 2012-11-24 16:41:05 Europe/Zurich
- Initial release
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/AdaptFilehandleRead.pm view on Meta::CPAN
L<PSGI> allows for the body content to be a glob filehandle or a Filehandle
like object. For the later case the object must have a method C<getline>
which works as described in L<IO::Handle>. However sometimes you may have
a custom filehandle like object that support the common C<read> method. For
example many versions of L<Catalyst> allowed the body of a response to be a
glob or object that does C<read>. People might have written custom streaming
applications that had this C<read> method but not C<getline>. As a result
these custom Filehandle like objects are not compatible with the expectations
of L<PSGI>.
This middleware exists to help you convert such a custom made filehandle like
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Perl extension Plack::Middleware::AddDefaultCharset
0.02
- use response_cb for compatibility with streaming response
0.01
- initial release
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/BasicStyle.pm view on Meta::CPAN
=back
=head1 CAVEATS
This middleware only works with simple (non-streaming) responses,
where the body is an arrayref.
In other words, responses where the body is an IO::Handle, or
streaming/delayed responses are NOT supported and will be passed
through unchanged by this middleware.
=head1 SEE ALSO
L<http://bettermotherfuckingwebsite.com>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/BetterStackTrace.pm view on Meta::CPAN
use L<Plack::Middleware::HTTPExceptions> in the deployment mode as a
replacement, so that all the exceptions thrown from your application
still get caught and rendered as a 500 error response, rather than
crashing the web server.
Catching errors in streaming response is not supported.
This module is based on L<Plack::Middleware::StackTrace> and Better Errors for Ruby L<https://github.com/charliesome/better_errors>.
=head1 LICENSE
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/Cache/CHI.pm view on Meta::CPAN
}
sub call {
my ($self,$env) = @_;
## Pass-thru streaming responses
return $self->app->($env)
if ( ref $env eq 'CODE' );
## Localize trace for this request
local @trace = ();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/Cached.pm view on Meta::CPAN
}
# pass through and cache afterwards
my $response = $self->app_code->($env);
# streaming response
if (ref $response eq 'CODE') {
$response = $self->response_cb($response, sub {
my ($ret) = @_;
my $seen;
my $body = '';
lib/Plack/Middleware/Cached.pm view on Meta::CPAN
};
enable 'Cached', cache => $cache;
$app;
},
Caching delayed/streaming responses is supported as well.
=head1 CONFIGURATION
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
0.03 2014-12-13T12:38:25Z
- Add ability to expire cookie that sit on a path
0.02 Wed Feb 19 11:31:00 GMT 2014
- Fixed embarassing bug triggered by streaming responses
0.01 Tue Feb 18 10:33:24 GMT 2014
- initial release
view all matches for this distribution
view release on metacpan or search on metacpan
dist.ini
lib/Plack/Middleware/CustomErrorDocument.pm
t/00-compile.t
t/custom_error_document.t
t/error_document.t
t/error_document_streaming.t
t/errors/404.html
t/errors/500.html
t/root/error_404.html
t/root/error_404.jpg
t/root/error_404_special.html
view all matches for this distribution
view release on metacpan or search on metacpan
- Fixes UTF-8 issues when panels such as Env contains UTF-8 wide characters
(Thanks to tomyhero)
0.05 Sat Jan 30 00:24:39 PST 2010
- Major refactoring of middleware panels: Now panels are also middleware
- Support streaming interface as well (clkao)
- Added Session middleware panel
0.04 Tue 2009.12.15 22:25:16 CET (Marcel Gruenauer <marcel@cpan.org>)
- fixed 'uninitialized' warnings for undef values in vardump() (hanekomu)
- fix POD typos (hanekomu)
view all matches for this distribution
view release on metacpan or search on metacpan
| Content-Type | text/plain |
'-----------------+------------------------------------------------------'
LOG
, 'json body with content-type set deserialized properly'};
# Testing streaming responses
$log = "";
$handler = builder {
enable 'Plack::Middleware::DebugLogging',
logger => sub { $log .= $_[0]->{message}."" }, term_width => 80;
+-----------------+------------------------------------------------------+
| Content-Type | text/plain |
'-----------------+------------------------------------------------------'
LOG
, 'keywords and streaming responses work.'}
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
t/content_type.t
t/deflater.t
t/delayed.t
t/furl.t
t/no-clobber.t
t/streaming.t
t/vary.t
t/xno-compress.t
t/xskip-deflater.t
xt/perlcritic.t
xt/perlcriticrc
view all matches for this distribution
view release on metacpan or search on metacpan
README
lib/Plack/Middleware/Delay.pm
t/00-compile.t
t/01-basic.t
t/02-anyevent.t
t/03-streaming.t
xt/author/critic.t
xt/release/dist-manifest.t
xt/release/kwalitee.t
xt/release/pod-coverage.t
xt/release/pod-syntax.t
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/EasyHooks.pm view on Meta::CPAN
$app;
}
=head1 DESCRIPTION
Plack::Middleware::EasyHooks takes care of the complexities handling streaming
in PSGI middleware. Just provide hooks to be called before, during and after
the wrapped PSGI application.
The hooks are called in the following order (much simplified):
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/FormatOutput.pm view on Meta::CPAN
### Return handler that manage response
return Plack::Util::response_cb($res, sub {
my $res = shift;
if ( !Plack::Util::status_with_no_entity_body( $res->[0] ) && defined $res->[2] ){
### File handler streaming body
if ( Plack::Util::is_real_fh($res->[2]) ) {
return
}
### Set header
view all matches for this distribution
view release on metacpan or search on metacpan
META.json
README.md
author/requires.cpanm
cpanfile
ex/normal.psgi
ex/streaming.psgi
lib/Plack/Middleware/HTMLLint.pm
lib/Plack/Middleware/HTMLLint/Pluggable.pm
minil.toml
t/000_load.t
t/001_basic.t
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_responsetypes.t view on Meta::CPAN
200,
[ 'Content-Type' => 'image/png' ],
IO::File->new($fname,'<')
]) };
} elsif ( $env->{PATH_INFO} eq '/streaming.png' ) {
return sub {
my $writer = shift->(
[ 200, ['Content-Type' => 'image/png'] ]
);
my $fh = IO::File->new($fname,'<');
t/02_responsetypes.t view on Meta::CPAN
$writer->write($buf);
}
$writer->close;
};
} elsif ( $env->{PATH_INFO} eq '/streaming-empty-304.png' ) {
return sub {
my $writer = shift->(
[ 304, ['Content-Type' => 'image/png'] ]
);
$writer->close;
t/02_responsetypes.t view on Meta::CPAN
is $res->code, 200, 'Response HTTP status';
is $res->content_type, 'image/png', 'Response Content-Type';
};
subtest 'streaming response' => sub {
my $res = $cb->(GET "http://localhost/streaming_200x200.png");
is $res->code, 200, 'Response HTTP status';
is $res->content_type, 'image/png', 'Response Content-Type';
};
subtest 'streaming empty 304 response' => sub {
my $res = $cb->(GET "http://localhost/streaming-empty-304_200x200.png");
is $res->code, 304, 'Response HTTP status';
is $res->content_type, 'image/png', 'Response Content-Type';
is $res->content, '', 'Response body is empty';
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/JSONP/Headers.pm view on Meta::CPAN
returned as strings (repeatable headers are ignored) with one exception:
Link-headers are parsed and returned as array of C<<[ url, options ]>>
tuples.
Same as Plack::Middleware::JSONP this middleware only works with a
non-streaming response.
=head1 CONFIGURATION
=over 4
view all matches for this distribution
view release on metacpan or search on metacpan
my $app = sub {
my $env = shift;
use Log::Contextual qw(:log);
if ($env->{PATH_INFO} eq '/streaming') {
return sub {
my $r = shift;
log_fatal { "Streaming foo" };
$r->([ 200, [ 'Content-Type', 'text/plain' ], [ "Hello" ] ]);
};
is @logs, 1;
is $logs[0], "[fatal] Foo\n";
@logs = ();
$res = $cb->(GET "/streaming");
is $res->code, 200;
is $res->content, "Hello";
is @logs, 1;
is $logs[0], "[fatal] Streaming foo\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/MockProxyFrontend.pm view on Meta::CPAN
'psgi.version' => $env->{'psgi.version'},
# constants
'psgi.run_once' => Plack::Util::TRUE,
'psgi.multithread' => Plack::Util::FALSE,
'psgi.multiprocess' => Plack::Util::FALSE,
'psgi.streaming' => Plack::Util::TRUE,
'psgi.nonblocking' => Plack::Util::FALSE,
'psgix.input.buffered' => Plack::Util::TRUE,
}, $conn, $self->app );
$conn->close;
view all matches for this distribution
view release on metacpan or search on metacpan
0.09 Sun Feb 04 22:26:00 2013
* Refactor some tests and codes.
0.08 Sun Feb 04 18:16:00 2013
* Support streaming
0.07 Sun Feb 03 19:22:00 2013
* Added some modules dependencis
* Added some tests
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/Proxy/Connect/IO.pm view on Meta::CPAN
return $self->app->($env)
unless $env->{REQUEST_METHOD} eq 'CONNECT';
return [501, [], ['']]
unless $env->{'psgi.streaming'} and $env->{'psgix.io'};
return sub {
my ($respond) = @_;
my $client = $env->{'psgix.io'};
view all matches for this distribution
view release on metacpan or search on metacpan
t/response_has_redundant_body.t view on Meta::CPAN
my $respond = shift;
$respond->( [304, [ "Content-Type" => 'text/plain' ], ['OK']] );
};
};
# streaming response
mount '/code_200_writer' => sub {
sub {
my $respond = shift;
my $writer = $respond->( [200, [ "Content-Type" => 'text/plain' ]] );
$writer->write( ref($writer) );
t/response_has_redundant_body.t view on Meta::CPAN
[ '/code_304_delayed',
'',
304,
'text/plain' ],
# streaming response
[ '/code_200_writer',
'Plack::Util::Prototype',
200,
'text/plain' ],
[ '/code_304_writer',
view all matches for this distribution
view release on metacpan or search on metacpan
1.007 Tue 12 Feb 2013
- Default body in middleware-generated redirect responses
1.006 Thu 27 Dec 2012
- Fix for buggy interaction with streaming
1.005 Thu 07 Jun 2012
- Pre-existing Location header in fabricated responses now preserved
1.004 Thu 29 Mar 2012
view all matches for this distribution
view release on metacpan or search on metacpan
- repackaging with Minilla
- faster response for normal PSGI $res
0.03 Tue Aug 7 17:00:14 2012
- fixed for streaming response (Thank you motemen-san)
0.02 Mon Mar 19 17:55:28 2012
- fixed for callback response
0.01 Fri Nov 5 16:53:39 2010
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/Session.pm view on Meta::CPAN
=item I<late_store>
If set to a true value, the session will be saved at the I<end> of the
request, after all data has been sent to the client -- this may be
required if streaming responses attempt to alter the session after the
header has already been sent to the client. Note, however, that it
introduces a possible race condition, where the server attempts to store
the updated session before the client makes the next request. For
redirects, or other responses on which the client needs do minimal
processing before making a second request, this race is quite possible
view all matches for this distribution
view release on metacpan or search on metacpan
- Testing with HTTP::CookieJar to avoid HTTP::Cookies RFC6265 non-compliance
- No more parent.pm dependency
- Updated packaging and package metadata
1.203 Mon 31 Aug 2020
- Support for streaming PSGI apps.
1.202 Mon 18 Dec 2017
- Fix for another accidental 5.10-ism in the tests.
No module code changes.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/Signposting/Catmandu.pm view on Meta::CPAN
# see http://search.cpan.org/~miyagawa/Plack-1.0044/lib/Plack/Middleware.pm#RESPONSE_CALLBACK
return $self->response_cb($res, sub {
my $res = shift;
# ignore streaming response for now
return unless ref $res->[2] eq 'ARRAY';
my $data = $bag->get($id) || return;
$fixer->fix($data);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Plack/Middleware/SocketIO.pm view on Meta::CPAN
All the transports are supported.
WebSocket
Adobe(R) Flash(R) Socket
AJAX long polling
AJAX multipart streaming
Forever Iframe
JSONP Polling
=head2 TLS/SSL
view all matches for this distribution