Is it possible for a perl cgi script to segment its AJAX responses into numerous individual HTTP responses?
Say I have this code:
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
onDataReceived(xmlhttp.responseText);
}
else if(xmlhttp.status!=200 && xmlhttp.status!=0) { }
}
xmlhttp.open("POST","script.cgi",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(toURLString(options));
as javascript (dont tell me about xml object compatibility issues with ie, I know, and don't care).
and this:
print "Content-type: text/html\n\n";
my %form = Vars();
if($ENV{REQUEST_METHOD} eq "POST" )
{
$|=1;
for(my $i, (1..100000000))
{
print "1\n";
}
}
as perl cgi. Is it possible to print out this result in numerous individual packets of 1s, instead of generating 100000000 1s before finally having an output?