
07-12-2004, 05:27 PM
|
|
Member
|
|
Join Date: Jun 2004
Location: Wellington, NZ
Posts: 13
|
|
Excellent! Here's a test program.
Quote:
|
Originally Posted by mistwang
Please try release 1.5.5
|
Fantastic, it works as expected. For closure of the topic, here is my test program, which works well on my Perl 5.8.4 platform (FCGI module version = 0.67)
Code:
#!/usr/bin/perl
# Copyright (c) 2004, Sam Vilain. This program is free software; you may
# use it and/or modify it under the same terms as Perl itself.
use strict;
use FCGI;
use IO::Handle;
# to demonstrate the effect of not sending a "full" header
my $use_nph = $ENV{USE_NPH} || 1;
# external application mode, UDS can be specified with FCGI_SOCKET
# environment variable
my $socket = $ENV{FCGI_SOCKET};
my $old_mask = umask 0;
my $sock = FCGI::OpenSocket($socket, 5) if $socket;
umask $old_mask;
my ($in, $out, $err) = map { IO::Handle->new() } (1..3);
my %env;
my $request = FCGI::Request($in, $out, $err, \%env,
$sock, &FCGI::FAIL_ACCEPT_ON_INTR);
while ( $request->Accept() >= 0 ) {
select $out;
print "HTTP/1.1 200 OK\r\n" if $use_nph;
print( "Content-Type: multipart/x-mixed-replace;boundary=OOK\r\n",
"Pragma: no-cache\r\n\r\n"
);
$request->Flush();
for ( 1..3 ) {
print "--OOK\r\nContent-Type: text/plain\r\n\r\n";
print "Hello, server push - response number $_\n";
$request->Flush();
sleep 2;
print "extra content!\n";
$request->Flush();
sleep 2;
}
}
|