Mike Looijmans wrote:
I've attached a modified upload_test_harness.py that includes the new
and current, also the 'org' version (as in 3.1 release) and the 'mike'
version.
Nice changes, Mike.
I started to get confused by the names of the various read_to_boundary_*
functions, so I've made a slight modification to your code and renamed
these functions.
Note also that there are some failures for the split_boundary file using
offset -2 chunk [CR], so I've change the default offset to include this
condition.
I've also changed the generate_*file functions to embed an additional
'\r' in a short string. Just being paranoid I guess.
Diff is attached.
If it's useful I can stick the upload_test_harness code in the
mod_python svn repository.
Jim
--- upload_test_harness_mike.py.orig 2005-11-08 08:02:13.000000000 -0500
+++ upload_test_harness_mike.py 2005-11-08 08:54:15.000000000 -0500
@@ -14,8 +14,8 @@
## f.write('b'*block_size)
## f.close()
-def read_to_boundary_current(self, req, boundary, file, readBlockSize):
- ''' currrent version '''
+def read_to_boundary_324(self, req, boundary, file, readBlockSize):
+ ''' currrent version in 3.2.4b'''
#
# Although technically possible for the boundary to be split by the read,
this will
# not happen because the readBlockSize is set quite high - far longer than
any boundary line
@@ -66,7 +66,7 @@
else:
sline = ''
-def read_to_boundary_new(self, req, boundary, file, readBlockSize):
+def read_to_boundary_alexis(self, req, boundary, file, readBlockSize):
''' Alexis' version
read from the request object line by line with a maximum size,
until the new line starts with boundary
@@ -89,7 +89,7 @@
file.write(previous_delimiter + line)
previous_delimiter = ''
-def read_to_boundary_org(self, req, boundary, file, readBlockSize):
+def read_to_boundary_314(self, req, boundary, file, readBlockSize):
delim = ""
line = req.readline(readBlockSize)
while line and not line.startswith(boundary):
@@ -145,6 +145,8 @@
f = open(fname, 'wb')
f.write('a'*50)
+ f.write('\r')
+ f.write('a'*50)
f.write('\r\n')
block_size = readBlockSize + offset
@@ -163,6 +165,8 @@
"""
f = open(fname, 'wb')
f.write('a'*50)
+ f.write('\r')
+ f.write('a'*50)
f.write('\r\n')
block_size = readBlockSize + offset
@@ -171,7 +175,7 @@
f.close()
-read_boundaries = [read_to_boundary_current, read_to_boundary_new,
read_to_boundary_org, read_to_boundary_mike]
+read_boundaries = [read_to_boundary_324, read_to_boundary_alexis,
read_to_boundary_314, read_to_boundary_mike]
def main(file_generator, offset, chunk, block_size=1<<16):
fname_in = 'testfile.in'
@@ -218,6 +222,9 @@
pass
if __name__ == '__main__':
+ # offsets which show problems are in [-2, -1]
+ first_offset = -2
+ last_offset = 0
#test_chunks = ['', '\r', '\n', '\r\n']
@@ -229,7 +236,7 @@
print '='*40
print file_gen_obj.__name__
for chunk in test_chunks:
- for i in range(-1, 0):
+ for i in range(first_offset, last_offset):
print '-'*40
print 'test offset', i, 'chunk',[ cname(c) for c in chunk ]
print '-'*40