Glenn Linderman <v+pyt...@g.nevcal.com> added the comment:

Victor said:
Don't you think that a warning would be appropriate if sys.stdin is passed 
here?
---
        # self.fp.read() must return bytes
        if isinstance(fp,TextIOBase):
            self.fp = fp.buffer
        else:
            self.fp = fp
---
Maybe a DeprecationWarning if we would like to drop support of TextIOWrapper 
later :-)

I say:
I doubt we ever want to Deprecate the use of "plain stdin" as the default (or 
as an explicit) parameter for FieldStorage's fp parameter.  Most usage of 
FieldStorage will want to use stdin; if FieldStorage detects that stdin is 
TextIOBase (generally it is) and uses its buffer to get binary data, that is 
very convenient for the typical CGI application.  I think I agree with the rest 
of your comments.

Etienne said:
is sendfile() available on Windows ? i thought the Apache server could
use that to upload files without having to buffer files in memory..

I say:
I don't think it is called that, but similar functionality may be available on 
Windows under another name.  I don't know if Apache uses it or not.  But I have 
no idea how FieldStorage could interact with Apache via the CGI interface, to 
access such features.  I'm unaware of any APIs Apache provides for that 
purpose, but if there are some, let me know.  On the other hand, there are 
other HTTP servers besides Apache to think about. 

I'm also not sure if sendfile() or equivalent, is possible to use from within 
FieldStorage, because it seems in practice we don't know the size of the 
uploaded file without parsing it (which requires buffering it in memory to look 
at it).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4953>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to