Steve Hay
Thu, 02 Dec 2004 08:18:05 -0800
Tobias Henoeckl wrote: >We stepped into memory problems using CGI::Application, as our >application had to deliver a file to the customer after doing some >calculations and access control. It worked well until our customer >started to serve *really* huge files, wich were slurped into memory >by the run mode handler and then returned for delivery. > >As far as I could see there is no way supplied in CGI::Application to >stream a file directly from the file system to the user agent. > I've been here before myself: see this thread: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/msg00951.html
The solution there that I used (suggested by Steve Comrie) was simply
this: Set $self->header_type('none'), then print the headers yourself,
then read & print the file in blocks of, say, 2048 bytes at a time.
Finally, have your run mode return '' (the null string).
CGI-App itself will then do nothing more -- you've set header_type to
'none', so it won't output any headers, and you've returned nothing from
the run mode, so it won't output any content either.
Worked well for me.
- Steve
------------------------------------------------
Radan Computational Ltd.
The information contained in this message and any files transmitted with it are
confidential and intended for the addressee(s) only. If you have received this
message in error or there are any problems, please notify the sender
immediately. The unauthorized use, disclosure, copying or alteration of this
message is strictly forbidden. Note that any views or opinions presented in
this email are solely those of the author and do not necessarily represent
those of Radan Computational Ltd. The recipient(s) of this message should
check it and any attached files for viruses: Radan Computational will accept no
liability for any damage caused by any virus transmitted by this email.
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]