http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9845
Revision: 9845
Author: xqt
Date: 2012-01-28 21:46:05 +0000 (Sat, 28 Jan 2012)
Log Message:
-----------
In rare cases we found a douple Content-Length in the header. We need to split it to get a
value.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2012-01-28 13:48:29 UTC (rev 9844)
+++ trunk/pywikipedia/wikipedia.py 2012-01-28 21:46:05 UTC (rev 9845)
@@ -5569,7 +5569,9 @@
contentEncoding = headers.get('content-encoding', '')
# Ensure that all sent data is received
- if int(headers.get('content-length', '0')) != len(text) and
'content-length' in headers:
+ # In rare cases we found a douple Content-Length in the header.
+ # We need to split it to get a value
+ if int(headers.get('content-length', '0').split(',')[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')))
return self.getUrl(path, retry, sysop, data, compress, no_hostname,
cookie_only, back_response)