W3C home > Mailing lists > Public > www-archive@w3.org > March 2011

Patch: archiverProxy mangles "newlines" on Win32

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sun, 06 Mar 2011 20:16:21 +0100
To: www-archive@w3.org
Message-ID: <h7n7n6l9njjqo1attfn07qmai4mi8fgqpv@hive.bjoern.hoehrmann.de>
Hi,

  http://logicerror.com/archiverProxy-code opens binary files in text
mode leading to data corruption on systems that translate certain
characters in text mode. This changes the modes to binary where I've
found that to be necessary:

  --- archiverProxy-code.old	2005-05-25 18:42:48.000000000 +0200
  +++ archiverProxy-code	2011-03-06 19:03:17.659851100 +0100
  @@ -233,7 +233,7 @@
   		# Create the directory name based on the URL
   		address = archive_url2filename(url)
   		# Open the file and store it in the dictionary:
  -		f = open(address, 'w')
  +		f = open(address, 'wb')
   		log('Opening file: '+address+'\n', v=2)
   		archive_files[klass] = [f, address]
   
  @@ -270,7 +270,7 @@
   		f.close()
   		address = address[:-len('.headers')]
   		log('Switching to file: '+address+' -- end of headers\n', v=2)
  -		f = open(address, 'w')
  +		f = open(address, 'wb')
   		archive_files[klass][0] = f
   		archive_files[klass][1] = address
   		archive_status[klass] = 'body'

regards,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Sunday, 6 March 2011 19:16:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:18:35 GMT