[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-22 Thread shajianrui
shajianrui added the comment: Sorry for replying so late, and thank you very much for your reply and explanation. At first reply to you last post: I think at least in the non-unix environment, the CGIHTTPRequestHandler read the whole(expected) data from rfile and then transfer it to the

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-19 Thread vsbogd
vsbogd added the comment: My last comment was imprecise. Not `CGIHTTPRequestHandler` reads data from `rfile` but CGI script itself makes few reads. -- ___ Python tracker ___

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-19 Thread vsbogd
vsbogd added the comment: Hi @shajianrui, Thank you for such detailed explanation of experiments. As you mentioned it is a expected behavior of the io.RawIOBase.read() (see https://docs.python.org/3/library/io.html#io.RawIOBase), but io.BufferedIOBase.read() has different behavior (see

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-19 Thread shajianrui
shajianrui added the comment: Yes I reproduce this problem with a slight modification to your demo. Using your origianl version I fail to reproduce, maybe 2*65536 bytes size is too small. I just change the size of data (in test_cgi_client.py ) to 8*65536, 16*65536 and 32*65536, and the

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-19 Thread vsbogd
vsbogd added the comment: Hmm, seems strange I will try to reproduce and look at it. Have you run my demo which is attached to the bug? Does it reproduce problem on your machine? -- ___ Python tracker

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-18 Thread shajianrui
shajianrui added the comment: @vsbogd,Thank you for your reply. But I find another problem. I derive a subclass from sockerserver.StreamRequestHandler, and set the rbufsize to 0(As CGIHTTPRequestHandler do), like this demo below: testserver.py: import socketserver

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-17 Thread vsbogd
vsbogd added the comment: Yeah, I have seen this comment as well. As I see this code for the first time I am not very familiar with it. It seems that this explanation is related to the case when non-Python CGI script is executed: os.dup2(self.rfile.fileno(), 0)

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-16 Thread SilentGhost
Change by SilentGhost : -- nosy: +georg.brandl ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-16 Thread shajianrui
shajianrui added the comment: I have the same problem, and use a similar walk-around: 1. I set the rbufsize to -1 2. I use self.connection.recv instead of self.rfile.read(), like this: while select.select([self.connection], [], [], 0)[0]: if not self.connection.recv(1): However,

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-15 Thread vsbogd
vsbogd added the comment: Analysis: self.rfile.read(nbytes) https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L1207 Doesn't read full content of the file but only first chunk because self.rfile is not BufferedIO instance. In fact it is

[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-15 Thread vsbogd
New submission from vsbogd : Steps to reproduce: Use POST request with "multipart/form-data" encoding to pass long (more than 64KiB) file to the CGI script. Expected result: Script receives the whole file. Actual result: Script receives only first part which size is about size of the TCP