##// END OF EJS Templates
url: refactor _gen_sendfile
Mads Kiilerich -
r13420:051f4986 default
parent child Browse files
Show More
@@ -291,16 +291,16 class httpsendfile(object):
291 291 def __len__(self):
292 292 return self._len
293 293
294 def _gen_sendfile(connection):
294 def _gen_sendfile(orgsend):
295 295 def _sendfile(self, data):
296 296 # send a file
297 297 if isinstance(data, httpsendfile):
298 298 # if auth required, some data sent twice, so rewind here
299 299 data.seek(0)
300 300 for chunk in util.filechunkiter(data):
301 connection.send(self, chunk)
301 orgsend(self, chunk)
302 302 else:
303 connection.send(self, data)
303 orgsend(self, data)
304 304 return _sendfile
305 305
306 306 has_https = hasattr(urllib2, 'HTTPSHandler')
@@ -353,7 +353,7 if has_https:
353 353
354 354 class httpconnection(keepalive.HTTPConnection):
355 355 # must be able to send big bundle as stream.
356 send = _gen_sendfile(keepalive.HTTPConnection)
356 send = _gen_sendfile(keepalive.HTTPConnection.send)
357 357
358 358 def connect(self):
359 359 if has_https and self.realhostport: # use CONNECT proxy
@@ -595,7 +595,7 if has_https:
595 595 class httpsconnection(BetterHTTPS):
596 596 response_class = keepalive.HTTPResponse
597 597 # must be able to send big bundle as stream.
598 send = _gen_sendfile(BetterHTTPS)
598 send = _gen_sendfile(BetterHTTPS.send)
599 599 getresponse = keepalive.wrapgetresponse(httplib.HTTPSConnection)
600 600
601 601 def connect(self):
General Comments 0
You need to be logged in to leave comments. Login now