Revision: 4982 Author: rotem Date: 2008-02-05 18:13:45 +0000 (Tue, 05 Feb 2008)
Log Message: ----------- (bug 1887151) getUrl crashes when len(text) does not match content-length
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-02-05 17:43:16 UTC (rev 4981) +++ trunk/pywikipedia/wikipedia.py 2008-02-05 18:13:45 UTC (rev 4982) @@ -4030,11 +4030,12 @@
# Ensure that all sent data is received if int(headers.get('content-length', '0')) != len(text) and 'content-length' in headers: - output(u'Warning! len(text) does not match content-length: %s != %s' % \ - (len(text), headers.get('content-length'))) + output(u'Warning! len(text) does not match content-length: %s != %s' % \ + (len(text), headers.get('content-length'))) + if False: #self.persistent_http self.conn.close() self.conn.connect() - return self.getUrl(path, retry, sysop, data, compress) + return self.getUrl(path, retry, sysop, data, compress)
if compress and contentEncoding == 'gzip': text = decompress_gzip(text)