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,
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
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
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
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
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
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'):
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