Corona

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.1002 Fri Mar 19 00:43:40 PDT 2010
        - Add $VERSION to Plack::Server::Coro

0.1001 Tue Mar 16 18:57:15 PDT 2010
        - Include Plack::Server::Coro, now it's an empty subclass of Handler::Corona

0.1000 Thu Mar 11 21:39:47 JST 2010
        - Renamed the software as 'Corona'

0.02  Sat Oct 24 01:27:12 PDT 2009
        - Added psgi.streaming interface

0.01  Mon Oct 12 23:38:36 2009
        - original version

lib/Corona/Server.pm  view on Meta::CPAN

        SCRIPT_NAME => '',
        REMOTE_ADDR => $self->{server}{peeraddr},
        'psgi.version' => [ 1, 0 ],
        'psgi.errors'  => *STDERR,
        'psgi.input'   => $self->{server}{client},
        'psgi.url_scheme' => 'http', # SSL support?
        'psgi.nonblocking'  => Plack::Util::TRUE,
        'psgi.run_once'     => Plack::Util::FALSE,
        'psgi.multithread'  => Plack::Util::TRUE,
        'psgi.multiprocess' => Plack::Util::FALSE,
        'psgi.streaming'    => Plack::Util::TRUE,
        'psgix.io'          => $fh->fh,
    };

    my $res = [ 400, [ 'Content-Type' => 'text/plain' ], [ 'Bad Request' ] ];

    my $buf = '';
    while (1) {
        my $read = $fh->readline("\015\012\015\012")
            or last;
        $buf .= $read;

lib/Corona/Server.pm  view on Meta::CPAN

            $conn_value = $v;
        }
    }

    unshift @lines, "HTTP/1.0 $res->[0] @{[ HTTP::Status::status_message($res->[0]) ]}\015\012";
    push @lines, "\015\012";

    $fh->syswrite(join '', @lines);

    if (!defined $res->[2]) {
        # streaming write
        return Plack::Util::inline_object
            write => sub { $fh->syswrite(join '', @_) },
            close => $rouse_cb;
    } elsif (HAS_AIO && Plack::Util::is_real_fh($res->[2])) {
        my $length = -s $res->[2];
        my $offset = 0;
        while (1) {
            my $sent = aio_sendfile( $fh->fh, $res->[2], $offset, $length - $offset );
            $offset += $sent if $sent > 0;
            last if $offset >= $length;



( run in 0.234 second using v1.01-cache-2.11-cpan-4d50c553e7e )