##// END OF EJS Templates
keepalive: python 3 portability tweaks...
Augie Fackler -
r34428:a454123f default
parent child Browse files
Show More
@@ -92,6 +92,7 b' import threading'
92
92
93 from .i18n import _
93 from .i18n import _
94 from . import (
94 from . import (
95 pycompat,
95 util,
96 util,
96 )
97 )
97
98
@@ -235,7 +236,8 b' class KeepAliveHandler(object):'
235 # The string form of BadStatusLine is the status line. Add some context
236 # The string form of BadStatusLine is the status line. Add some context
236 # to make the error message slightly more useful.
237 # to make the error message slightly more useful.
237 except httplib.BadStatusLine as err:
238 except httplib.BadStatusLine as err:
238 raise urlerr.urlerror(_('bad HTTP status line: %s') % err.line)
239 raise urlerr.urlerror(
240 _('bad HTTP status line: %s') % pycompat.sysbytes(err.line))
239 except (socket.error, httplib.HTTPException) as err:
241 except (socket.error, httplib.HTTPException) as err:
240 raise urlerr.urlerror(err)
242 raise urlerr.urlerror(err)
241
243
@@ -358,9 +360,12 b' class HTTPResponse(httplib.HTTPResponse)'
358
360
359
361
360 def __init__(self, sock, debuglevel=0, strict=0, method=None):
362 def __init__(self, sock, debuglevel=0, strict=0, method=None):
363 extrakw = {}
364 if not pycompat.ispy3:
365 extrakw['strict'] = True
366 extrakw['buffering'] = True
361 httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel,
367 httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel,
362 strict=True, method=method,
368 method=method, **extrakw)
363 buffering=True)
364 self.fileno = sock.fileno
369 self.fileno = sock.fileno
365 self.code = None
370 self.code = None
366 self._rbuf = ''
371 self._rbuf = ''
General Comments 0
You need to be logged in to leave comments. Login now