Re: mod_perl memory
André Warnier <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
André Warnier wrote:
> Pavel Georgiev wrote:
>> Andre,
>>
>> That is what I'm currently doing:
>> $request->content_type("multipart/x-mixed-replace;boundary=\"$this->{boundary}\";");
>>
>>
> I don't think so. What you show above is a multipart message body,
> which is not the same (and not the same level).
> What you are looking for is a header like
> Transfer-encoding: chunked
>
> And this chunked transfer encoding happens last in the chain. It is just
> a way of sending the data to the browser in smaller pieces, like one
> would do for example to send a whole multi-megabyte video file.
>
>
> This link may help :
>
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6
> and this
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.41
>
> Also search Google for "mod_perl +chunked"
>
> The first item in the list contains a phrase :
> "mod_perl can transparently generate chunked encoding on recent versions
> of Apache"
>
> I personally don't know how, but it sounds intriguing enough to look
> further into it.
> Maybe one of the gurus on this list knows more about it, and can give a
> better opinion than mine as to whether this might help you.
>
>
In one of the following hits in Google, I found this demo CGI script :
#!/usr/bin/perl -w
use CGI;
my $cgi = new CGI();
print $cgi->header(-type => 'application/octet-stream',
-content_disposition => 'attachment; filename=data.raw', -connection =>
'close', -transfer_encoding => 'chunked');
open (my $fh, '<', '/dev/urandom') || die "$!\n";
for (1..100) {
my $data;
read($fh, $data, 1024*1024);
print $data;
}
That should be easily transposable to mod_perl.
Of course above they read and send in chunks of 1 MB, which may not be
the small buffers you are looking for..
;-)