I don't have a function that creates the files but the I can point
you to a file that has the problem, ironically is "Unix Haters
Handbook" :) Well, at least is not the Python HH....
http://research.microsoft.com/~daniel/uhh-download.html
It's MD5 is 9e8c42be55aac825e7a34d448044d0fe. I don't know what it
ends up been after upload with read_to_boundary().
When you use the function to copy the file you will see that the
digest will be e45979254297b0ece9c182a789d7966e.
I have other 5 files out of 78546 files that I'm testing it against
that have the same issues, coincidentally there are all PDF files.
Here is the script that I was testing it with.
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 = ''
#f = file('Perl Bookshelf [4th Ed]/mre/final/ch06.pdf.new', 'a+')
#f = file('Pages User Guide.app/Contents/Resources/Italian.lproj/
Pages Manuale Utente.pdf', 'a+')
f = file('ugh.pdf.new', 'a+')
f.write('\r\n--myboundary--\r\n')
f.seek(0)
o = file('test.bin', 'wb')
read_to_boundary(None, f, '--myboundary', o)
o.close()
/amn
On Nov 6, 2005, at 11:58 AM, Jim Gallacher wrote:
Alexis,
I wanted to add that I'm testing your code.
Alexis Marrero wrote:
Let me know any comments on it and if you test it and fails please
also let me know. I don't have subversion account neither I don't
know how to use it thus this email.
You don't need an account to use subversion anonymously. Just
install subversion and grab a mod_python working copy.
$ svn co http://svn.apache.org/repos/asf/httpd/mod_python/trunk trunk
This will checkout a working copy into a new directory called
"trunk" on your machine. All of the following commands assume you
are working in trunk/.
Make your changes in your working copy, and then create a diff with:
$ svn diff lib/python/mod_python/util.py > your-patch.diff
The other commands which you'll find immediately useful are:
svn update - update your working copy from the repository
svn status - shows status of changes in your working copy
svn -u status - shows status of your copy against the repository
I've found "Version Control with Subverion" is an excellent
resource and is available online.
http://svnbook.red-bean.com/en/1.1/index.html
Jim