[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre, Looking better. I see you've retained the charset parameter, but do not pass it through to nested calls of FieldStorage. This is good, because it wouldn't work if you did. However, purists might still complain that FieldStorage should only ever use

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Pierre Quentel
Pierre Quentel added the comment: zip file with the updated cgi_test.py and associated files -- Added file: http://bugs.python.org/file20385/cgi_tests.zip ___ Python tracker ___

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Pierre Quentel
Pierre Quentel added the comment: diff for the updated version of test_cgi.py, compatible with cgi.py -- Added file: http://bugs.python.org/file20384/test_cgi_20111013.diff ___ Python tracker __

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-13 Thread Pierre Quentel
Pierre Quentel added the comment: I knew the builtins hack was terrible, thanks for the replies... I changed cgi.py with Glenn's IOMix class, and included the changes in make_file(). The patch is attached to this message Is it really too late to include it in 3.2 ? Missing a working cgi modul

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-12 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre said: The encoding used by the browser is defined in the Content-Type meta tag, or the content-type header ; if not, the default seems to vary for different browsers. So it's definitely better to define it The argument stream_encoding used in FieldSto

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-12 Thread Peter Kleiweg
Peter Kleiweg added the comment: Pierre Quentel wrote: - get the binary layer of stdout : out = sys.stdout.detach() You can't do that! That makes sys.stdout unavaible to the program that is importing the cgi module. Cgi should access and process sys.stdin only, as binary by means of sys.stdi

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-12 Thread Pierre Quentel
Pierre Quentel added the comment: Many thoughts and tests after... Glenn, the both of us were wrong : the encoding to use in FieldStorage is neither latin-1, nor sys.stdin.encoding : I tested form fields with characters whose utf-8 encoding has bytes that map to undefined in cp1252, the calls

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-12 Thread Glenn Linderman
Glenn Linderman added the comment: I'd be willing to propose such a patch and tests, but I haven't a clue how, other than starting by reading the contributor document... I was putting off learning the process until hg conversion, not wanting to learn an old process for a few months :( And I'

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-12 Thread R. David Murray
R. David Murray added the comment: Yes, the immanence of RC1 makes it really doubtful that this can be fixed in 3.2. Whether or not it can be fixed in 3.2.1 will depend on the nature of the fix. If it changes behavior such that currently working uses of FieldStorage (that don't deal with bi

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre, I applied your patch to my local copy of cgi.py for my installation of 3.2, and have been testing. Lots of things work great! My earlier comment regarding make_file seems to be relevant. Files that are not binary should have an encoding. Likely yo

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: I notice the version on this issue is Python 3.3, but it affects 3.2 and 3.1 as well. While I would like to see it fixed for 3.2, perhaps it is too late for that, with rc1 coming up this weekend? Could at least the non-deprecated parse functions be deprecat

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: Aha! Found a page which links to another page that explains the behavior. The synopsis is that

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Etienne Robillard
Etienne Robillard added the comment: On 11/01/11 07:36 PM, Glenn Linderman wrote: > Is there a newer standard these browsers are following, that permits UTF-8? > Or even requires it? > > Why is Pierre seeing cp-1252, and I'm seeing UTF-8? I'm running Windows 6.1 > (Build 7600), 64-bit, the s

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre said: Since it works the same with 2 browsers and 2 web servers, I'm almost sure it's not dependant on the configuration - but if others can tests on different configurations I'd like to know the result So I showed in my just previous messages (after

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Pierre Quentel
Pierre Quentel added the comment: @Glenn "I'm curious what your system (probably Windows since you mention cp-) and browser, and HTTP server is, that you used for that test. Is it possible to capture the data stream for that test? Describe how, and at what stage the data stream was captured

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Timothy Farrell
Changes by Timothy Farrell : -- nosy: -tercero12 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: In my previous message I quoted Pierre rightly cautioning about headers containing non-ASCII... and that BytesFeedParser doesn't, so using it to parse headers may be questionable. So I decided to try one... I show the Live HTTP headers below, from a simple

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: R. David: Pierre said: BytesFeedParser only uses the ascii codec ; if the header has non ASCII characters (filename in a multipart/form-data), they are replaced by ? : the original file name is lost. So for the moment I leave the text version of FeedParser

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-11 Thread Glenn Linderman
Glenn Linderman added the comment: I said: I wonder what result you get with the same browser, at the web page http://rishida.net/tools/conversion/ by entering the euro symbol into the Characters entry field, and choosing convert. But I couldn't wait, so I ran a test with € in one of my input

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman added the comment: Victor said: I mean: you should pass sys.stdin.buffer instead of sys.stdin. I say: That would be possible, but it is hard to leave it at default, in that case, because sys.stdin will, by default, not be a binary stream. It is a convenience for FieldStorage

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Pierre Quentel
Pierre Quentel added the comment: @Glenn " The _defined_ encoding of the original stream is irrelevant, in the same manner that if it is a text stream, that is irrelevant. The stream is binary, and latin-1, or it is non-standard" I wish it could be as simple, but I'm afraid it's not. On my P

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread STINNER Victor
STINNER Victor added the comment: > I set an attribute encoding to self.fp because, for each part > of a multipart/form-data, a new instance of FieldStorage is created, > and this instance needs to know how to decode bytes. Set fp.encoding may raise an error (eg. for a read-only object, or an

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread R. David Murray
R. David Murray added the comment: I don't have time to review the patch or even respond in detail to the comments right now, but I do want to respond about BytesFeedParser. It is true that there is currently no interface to get the raw-bytes version of the header back out of the Message obj

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman added the comment: Victor said: "Set sys.stdin.buffer.encoding attribute is not a good idea. Why do you modify fp, instead of using a separated attribute on FieldStorage (eg. self.fp_encoding)?" Pierre said: I set an attribute encoding to self.fp because, for each part of a m

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Pierre Quentel
Pierre Quentel added the comment: @Glenn "Also, the use of FeedParser could be replaced by BytesFeedParser, thus eliminating the need to decode header lines in that loop." BytesFeedParser only uses the ascii codec ; if the header has non ASCII characters (filename in a multipart/form-data), t

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman 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

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Etienne Robillard
Etienne Robillard added the comment: On 10/01/11 05:23 AM, Glenn Linderman wrote: > I'm basing this off the use of Firefox Live HTTP headers tool. > > is sendfile() available on Windows ? i thought the Apache server could use that to upload files without having to buffer files in memory.. H

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman added the comment: It seems the choice of whether to make_file or StringIO is based on the existence of self.length... per my previous comment, content-length doesn't seem to appear in any of the multipart/ item headers, so it is unlikely that real files will be created by thi

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman added the comment: I wrote: Additionally, if there is a CONTENT-LENGTH specified for non-binary data, the read_binary method should be used for it also, because it is much more efficient than readlines... less scanning of the data, and fewer outer iterations. This goes well w

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman added the comment: Also, the required behavior of make_file changes, to need the right encoding, or binary, so that needs to be documented as a change for people porting from 2.x. It would be possible, even for files, which will be uploaded as binary, for a user to know the ap

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-10 Thread Glenn Linderman
Glenn Linderman added the comment: This looks much simpler than the previous patch. However, I think it can be further simplified. This is my first reading of this code, however, so I might be totally missing something(s). Pierre said: Besides FieldStorage, I modified the parse() function a

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-09 Thread Pierre Quentel
Pierre Quentel added the comment: cgi tests -- Added file: http://bugs.python.org/file20323/cgi_tests.zip ___ Python tracker ___ ___ P

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-09 Thread Pierre Quentel
Pierre Quentel added the comment: Here is the diff file for the revised version of cgi.py FieldStorage tests if the stream is an instance of (a subclass of) io.TextIOBase. If true, data is read from its attribute buffer ; if it hasn't one (eg for StringIO instances), an AttributeException is

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-07 Thread STINNER Victor
STINNER Victor added the comment: I fixed #10841 (r87824): stdin (and all other files) is now set to binary (instead of text) mode on Windows. -- ___ Python tracker ___

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-07 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre said: Option 1 is impossible, because the CGI script sometimes has no control on the stream : for instance on a shared web host, it will receive sys.stdin as a text stream I say: It is the user code of the CGI script that calls CGI.FieldStorage. So t

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-07 Thread STINNER Victor
STINNER Victor added the comment: We may also accept TextIOWrapper (eg. sys.stdin) *and* BufferedReader/FileIO (eg. sys.stdin.buffer). It is possible to test the type of the stream. With a TextIOWrapper, the raw buffer can be read using stream.buffer. But for StringIO/BytesIO: only BytesIO shou

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-07 Thread Pierre Quentel
Pierre Quentel added the comment: Option 1 is impossible, because the CGI script sometimes has no control on the stream : for instance on a shared web host, it will receive sys.stdin as a text stream I also vote for option 3 ; explaining that if no argument is passed, the program will use sy

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread Glenn Linderman
Glenn Linderman added the comment: We have several, myself included, that can't use CGI under 3.x because it doesn't take a binary stream. I believe there are several alternatives: 1) Document that CGI needs a binary stream, and expect the user to provide it, either an explicit handle, or by

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread STINNER Victor
STINNER Victor added the comment: About the backward compatibility: does anyone use CGI with Python3? It looks like the module is broken (at least to upload files). If not, it's maybe better to fix it today than having to maintain a "broken" API. Python 3.2 has many incompatibles changes with

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread R. David Murray
R. David Murray added the comment: Ah, you are right. That makes the backward compatibility issue a lot worse :( -- ___ Python tracker ___ __

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Haypo: I believe that the consensus we've come to is that you > shouldn't have to. FieldStorage should take a binary stream. So > should cgi.parse. If defaulting to sys.stdin, then if stdin is text, > they should turn it in to a binary stream right at the s

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread R. David Murray
R. David Murray added the comment: Haypo: I believe that the consensus we've come to is that you shouldn't have to. FieldStorage should take a binary stream. So should cgi.parse. If defaulting to sys.stdin, then if stdin is text, they should turn it in to a binary stream right at the start

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread STINNER Victor
STINNER Victor added the comment: I tried full_source_and_error.zip on Windows and it failed. With stdio_binary.patch (attached to #10841), it works but I get an unicode file instead of a binary file. With stdio_binary.patch+cgi_plus_tests.diff it works as expected: I get a binary file (bytes

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread Glenn Linderman
Glenn Linderman added the comment: Etienne said: yes, lets not complexify anymore please... Albert Einstein said: Things should be as simple as possible, but no simpler. I say: My "learning" of HTTP predates "chunked". I've mostly heard of it being used in downloads rather than uploads, but

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread Etienne Robillard
Etienne Robillard added the comment: yes, lets not complexify anymore please... > Because the HTTP protocol is binary, only selected data, either explicitly or > implicitly (by standard definition) should be decoded, using the appropriate > encoding. FieldStorage should be able to (1) read a

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread Glenn Linderman
Glenn Linderman added the comment: Etienne, I'm not sure what you are _really_ referring to by HTTP_TRANSFER_ENCODING. There is a TRANSFER_ENCODING defined by HTTP but it is completely orthogonal to character encoding issues. There is a CONTENT_ENCODING defined which is a character encoding

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-06 Thread Etienne Robillard
Etienne Robillard added the comment: On 05/01/11 09:12 PM, Glenn Linderman wrote: > Glenn Linderman added the comment: > > Pierre said: > In all cases the interpreter must be launched with the -u option. As stated > in the documentation, the effect of this option is to "force the binary layer

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre said: In all cases the interpreter must be launched with the -u option. As stated in the documentation, the effect of this option is to "force the binary layer of the stdin, stdout and stderr streams (which is available as their buffer attribute) to b

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Antoine said: > (this is all funny in the light of the web-sig discussion where people > explain that CGI is such a natural model) > > Thanks for clarifying the stdin buffering vs. binary issue... it is as > I suspected. Maybe you can also explain the circum

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread Glenn Linderman
Glenn Linderman added the comment: R. David said: (I believe http uses latin-1 when no charset is specified, but I need to double check that) See http://bugs.python.org/issue4953#msg121864 ASCII and UTF-8 are what HTTP defines. Some implementations may, in fact, use latin-1 instead of ASCII i

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread Pierre Quentel
Pierre Quentel added the comment: I agree that the only consistent solution is to impose that the attribute self.fp must read bytes in all cases, all required conversions should occur inside FieldStorage, using "some" encoding (not sure how to define it...) If no argument fp is passed to __in

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I believe you are right that the io module does not support intermixing > calls to the main object and its buffer attribute; that's why detach > was introduced, I believe. Writing is ok as long as you call flush() on the text layer when necessary. Reading i

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread Éric Araujo
Éric Araujo added the comment: > I believe you are right that the io module does not support intermixing calls > to the main object and its buffer attribute I’ve learned in a recent discussion on web-sig that you can mix them, provided that you call stream.flush() before using stream.buffer.

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-05 Thread R. David Murray
R. David Murray added the comment: Yeah, the documentation for the email stuff is in the dev docs. There's a short summary in the changes section of the email intro with links to the classes and methods that are affected. But basically you call BinaryFeedParser and feed it a binary data, an

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-04 Thread Glenn Linderman
Glenn Linderman added the comment: R. David said: >From looking over the cgi code it is not clear to me whether Pierre's approach >is simpler or more complex than the alternative approach of starting with >binary input and decoding as appropriate. From a consistency perspective I >would pref

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-04 Thread R. David Murray
R. David Murray added the comment: Here is a modified version of the unittest file from unittest.zip that can be run against Pierre's code (it feeds FieldStorage a text stream with a buffer). Running the tests require the data files from the zip. They do not pass, in a very different way fro

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-04 Thread R. David Murray
R. David Murray added the comment: A day late, but I've looked at the patch. Now, I'm not all that knowledgeable about CGI, so other people will probably want to chime in here First, I'm uploading a new version of the patch as an svn diff (can be applied to a checkout using 'patch -p0 Fr

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-04 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Pierre Quentel
Pierre Quentel added the comment: Other version of the diff file. Nothing changed but I'm afraid I had left duplicate definitions of some methods in the FieldStorage class I follow the discussion on this thread, but would like to know if the patch has been tested and works -- Added fi

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Glenn Linderman
Glenn Linderman added the comment: (and I should mention that all the "hacked to work" issues in my copy of http.server have been reported as bugs, on 2010-11-21. The ones of most interest related to this binary bytestream stuff are issue 10479 and issue 10480) -- __

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Glenn Linderman
Glenn Linderman added the comment: David, Starting from a working (but hacked to work) version of http.server and using 3.2a1 (I should upgrade to the Beta, but I doubt it makes a difference at the moment), I modified # if hasattr( sys.stdin, 'buffer'): # sys.stdin = sys.s

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread R. David Murray
R. David Murray added the comment: Yes, that is my suggestion. Keep in mind that I haven't looked at the patch or run any tests yet :) If windows-specific hacks are needed to get the binary stream in 3.x, then IMO that's a bug in IO. As far as I know at the moment there's no such bug :) --

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Glenn Linderman
Glenn Linderman added the comment: So then David, is your suggestion to use sys.stdin = sys.stdin.detach() and you claim that the Windows-specific hacks are not needed in 3.x land? The are, in 2.x land, I have proven empirically, but haven't been able to test CGI forms very well in 3.x beca

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: -giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Etienne Robillard
Etienne Robillard added the comment: On 03/01/11 09:45 AM, R. David Murray wrote: > R. David Murray added the comment: > > Etienne: since this is about solving a 3.x specific problem, it will not get > backported. Issue 1573931 looks unrelated to me at a quick glance. FYI, you > will find t

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread R. David Murray
R. David Murray added the comment: Etienne: since this is about solving a 3.x specific problem, it will not get backported. Issue 1573931 looks unrelated to me at a quick glance. FYI, you will find that you *do* have detach in 2.7 if you open a file using the io subsystem (import io). Of c

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Etienne Robillard
Etienne Robillard added the comment: i'm thinking this issue is also well connected to: http://bugs.python.org/issue1573931 so a backport of whatever solution comes to 3.2 would be a great addition to Python 2.6 as the very minimum, in order to satisfy minimal backward compatibility! Thanks,

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-03 Thread Etienne Robillard
Etienne Robillard added the comment: On 02/01/11 10:50 PM, Glenn Linderman wrote: > Glenn Linderman added the comment: > > Rereading the doc link I pointed at, I guess detach() is part of the new API > since 3.1, so doesn't need to be checked for in 3.1+ code... but instead, may > need to be

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Glenn Linderman
Glenn Linderman added the comment: Rereading the doc link I pointed at, I guess detach() is part of the new API since 3.1, so doesn't need to be checked for in 3.1+ code... but instead, may need to be coded as: try: sys.stdin = sys.stdin.detach() except UnsupportedOperation:

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Glenn Linderman
Glenn Linderman added the comment: Peter, it seems that detach is relatively new (3.1) likely the code samples and suggestions that I had found to cure the problem predate that. While I haven't yet tried detach, your code doesn't seem to modify stdin, so are you suggesting, really... sys

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Shashwat Anand
Changes by Shashwat Anand : -- nosy: -l0nwlf ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Peter Kleiweg
Peter Kleiweg added the comment: Using platform-dependant code seems iffy to me. The detach function on sys.stdin, sys,stdout and sys.stderr is there specifically to switch these streams from text mode to binary mode. See: http://docs.python.org/py3k/library/sys.html#sys.stdin -- __

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Glenn Linderman
Glenn Linderman added the comment: Regarding the use of detach(), I don't know if it works. Maybe it would. I know my code works, because I have it working. But if there are simpler solutions that are shown to work, that would be great. -- ___ P

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Pierre Quentel
Pierre Quentel added the comment: Here is the correct diff file I also introduced a test to exit from the loop in read_multi() if the total number of bytes read reaches "content-length". It was necessary for my framework, which uses cgi.FieldStorage to read from the attribute rfile defined i

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Peter Kleiweg
Peter Kleiweg added the comment: Why not simply: fp = sys.stdin.detach() -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Glenn Linderman
Glenn Linderman added the comment: Pierre, thanks for your work on this. I hope a fix can make it in to 3.2. However, while starting Python with -u can help a but, that should not, in my opinion, be requirement to use CGI. Rather, the stdin should be set into binary mode by the CGI processi

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Pierre Quentel
Pierre Quentel added the comment: Please ignore previous post. I worked on the version of cgi.py included in version 3.2b2, and I just realized there were changes commited to the svn repository since this version. I will post the diff file later, but you can always test the files in the zip f

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Pierre Quentel
Pierre Quentel added the comment: I attach the svn diff file against the present version (generated by Tortoise SVN), hope it's what you expect -- Added file: http://bugs.python.org/file20229/cgi_diff.txt ___ Python tracker

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread R. David Murray
R. David Murray added the comment: Thank you very much for working on this! I'll try to take a look at the patch soon. A couple quick comments based on your posting: first, the email module now has a BytesFeedparser that will accept a byte stream, which I hope might simplify your patch. Se

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Etienne Robillard
Changes by Etienne Robillard : -- nosy: +erob ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2011-01-02 Thread Pierre Quentel
Pierre Quentel added the comment: Hi, I have started working on the port of a simplified version of Karrigell (a web framework) to Python3. I experienced the same problem as the other posters : in the current version, file upload doesn't work. So I've been working on the cgi module for a few

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-11-20 Thread Glenn Linderman
Glenn Linderman added the comment: Regarding http://bugs.python.org/issue4953#msg91444 POST with multipart/form-data encoding can use UTF-8, other stuff is restricted to ASCII! >From http://www.w3.org/TR/html401/interact/forms.html: Note. The "get" method restricts form data set values to ASCI

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-08-26 Thread Florent Xicluna
Changes by Florent Xicluna : -- nosy: +flox ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-07-17 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +l0nwlf, merwok ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-06-19 Thread Timothy Farrell
Timothy Farrell added the comment: Yes, they are related but not quite the same. The solution to this problem will likely include a fix to the problem described in issue 8077. -- ___ Python tracker __

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-06-16 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-06-16 Thread Guido van Rossum
Guido van Rossum added the comment: Could this be related to issue 8077? -- nosy: +gvanrossum ___ Python tracker ___ ___ Python-bugs-l

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2010-03-26 Thread Peter Kleiweg
Changes by Peter Kleiweg : -- nosy: +pebbe ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.or

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-11-16 Thread Thomas Courbon
Thomas Courbon added the comment: It seems that there wasn't work on that issue (which look complicated by the way). I'll wait, there is so much other aspects of a web framework to play with :) Thank anyway for the pointer. -- ___ Python tracker

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-11-15 Thread Timothy Farrell
Timothy Farrell added the comment: Perhaps this update should go in the linked email bug. The email team has a goal of fixing the email module in time for the 3.2 release. I also, feel as though I lack the skill to fix the email module, but it goes beyond that since they're potentially having

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-11-15 Thread Thomas Courbon
Thomas Courbon added the comment: *bump* Hi there Pythoners ! As Timothy Farrell I'm currently working (or rather, toying since it just for fun) on a Python3 web framework. I just started but when it come to file upload I experience issues which I believe are connected to that issue. Just wan

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-08-19 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Please, please, please contact the email-sig and help pitch in. For many reasons I simply haven't had the cycles to work on this and I don't see that happening any time soon. There are folks willing to work on the package in the email-sig and I will add my $0

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-08-18 Thread Timothy Farrell
Timothy Farrell added the comment: I thought I'd take a crack at this today. I soon figured out the real issue. It is the email.parser module that handles the decoding of Multipart/form-data things...and it is also still quote broken w.r.t. handling Bytes. So this issue is dependent on http:/

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-08-10 Thread Timothy Farrell
Timothy Farrell added the comment: I think you hit the nail on the head. Now we just need (someone) to code it. -- ___ Python tracker ___ ___

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-08-10 Thread tobias
tobias added the comment: Actually, I think this whole issue is more complex. For example, consider a (fictious) CGI script where users can upload an image and a description and the script sends a success/error message in return. In this case, one has to: - read the HTTP request header from std

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-06-08 Thread Timothy Farrell
Timothy Farrell added the comment: I've attached unittest.zip. Simply unzip it to a directory and run it. I've included a Python2.x version of the unittest for the sake of clarity. The 2.x version was developed on 2.4. The 3.x version was developed on 3.0.1 and 3.1rc1 (with identical results

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-06-05 Thread R. David Murray
R. David Murray added the comment: Can you provide a test case that clearly demonstrates the problem (preferably a unit test, but anything easily reproducible will do)? I'm not sure what to do with the code attached to the case. -- nosy: +r.david.murray priority: -> high stage: -> te

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-06-05 Thread Timothy Farrell
Timothy Farrell added the comment: I'm working on a web framework for Python 3. Naturally this is a blocker for me. I was kinda expecting this to be addressed in 3.1 but now that rc1 is out and I don't see anything about it, I'm wondering about the status of this bug. Can we get a status upda

[issue4953] cgi module cannot handle POST with multipart/form-data in 3.0

2009-04-15 Thread Timothy Farrell
Changes by Timothy Farrell : -- nosy: +tercero12 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

  1   2   >