logo       

Re: cgi stdin buffer: msg#00265

lang.j.general

Subject: Re: cgi stdin buffer

--- Joey K Tuttle <jkt-2rm9UrUe0KQ@xxxxxxxxxxxxxxxx> wrote:

> At 10:27 -0800 2007/01/28, Oleg Kobchenko wrote:
> >--- bill lam <bbill.lam-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> >
> >> Oleg Kobchenko wrote:
> >> > Shouldn't uploading be just a matter of parsing
> >> > stdin with mime sections?
> >>
> >> I meant uploading 1MB is simple but not so trivial for uploading
> >>100MB. I think
> >> that http server is smart enough to handle it but may be tricky
> >>for cgi. perl
> >> cgi.pm seems automatically save data to a temp file, and then cgi
> >>program then
> >> open this temp file for reading.
> >
> >Saving to temp files is a typical way of handling
> >uploaded files, but not the only one. It is the
> >responsibility of the CGI program (with help of
> >a library), but web server just streams it via stdin.
> >Technically the stdin mimes can be consumed on the fly
> >if, for example, they are meant to be stored in a database
> >instead of files.
> >
> >That's the reason I was proposing buffered (streamed)
> >stdin reader. With a streaming mechanism, large quantities
> >of data can be handled with very low memory footprint.
>
> I agree this would be a nice feature to have available -
> meanwhile, copying to a tmp file was the solution I
> stumbled across in handling uploads. Processing the
> tmp file in my jCGI is also a small memory footprint.

Of course, using an intermediate shell script to store
stdin in a file is a solution, but there are a few problems
with it:
- the shell script needs to be maintained in addition to J
scripts
- it needs to be configured (or edited manually) to specify
locations etc. Not all UNIX/J users are comfortable with
shell scripting
- it requires some logic to distinguish uploading HTTP requests
- does it parse stdin mimes into separate files? or it
will still be J/CGI responsibility potentially creating
new actual temp files
- it is not portable to Windows, where jconsole.exe is
called directly by the web server (IIS)

> On the other hand, being able to act more "real time"
> would be great for some applications.

Another advantage of streaming is that splitting mimes
into files can be done in one go.




____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121



____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise