Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Jim Gallacher
Nicolas Lehuen wrote: Well, I've re-read the previous code and it looks like it does almost the same thing except it is bugged :). CherryPy's implementation is almost the same except it ought to work. Jim, I've integrated your tricky file into the unit test. Alexis' version passes all tests,

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Jim Gallacher
Alexis Marrero wrote: Jim, Nicolas, Thanks for sending the function that creates the test file. However I ran it to create the test file, and after uploading the file the MD5 still the same. Did you call it with the same block size as you are using in your code? The '\r' character must app

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Jim Gallacher
Jim Gallacher wrote: Alexis Marrero wrote: Jim, Thanks for sending the function that creates the test file. However I ran it to create the test file, and after uploading the file the MD5 still the same. Just to clarify, is this for your new read_to_boundary or the one in 3.2? If it's for y

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Alexis Marrero
Sorry for all this emails, but my system depends 100% on mod_python specially file uploading. :) On Nov 7, 2005, at 2:04 PM, Jim Gallacher wrote: Alexis Marrero wrote: Jim, Nicolas, Thanks for sending the function that creates the test file. However I ran it to create the test file, and a

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Jim Gallacher
Alexis Marrero wrote: Sorry for all this emails, No worries. It's a bug that needs to be fixed, so your work will benefit everyone. :) Jim

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Jim Gallacher
Alexis Marrero wrote: Ok. Now I'm confused. So am I! I've created a test harness so we can bypass mod_python completely. It includes a slightly modified version of read_to_boundary which adds a new parameter, readBlockSize. In the output from the test harness, your version is 'new' and the

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Alexis Marrero
New version of read_to_boundary(...) readBlockSize = 1 << 16 def read_to_boundary(self, req, boundary, file): previous_delimiter = '' while 1: line = req.readline(readBlockSize) if line.strip().startswith(boundary): break if line.endswith('\r\n'):

Re: mod_python.util.StorageField.read_to_boundary has problems in 3.1 and 3.2

2005-11-07 Thread Mike Looijmans
What i don't like at all in this implementation is the large amount of memcpy operations. 1. line.strip() 2. line[:-x] 3. previous_delimiter + ... The average pass will perform between two and three memcopy operations on the read block. Suggestion: Loose the strip() call - it serves no purpose