Re: mod_python.util.StorageField.read_to_boundary has problems in
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Re: mod_python.util.StorageField.read_to_boundary has problems in




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

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


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 10: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:
> 
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:59 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register