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