view release on metacpan or search on metacpan
ovcb_tell
};
/* Allow multiple instances of the decoder object. Stuff each filehandle into (void*)stream */
typedef struct {
int is_streaming;
int bytes_streamed;
int last_bitstream;
PerlIO *stream;
} ocvb_datasource;
static int ovcb_seek(void *vdatasource, ogg_int64_t offset, int whence) {
ocvb_datasource *datasource = vdatasource;
if (datasource->is_streaming) {
return -1;
}
/* For some reason PerlIO_seek fails miserably here. < 5.8.1 works */
/* return PerlIO_seek(datasource->stream, offset, whence); */
static long ovcb_tell(void *vdatasource) {
ocvb_datasource *datasource = vdatasource;
if (datasource->is_streaming) {
return datasource->bytes_streamed;
}
return PerlIO_tell(datasource->stream);
}
safefree(vf);
printf("failed on open: [%d] - [%s]\n", errno, strerror(errno));
XSRETURN_UNDEF;
}
datasource->is_streaming = 0;
} else if (SvOK(path)) {
/* Did we get a Glob, or a IO::Socket subclass?
*
* XXX This should really be a class method so the caller
* can tell us if it's streaming or not. But how to do this on
* a per object basis without changing open()s arugments. That
* may be the easiest/only way. XXX
*
*/
if (sv_isobject(path) && sv_derived_from(path, "IO::Socket")) {
datasource->is_streaming = 1;
} else {
datasource->is_streaming = 0;
}
/* dereference and get the SV* that contains the Magic & FH,
* then pull the fd from the PerlIO object */
datasource->stream = IoIFP(GvIOp(SvRV(path)));
if (ix) {
/* empty */
}
/* See http://www.xiph.org/ogg/vorbis/doc/vorbisfile/ov_read.html for
* a description of the bitstream parameter. This allows streaming
* without a hack like icy-metaint */
cur_bitstream = (int) SvIV(*(my_hv_fetch(self, "BSTREAM")));
old_bitstream = cur_bitstream;
/* When we get a new bitstream, re-read the comment fields */
view all matches for this distribution
view release on metacpan or search on metacpan
LibVorbis.xs view on Meta::CPAN
ovcb_tell
};
/* Allow multiple instances of the decoder object. Stuff each filehandle into (void*)stream */
typedef struct {
int is_streaming;
int bytes_streamed;
int last_bitstream;
PerlIO *stream;
} ocvb_datasource;
LibVorbis.xs view on Meta::CPAN
static int ovcb_seek(void *vdatasource, ogg_int64_t offset, int whence) {
ocvb_datasource *datasource = vdatasource;
if (datasource->is_streaming) {
return -1;
}
/* For some reason PerlIO_seek fails miserably here. < 5.8.1 works */
/* return PerlIO_seek(datasource->stream, offset, whence); */
LibVorbis.xs view on Meta::CPAN
static long ovcb_tell(void *vdatasource) {
ocvb_datasource *datasource = vdatasource;
if (datasource->is_streaming) {
return datasource->bytes_streamed;
}
return PerlIO_tell(datasource->stream);
}
LibVorbis.xs view on Meta::CPAN
safefree(vf);
fprintf(stderr, "failed on open: [%d] - [%s]\n", errno, strerror(errno));
XSRETURN_UNDEF;
}
datasource->is_streaming = 0;
} else if (SvOK(path)) {
/* Did we get a Glob, or a IO::Socket subclass? */
if (sv_isobject(path) && sv_derived_from(path, "IO::Socket")) {
datasource->is_streaming = 1;
} else {
datasource->is_streaming = 0;
}
/* dereference and get the SV* that contains the Magic & FH,
* then pull the fd from the PerlIO object */
datasource->stream = IoIFP(GvIOp(SvRV(path)));
LibVorbis.xs view on Meta::CPAN
safefree(vf);
printf("failed on open: [%d] - [%s]\n", errno, strerror(errno));
XSRETURN_UNDEF;
}
datasource->is_streaming = 0;
} else if (SvOK(path)) {
/* Did we get a Glob, or a IO::Socket subclass? */
if (sv_isobject(path) && sv_derived_from(path, "IO::Socket")) {
datasource->is_streaming = 1;
} else {
datasource->is_streaming = 0;
}
/* dereference and get the SV* that contains the Magic & FH,
* then pull the fd from the PerlIO object */
datasource->stream = IoIFP(GvIOp(SvRV(path)));
view all matches for this distribution
view release on metacpan or search on metacpan
- NEW: bulk_discovery() supports passing an OQL along with input filename
- New procs added: top, fieldcount, filter, expand, discovery, pivots, subnet, output, flatten
- New: various state handling functions
- New: systematically order results by field name
- BUGFIX: onyphe to strip "@category":"none" in OPP callbacks
- BUGFIX: export, bulk and all streaming APIs were returning duplicates at output
- Bugfix: discovery proc to strip "@category":"none" results
- Update: output proc to render ordered results
- Remove: app.extract.domain from pivots proc as too easy to do false positive
4.00 Tue 7 Mar 16:03:36 CET 2023
view all matches for this distribution
view release on metacpan or search on metacpan
- Conversations API Introduction: A new top-level `/conversations` endpoint has
been added to create, retrieve, update, and delete conversations and their
items. This provides a new way to manage and persist conversation state. The
previous `/embeddings` endpoint has been removed to accommodate this new
feature.
- Images API Streaming: The Images API now supports streaming for both image
generation (`/images/generations`) and editing (`/images/edits`). New
parameters such as `input_fidelity` and `partial_images` have also been
introduced for more control over image results.
- Documentation and Code Examples: Replaced all Kotlin code examples with Java
examples across the entire API specification. Endpoint summaries have been
0.22 2025-07-03
- Added new `git-release` script to automate the release process.
- Audio API Updates: The audio text-to-speech model is updated to
gpt-4o-mini-tts, and the audio transcription model is updated to
gpt-4o-transcribe, with the addition of a streaming option for the
transcription api.
- Chat Completions Enhancements: Introduces new features for the Chat
Completions API, including the ability to list, retrieve, update, and delete
chat completions. Support for metadata filtering is added, and the
documentation clarifies parameter support across different models.
near-useless Schema.pod that we used to have.
0.16 2025-04-06
- Audio API Updates: The audio text-to-speech model is updated to
gpt-4o-mini-tts, and the audio transcription model is updated to
gpt-4o-transcribe, with the addition of a streaming option for the
transcription api.
- Chat Completions Enhancements: Introduces new features for the Chat
Completions API, including the ability to list, retrieve, update, and delete
chat completions. Support for metadata filtering is added, and the
documentation clarifies parameter support across different models.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/OpenAPI/PerlGenerator/Template/Mojo.pm view on Meta::CPAN
% } else {
<%= $argname %>
% }
__INFLATED_RESPONSE__
$template{streaming_response} = <<'__STREAMING_RESPONSE__';
use Future::Queue;
my $res = Future::Queue->new( prototype => 'Future::Mojo' );
our @store; # we should use ->retain() instead
push @store, $r1->then( sub( $tx ) {
my $resp = $tx->res;
# Should we validate using OpenAPI::Modern here?!
%# Should this be its own subroutine instead?!
% for my $code (sort keys $elt->{responses}->%*) { # response code s
% my $info = $elt->{responses}->{ $code };
%# XXX if streaming, we need to handle a non-streaming error response!
<%= elsif_chain($name) %>( $resp->code <%= openapi_http_code_match( $code ) %> ) {
% if( $info->{description} =~ /\S/ ) {
# <%= single_line( $info->{description} ) %>
% }
% # Check the content type
lib/OpenAPI/PerlGenerator/Template/Mojo.pm view on Meta::CPAN
%# These handlers for content types should come from templates? Or maybe
%# from a subroutine?!
% if( $ct eq 'application/json' ) {
my $payload = $resp->json();
% } elsif( $ct eq 'application/x-ndjson' ) {
# code missing to hack up ndjson into hashes for a non-streaming response
my $payload = $resp->body();
% } else {
my $payload = $resp->body();
% }
return Future::Mojo->done(
lib/OpenAPI/PerlGenerator/Template/Mojo.pm view on Meta::CPAN
=head1 METHODS
% for my $method ($methods->@*) {
% my $elt = $method->{elt};
% my $is_streaming = exists $elt->{responses}->{200}
% && $elt->{responses}->{200}->{content}
% && [keys $elt->{responses}->{200}->{content}->%*]->[0] eq 'application/x-ndjson'
% ;
%
%# Sort the parameters according to where they go
lib/OpenAPI/PerlGenerator/Template/Mojo.pm view on Meta::CPAN
% }
%
=head2 C<< <%= $method->{name} %> >>
%# Generate the example invocation
% if( $is_streaming ) {
use Future::Utils 'repeat';
my $responses = $client-><%= $method->{name} %>();
repeat {
my ($res) = $responses->shift;
if( $res ) {
lib/OpenAPI/PerlGenerator/Template/Mojo.pm view on Meta::CPAN
if( $results->{error}) {
say $results;
say $tx->req->to_string;
};
%# We want to handle both here, streaming (ndjson) and plain responses
%# Plain responses are easy, but for streamed, we want to register an ->on('progress')
%# handler instead of the plain part completely. In the ->on('progress') part,
%# we still run the handler, so maybe that is the same ?!
my $r1 = Future::Mojo->new();
% if( $is_streaming ) {
<%= include('streaming_response', {
name => $method->{name},
elt => $elt,
prefix => $prefix,
}); =%>
% } else {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/OpenTok/API.pm view on Meta::CPAN
p2p.preference (String) . Whether the session's streams will be transmitted directly between peers. You can set the following possible values:
"disabled" (the default) . The session's streams will all be relayed using the OpenTok servers. More than two clients can connect to the session.
"enabled" . The session will attempt to transmit streams directly between clients. If peer-to-peer streaming fails (either when streams are
initially published or during the course of a session), the session falls back to using the OpenTok servers for relaying streams.
(Peer-to-peer streaming uses UDP, which may be blocked by a firewall.) For a session created with peer-to-peer streaming enabled,
only two clients can connect to the session at a time. If an additional client attempts to connect,
the TB object on the client dispatches an exception event.
By removing the server, peer-to-peer streaming decreases latency and improves quality.
Note that the properties object previously included settings for multiplexing and server-side echo suppression.
However, these features were deleted in OpenTok v0.91.48. (Server-side echo suppression was replaced with the
acoustic echo cancellation feature added in OpenTok v0.91.18.)
view all matches for this distribution
view release on metacpan or search on metacpan
examples/07-extension-fullflush/app.pl view on Meta::CPAN
use strict;
use warnings;
use Future::AsyncAwait;
# Demonstrates fullflush extension during streaming response.
# The fullflush event forces immediate TCP buffer flush, useful for
# Server-Sent Events or real-time streaming where latency matters.
async sub app {
my ($scope, $receive, $send) = @_;
die "Unsupported scope type: $scope->{type}" if $scope->{type} ne 'http';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PAX/CodeUnitCompiler.pm view on Meta::CPAN
if (
_package_tail_is($package, '')
&& $short_name eq 'exec_command'
&& $body =~ /unknown_skill_command_message/
&& $body =~ /_execute_hooks_streaming/
&& $body =~ /_exec_resolved_command/
) {
my $prototype = _sub_prototype_from_source($source, $short_name);
return {
name => $short_name,
full_name => $full_name,
op => 'skill_dispatcher_exec_command',
command_spec_method => $package . '::_command_spec',
execute_hooks_streaming_method => $package . '::_execute_hooks_streaming',
skill_layers_method => $package . '::_skill_layers',
skill_env_method => $package . '::_skill_env',
exec_resolved_method => $package . '::_exec_resolved_command',
prototype => $prototype,
};
lib/PAX/CodeUnitCompiler.pm view on Meta::CPAN
};
}
if (
_package_tail_is($package, '')
&& $short_name eq '_execute_hooks_streaming'
&& $body =~ /_arrayref_or_empty/
&& $body =~ /_skill_env/
&& $body =~ /_run_child_command_streaming/
) {
my $prototype = _sub_prototype_from_source($source, $short_name);
return {
name => $short_name,
full_name => $full_name,
op => 'skill_dispatcher_execute_hooks_streaming',
arrayref_or_empty_method => $package . '::_arrayref_or_empty',
skill_env_method => $package . '::_skill_env',
run_child_streaming_method => $package . '::_run_child_command_streaming',
prototype => $prototype,
};
}
if (
_package_tail_is($package, '')
&& $short_name eq '_run_child_command_streaming'
&& $body =~ /_arrayref_or_empty/
&& $body =~ /_hashref_or_empty/
&& $body =~ /_defined_or_default/
&& $body =~ /open3/
&& $body =~ /IO::Select/
) {
my $prototype = _sub_prototype_from_source($source, $short_name);
return {
name => $short_name,
full_name => $full_name,
op => 'skill_dispatcher_run_child_command_streaming',
arrayref_or_empty_method => $package . '::_arrayref_or_empty',
hashref_or_empty_method => $package . '::_hashref_or_empty',
defined_or_default_method => $package . '::_defined_or_default',
prototype => $prototype,
};
view all matches for this distribution
view release on metacpan or search on metacpan
as the result might not get saved in the database, so you better commit
everything before flushing and then just continue output (use GET or POST
to create new links after this).
Flushing does not yet harmonize with output stylesheet processing, for the
semi-obvious reason that PApp::XSLT does not support streaming operation.
BUGS: No links that have been output so far can be followed until the
document is finished, because the neccessary information will not reach
the disk until the document.... is finished ;)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PEF/Front/WebSocket.pm view on Meta::CPAN
=over
=item *
C<psgi.streaming> environment is true.
=item *
C<psgi.nonblocking> environment is true.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/PEF/Front/Model.pm view on Meta::CPAN
C<answer_no_nls> is not present or false then this message
will be automatically localized.
When calling type is C</get> or C</submit> then value of this
key can be open file handle or code reference. If value of this
key is code reference then it is "streaming function".
See L<PSGI/"Delayed Response and Streaming Body">.
=item B<answer_args>
Array of arguments to the message.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POD2/RU/PSGI.pod view on Meta::CPAN
C<psgi.nonblocking>: ÐÑлево знаÑение, ÑодеÑжаÑее true, еÑли ÑеÑÐ²ÐµÑ Ð²ÑзÑваеÑ
пÑиложение в неблокиÑÑÑÑем ÑобÑÑийном Ñикле.
=item *
C<psgi.streaming>: ÐÑлево знаÑение, Ñавное true, еÑли ÑеÑÐ²ÐµÑ Ð¾Ð¶Ð¸Ð´Ð°ÐµÑ
оÑложенного оÑвеÑа в ÑÑиле callback и поÑокового пиÑÑÑего обÑекÑа.
=back
СеÑÐ²ÐµÑ Ð¸Ð»Ð¸ пÑиложение Ð¼Ð¾Ð¶ÐµÑ Ñакже ÑоÑ
ÑанÑÑÑ Ñвои даннÑе в пеÑеменнÑÑ
lib/POD2/RU/PSGI.pod view on Meta::CPAN
=head2 ÐÑложеннÑй ÐÑÐ²ÐµÑ Ð¸ ÐоÑоковое Тело оÑвеÑа
The PSGI interface allows applications and servers to provide a
callback-style response instead of the three-element array
reference. This allows for a delayed response and a streaming body
(server push).
ÐнÑеÑÑÐµÐ¹Ñ PSGI позволÑÐµÑ Ð¿ÑиложениÑм и ÑеÑвеÑам пÑедоÑÑавлÑÑÑ Ð¾ÑÐ²ÐµÑ Ð² виде
вÑзÑваемой ÑÑнкÑии вмеÑÑо ÑÑÑлки на ÑÑÑÑ
ÑлеменÑнÑй маÑÑив. ÐÑо позволÑеÑ
возвÑаÑаÑÑ Ð¾ÑложеннÑе оÑвеÑÑ Ð¸ поÑоковое Ñело оÑвеÑа (server push).
PSGI ÑеÑвеÑам B<СÐÐÐУÐТ> ÑеализовÑваÑÑ ÑÑÐ¾Ñ Ð¸Ð½ÑеÑÑейÑ, и пеÑеменнаÑ
C<psgi.streaming> должна бÑÑÑ Ñавна true в ÑакиÑ
ÑеÑвеÑаÑ
.
ЧÑÐ¾Ð±Ñ ÑазÑеÑиÑÑ Ð¾ÑложеннÑй оÑвеÑ, пÑÐ¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ B<СÐÐÐУÐТ> возвÑаÑаÑÑ Ð²ÑзÑваемÑÑ
ÑÑнкÑÐ¸Ñ Ð² каÑеÑÑве оÑвеÑа. ÐÑиложение B<ÐÐÐÐТ> пÑовеÑÑÑÑ, ÑÑо пеÑеменнаÑ
C<psgi.streaming> Ñавна true, и возвÑаÑаÑÑÑÑ Ðº непоÑÑедÑÑÐ²ÐµÐ½Ð½Ð¾Ð¼Ñ Ð¾ÑвеÑÑ, еÑли
ÑÑо не Ñак.
This callback will be called with I<another> subroutine reference (referred to
as the I<responder> from now on) as its only argument. The I<responder>
should in turn be called with the standard three element array reference
lib/POD2/RU/PSGI.pod view on Meta::CPAN
Added optional PSGI keys as extensions: C<psgix.logger> and C<psgix.session>.
=item *
C<psgi.streaming> B<SHOULD> be implemented by PSGI servers, rather than B<MAY>.
=item *
PSGI keys C<psgi.run_once>, C<psgi.nonblocking> and C<psgi.streaming>
B<MUST> be set by PSGI servers.
=item *
Removed C<poll_cb> from writer methods.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Amazon/S3.pm view on Meta::CPAN
$params{libxml} = XML::LibXML->new;
my $self = bless \%params, $class;
# A non-streaming HTTP client for most requests
POE::Component::Client::HTTP->spawn(
Agent => 'POE-Component-Amazon-S3/' . $VERSION,
Alias => 'ua',
Timeout => 30,
);
# A streaming HTTP client for downloads
POE::Component::Client::HTTP->spawn(
Agent => 'POE-Component-Amazon-S3/' . $VERSION,
Alias => 'ua-streaming',
Timeout => 30,
Streaming => $BLOCK_SIZE,
);
POE::Session->create(
lib/POE/Component/Amazon/S3.pm view on Meta::CPAN
sub shutdown {
my ( $kernel, $self ) = @_[ KERNEL, OBJECT ];
# Shut down our HTTP clients
$kernel->post( ua => 'shutdown' );
$kernel->post( 'ua-streaming' => 'shutdown' );
$kernel->alias_remove( $self->{alias} || 'amazon-s3' );
}
### Bucket methods
lib/POE/Component/Amazon/S3.pm view on Meta::CPAN
event => $event,
file => $file,
pass => $conf->{pass} || [],
};
$kernel->post( 'ua-streaming' => request => get_key_done => $request, $pass );
}
sub get_key_done {
my ( $kernel, $self, $req, $res ) = @_[ KERNEL, OBJECT, ARG0, ARG1 ];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/BlogCloud.pm view on Meta::CPAN
1;
__END__
=head1 NAME
POE::Component::BlogCloud - Client interface to blo.gs streaming cloud server
=head1 SYNOPSIS
use POE qw( Component::BlogCloud );
POE::Component::BlogCloud->spawn(
lib/POE/Component/BlogCloud.pm view on Meta::CPAN
);
=head1 DESCRIPTION
I<POE::Component::BlogCloud> is a client interface to the I<blo.gs>
streaming cloud server, described at I<http://blo.gs/cloud.php>. It's
built using the L<POE> framework for Perl, allowing you to build an
event-based application that receives weblog updates, then acts upon them.
=head1 USAGE
lib/POE/Component/BlogCloud.pm view on Meta::CPAN
=over 4
=item * ReceivedUpdate
The callback to execute when an update from the streaming server is
received. ARG0 contains a I<POE::Component::BlogCloud::Update> that
represents the update information.
This argument is required.
=item * AutoReconnect
If the client is disconnected from the streaming server because of an error,
it can be told to automatically try to reconnect by setting I<AutoReconnect>
to C<1>.
This argument is optional, and if not specified defaults to C<0>, meaning
that the client will not automatically reconnect.
=item * RemoteAddress
The address of the streaming server to connect to.
This argument is optional, and if not specified defaults to C<ping.blo.gs>.
=item * RemotePort
The port where the streaming server is running.
This argument is optional, and if not specified defaults to C<9999>.
=back
=head1 CAVEATS
The specification for the streaming server indicates that gzip compression
will be turned on at some point, at which point an update to this module
will be needed.
In addition, the blo.gs server does sometimes seem to get "stuck" and stop
sending updates, which will be indicated by the client hanging waiting
view all matches for this distribution
view release on metacpan or search on metacpan
my %stat = (
':-)' => 'Normal operation, low/no jitter',
':-|' => 'Normal operation, considerable jitter',
':-/' => 'Read drift',
':-P' => 'Unreported loss of streaming in atomic read operation',
'8-|' => 'Finding read problems at same point during reread; hard to correct',
':-0' => 'SCSI/ATAPI transport error',
':-(' => 'Scratch detected',
';-(' => 'Gave up trying to perform a correction',
'8-X' => 'Aborted (as per -X) due to a scratch/skip',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Client/HTTP.pm view on Meta::CPAN
chunks (of OCTETS octets each) rather than combine the entire content
into a single HTTP::Response object.
By default, Client::HTTP reads the entire content for a response into
memory before returning an HTTP::Response object. This is obviously
bad for applications like streaming MP3 clients, because they often
fetch songs that never end. Yes, they go on and on, my friend.
When C<Streaming> is set to nonzero, however, the response handler
receives chunks of up to OCTETS octets apiece. The response handler
accepts slightly different parameters in this case. ARG0 is also an
HTTP::Response object but it does not contain response content,
and ARG1 contains a a chunk of raw response
content, or undef if the stream has ended.
sub streaming_response_handler {
my $response_packet = $_[ARG1];
my ($response, $data) = @$response_packet;
print SAVED_STREAM $data if defined $data;
}
lib/POE/Component/Client/HTTP.pm view on Meta::CPAN
=head2 cancel
Cancel a specific HTTP request. Requires a reference to the original
request (blessed or stringified) so it knows which one to cancel. See
L<progress handler> below for notes on canceling streaming requests.
To cancel a request based on its blessed HTTP::Request object:
$kernel->post( component => cancel => $http_request );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Client/Icecast.pm view on Meta::CPAN
POE::Kernel->run;
=head1 DESCRIPTION
The module is a non-blocking client to Icecast streaming multimedia server for getting stream tags.
See L<http://www.icecast.org/>.
POE::Component::Client::Icecast is based on L<POE::Component::Client::TCP>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Curl/Multi.pm view on Meta::CPAN
return;
}
=head1 STREAMING
This component does not (yet) support L<POE::Component::Client::HTTP>'s streaming options.
=head1 CLIENT HEADERS
POE::Component::Curl::Multi sets its own response headers with
additional information. All of its headers begin with "X-PCCH".
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/FastCGI.pm view on Meta::CPAN
$kernel->post($heap->{Session}, $run->[1],$request, $run->[0]);
}
if($request->{_res}) {
# Streaming support
if($request->{_res}->streaming) {
push @{$heap->{toclose}->{$wheel_id}}, $request->{_res};
} else {
# Send and break circular ref
$request->{_res}->send if exists $request->{_res}->{client};
$request->{_res} = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Server/Bayeux/Request.pm view on Meta::CPAN
if ($self->delay) {
$poe_kernel->post($heap->{manager}, 'delay_request', $self->id, $self->delay);
$self->delay(0);
$self->is_complete(0);
$self->http_response->streaming(1);
}
else {
$self->complete();
}
}
lib/POE/Component/Server/Bayeux/Request.pm view on Meta::CPAN
sub complete {
my ($self) = @_;
$self->form_response( @{ $self->responses } );
$self->is_complete(1);
if ($self->http_response->streaming) {
$self->http_response->send( $self->http_response );
$self->http_response->close();
}
# Ensure no KeepAlive
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
}
}
next;
}
elsif ($state eq 'Cleanup') {
if (not $response->is_error and $response->streaming()) {
$_[HEAP]->{wheels}->{$id}->set_output_filter(POE::Filter::Stream->new() );
unshift(@{$handlers->{Queue}},'Streaming');
next HANDLERS;
}
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
$response->header(%{$self->{Headers}});
unless ($response->header('Date')) {
$response->header('Date',time2str(time));
}
if (!($response->header('Content-Lenth')) && !($response->streaming())) {
use bytes;
$response->header('Content-Length',length($response->content));
}
$wheel->put($response);
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
If no handler installs a ContentHandler it will find the closest one
directory wise and use it.
There is also a special StreamHandler which is a coderef that gets
invoked if you have turned on streaming by doing
$response->streaming(1);
Handlers take the $request and $response objects as arguments.
=over 4
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
=item ContentHandler
The handler that is supposed to give the content. When this handler
returns it will send the response object to the client. It will
automaticly add Content-Length and Date if these are not set. If the
response is streaming it will make sure the correct headers are
set. It will also expand any cookies which have been pushed onto the
response object.
new(ContentHandler => { '/' => sub {}, '/foo/' => \&foo});
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
new(PostHandler => { '/' => [sub {}], '/foo/' => [\&foo]});
=item StreamHandler
If you turn on streaming in any other handler, the request is placed in
streaming mode. This handler is called, with the usual parameters, when
streaming mode is first entered, and subsequently when each block of data is
flushed to the client.
Streaming mode is turned on via the C<$response> object:
$response->streaming(1);
You deactivate streaming mode with the same object:
$response->close;
Content is also sent to the client via the C<$response> object:
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
}
sub someurl {
my($self, $resquest, $response)=@_;
$self->{todo} = [ .... ];
$response->streaming(1);
$response->code(RC_OK); # you must set up your response header
$response->content_type(...);
return RC_OK;
}
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
}
Another example can be found in t/30_stream.t. The parts dealing with
multipart/mixed are well documented and at the end of the file.
NOTE: Changes in streaming mode are only verified when StreamHandler exits.
So you must either turn streaming off in your StreamHandler, or make sure
that the StreamHandler will be called again. This last is done by sending
data to the client. If for some reason you have no data to send, you can
get the same result with C<continue>. Remember that this will also cause the
StreamHandler to be called one more time.
lib/POE/Component/Server/HTTP.pm view on Meta::CPAN
=item Write more tests
=item Add a PoCo::Server::HTTP::Session that matches a http session against poe session using cookies or other state system
=item Add more options to streaming
=item Figure out why post()ed C<shutdown> events don't get received.
=item Probably lots of other API changes
view all matches for this distribution
view release on metacpan or search on metacpan
t/03_prefork_stream.t view on Meta::CPAN
}
sub GOT_STREAM {
my ( $kernel, $heap, $response ) = @_[KERNEL, HEAP, ARG0];
# lets go on streaming ...
if ($heap->{'count'} <= 2) {
my $text = "Hello World ".$heap->{'count'}." \n";
# print "send ".$text."\n";
$response->content($text);
view all matches for this distribution
view release on metacpan or search on metacpan
examples/stream.pl view on Meta::CPAN
# the stream hash contains the wheel, the request, the response
# and an id associated the the wheel
$stream->{'wheel'}->put("Hello World\n");
# lets go on streaming ...
POE::Kernel->delay('GOT_STREAM', 1, $stream );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Declare/Log/File.pm view on Meta::CPAN
$_[SELF]->{state} = 'CRASH';
# Prevent additional message and flush queue
delete $_[SELF]->{buffer};
# Clean up streaming resources
$_[SELF]->clean;
return;
}
lib/POE/Declare/Log/File.pm view on Meta::CPAN
my $self = shift;
# Prevent additional messages and flush the queue
delete $self->{buffer};
# Clean up streaming resources
$self->clean;
# Pass through as normal
$self->SUPER::finish(@_);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Filter/XML.pm view on Meta::CPAN
builder => '_build_parser',
clearer => '_clear_parser'
);
has not_streaming =>
(
is => 'ro',
isa => 'Bool',
default => 0,
);
sub _build_handler {
my ($self) = @_;
POE::Filter::XML::Handler->new(not_streaming => $self->not_streaming)
}
sub _build_parser {
my ($self) = @_;
XML::LibXML->new(Handler => $self->handler)
lib/POE/Filter/XML.pm view on Meta::CPAN
if($self->handler->has_finished_nodes())
{
my $node = $self->handler->get_finished_node();
if($node->stream_end() or $self->not_streaming)
{
$self->parser->parse_chunk('', 1);
$self->reset();
}
lib/POE/Filter/XML.pm view on Meta::CPAN
The parser is XML::LibXML
=head1 PUBLIC_ATTRIBUTES
=head2 not_streaming
is: ro, isa: Bool, default: false
Setting the not_streaming attribute to true via new() will put this filter into
non-streaming mode, meaning that whole documents are parsed before nodes are
returned. This is handy for XMLRPC or other short documents.
=head1 PRIVATE_ATTRIBUTES
=head2 buffer
lib/POE/Filter/XML.pm view on Meta::CPAN
is: ro, isa: POE::Filter::XML::Handler
handler holds the SAX handler to be used for processing events from the parser.
By default POE::Filter::XML::Handler is instantiated and used.
The L</not_streaming> attribute is passed to the constructor of Handler.
=head2 parser
is: ro, isa: XML::LibXML
lib/POE/Filter/XML.pm view on Meta::CPAN
reset() is an internal method that gets called when either a stream_start(1)
POE::Filter::XML::Node gets placed into the filter via L</put>, or when a
stream_end(1) POE::Filter::XML::Node is pulled out of the queue of finished
Nodes via L</get_one>. This facilitates automagical behavior when using the
Filter within the XMPP protocol that requires many new stream initiations.
This method is also called after every document when not in streaming mode.
Useful for handling XMLRPC processing.
This method really should never be called outside of the Filter, but it is
documented here in case the Filter is used outside of the POE context.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Filter/Zlib.pm view on Meta::CPAN
=head1 DESCRIPTION
POE::Filter::Zlib provides a POE filter for performing compression/uncompression using L<Compress::Zlib>. It is
suitable for use with L<POE::Filter::Stackable>.
This filter is not ideal for streaming compressed data over sockets etc. as it employs compress and uncompress zlib functions.
L<POE::Filter::Zlib::Stream> is recommended for that type of activity.
=head1 CONSTRUCTOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POE/Component/Server/TCP.pm view on Meta::CPAN
C<ClientFlushed> exposes POE::Wheel::ReadWrite's C<FlushedEvent> as a
callback. It is called whenever the client's output buffer has been
fully flushed to the client socket. At this point it's safe to shut
down the socket without losing data.
C<ClientFlushed> is useful for streaming servers, where a "flushed"
event signals the need to send more data.
ClientFlushed => sub {
my $data_source = $_[HEAP]{file_handle};
my $read_count = sysread($data_source, my $buffer = "", 65536);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POEx/HTTP/Server.pm view on Meta::CPAN
# Request has finished
if( not $self->{resp} or $self->{S}{done} or $self->{resp}->finished ) {
return $self->finish_request;
}
# streaming?
elsif( $self->{resp}->streaming ) {
return $self->send_more; # send some more
}
# The last possiblity is that calls to ->send have filled up the Wheel's
# or the driver's buffer and it was flushed.
lib/POEx/HTTP/Server.pm view on Meta::CPAN
#my $conn = $self->{req}->header('Connection')||'';
#$self->{will_close} = 0 if qq(,$conn,) =~ /,\s*keep-alive\s*,/i;
#warn "$$:conn=$conn will_close=$self->{will_close}";
}
$self->{will_close} = 1 if $self->{resp}->streaming;
#warn "$$:post streaming will_close=$self->{will_close}";
$self->{will_close} = 1 unless $self->{keepalive} > 1;
#warn "$$:post keepalive will_close=$self->{will_close}";
$self->{will_close} = 1 if $self->{shutdown};
DEBUG and
$self->D( "will_close=$self->{will_close}" );
lib/POEx/HTTP/Server.pm view on Meta::CPAN
unless( $self->{resp}->headers_sent ) {
$self->should_close;
$self->send_headers;
$self->{stream_wheel} = 1;
$self->{wheel}->set_output_filter( $self->build_stream_filter );
if( $self->{resp}->streaming ) {
eval {
$SIG{__DIE__} = 'DEFAULT';
$self->__tcp_hot;
};
warn $@ if $@;
}
}
$self->output( $something ) if defined $something;
if( $self->{resp}->streaming and $self->{wheel} ) {
$self->{wheel}->flush;
}
$self->timeout_start();
return;
}
# We are in streaming mode. The last chunk has flushed. Send a new one
sub send_more
{
my( $self ) = @_;
$self->timeout_stop();
$self->special_dispatch( 'stream_request', $self->{req}, $self->{resp} );
}
# We are in streaming mode. Turn off Nagle's algorithm
# This isn't as effective as you might think
sub __tcp_hot
{
my( $self ) = @_;
DEBUG and
lib/POEx/HTTP/Server.pm view on Meta::CPAN
# ...
}
=head3 stream_request
Invoked when a chunk has been flushed to the OS, if you are streaming a
response to the browser. Streaming is turned on with
L<POEx::HTTP::Server::Response/streaming>.
Please remember that while a chunk might be flushed, the OS's network layer
might still decide to combine several chunks into a single packet. And this
even though we setup a I<hot> socket with C<TCP_NODELAY> set to 1 and
C<SO_SNDBUF> to 576.
lib/POEx/HTTP/Server.pm view on Meta::CPAN
keepalive is deactivated for the connection. Finally difference
is that you will see C<L</stream_request>> when you are allowed to send the
next block. Look for C<L</post_request>> to find out when the last block has
been sent to the browser.
$resp->streaming( 1 );
$resp->header( 'Content-Length' => $size );
$resp->send;
When you want to send a chunk:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POEx/Role/PSGIServer.pm view on Meta::CPAN
return req_to_psgi(
$c->{request},
SERVER_NAME => $self->listen_ip,
SERVER_PORT => $self->listen_port,
SERVER_PROTOCOL => $c->{protocol},
'psgi.streaming' => Plack::Util::TRUE,
'psgi.nonblocking' => Plack::Util::TRUE,
'psgi.runonce' => Plack::Util::FALSE,
);
}
lib/POEx/Role/PSGIServer.pm view on Meta::CPAN
POEx::Role::PSGIServer encapsulates the core L<PSGI> server behaviors into an easy to consume and extend role. It is based on previous POEx work such as POEx::Role::TCPServer which provides basic TCP socket multiplexing via POE::Wheel::SocketFactory ...
=head2 RATIONALE
This Role has its roots firmly planted in POE::Component::Server::PSGI which provided the initial seed with the layout and logic of the basic server. Unfortunately, POE::Component::Server::PSGI didn't provide any mechnism for extension. The main goal...
=head1 CLASS_METHODS
=head2 around BUILDARGS
view all matches for this distribution
view release on metacpan or search on metacpan
- 1.1 beta
- Upped psgi.version to be [1,1]
- Lots of grammar and style fixes
- Removed poll_cb from writer spec
- Streaming interface now SHOULD be implemented, rather than MAY
- Promoted psgi.streaming, nonblocking and run_once keys to be MUST
- Added psgix.logger and psgix.session extensions
- Updated FAQ
1.03 Tue Oct 27 13:44:01 PDT 2009
- Added an optional callback interface to allow delayed response and streaming
1.02 Tue Oct 13 01:57:28 PDT 2009
- No spec changes. Just to let PAUSE index this stuff.
1.01 Tue Oct 13 01:17:28 PDT 2009
view all matches for this distribution