Apache Mod-Python - Re: mod_python.util.StorageField.read_to_boundary has problems in

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > November 2005 > Re: mod_python.util.StorageField.read_to_boundary has problems in





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: mod_python.util.StorageField.read_to_boundary has problems in
Jim Gallacher

2005-11-08, 5:56 pm

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
current version is 'cur'. Run it and see what happens.

Jim

$ ./upload_test_harness

========================================

generate_embedded_cr_file
----------------------------------------
test offset -1 chunk []
----------------------------------------
src 5a63347d1106afdfa264b2a61f81ae82
cur 5a63347d1106afdfa264b2a61f81ae82 PASS
new 5a63347d1106afdfa264b2a61f81ae82 PASS

----------------------------------------
test offset -1 chunk ['CR']
----------------------------------------
src 82204e52343d5b25c2e783cd59499973
cur e4af2eee73029642a114697ba59217b3 FAIL
new 82204e52343d5b25c2e783cd59499973 PASS

========================================

generate_split_boundary_file
----------------------------------------
test offset -1 chunk []
----------------------------------------
src d481990a0f0bbd8acf847cd732714555
cur d481990a0f0bbd8acf847cd732714555 PASS
new 8fa5ac9f913d778575ea871506c392a9 FAIL

----------------------------------------
test offset -1 chunk ['CR']
----------------------------------------
src 8fa5ac9f913d778575ea871506c392a9
cur d481990a0f0bbd8acf847cd732714555 FAIL
new 8fa5ac9f913d778575ea871506c392a9 PASS


> What I was trying to say is that I created a file with this function:
>
> def generate_split_file(offset=-1,
> readBlockSize=65368,
> fname='testfile'):
> f = open(fname, 'w')
> f.write('a'*50)
> f.write('\r\n')
> block_size = readBlockSize + offset
> f.write('b'*block_size)
> f.close()
>
> Then I uploaded 'testfile' using the following
> StorageField.read_to_boundary() method:
>
> def read_to_boundary(self, req, boundary, file):
> ''' read from the request object line by line with a maximum size,
> until the new line starts with boundary
> '''
> previous_delimiter = ''
> while 1:
> line = req.readline(1<<16)
> if line.startswith(boundary):
> break
>
> if line.endswith('\r\n'):
> file.write(previous_delimiter + line[:-2])
> previous_delimiter = '\r\n'
>
> elif line.endswith('\r') or line.endswith('\n'):
> file.write(previous_delimiter + line[:-1])
> previous_delimiter = line[-1:]
>
> else:
> file.write(previous_delimiter + line)
> previous_delimiter = ''
>
> And the md5 in the client is the same one as in the server. Do you
> have different results? Let me know.
>
> Regards,
> /amn
>
> On Nov 7, 2005, at 2:11 PM, Jim Gallacher wrote:
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com