equal
deleted
inserted
replaced
97 you probably just want to use the defaults, which will give you |
97 you probably just want to use the defaults, which will give you |
98 exceptions on errors. |
98 exceptions on errors. |
99 |
99 |
100 """ |
100 """ |
101 |
101 |
102 # $Id: keepalive.py,v 1.13 2005/10/22 21:57:28 mstenner Exp $ |
102 # $Id: keepalive.py,v 1.14 2006/04/04 21:00:32 mstenner Exp $ |
103 |
103 |
104 import urllib2 |
104 import urllib2 |
105 import httplib |
105 import httplib |
106 import socket |
106 import socket |
107 import thread |
107 import thread |
247 r._handler = self |
247 r._handler = self |
248 r._host = host |
248 r._host = host |
249 r._url = req.get_full_url() |
249 r._url = req.get_full_url() |
250 r._connection = h |
250 r._connection = h |
251 r.code = r.status |
251 r.code = r.status |
|
252 r.headers = r.msg |
|
253 r.msg = r.reason |
252 |
254 |
253 if r.status == 200 or not HANDLE_ERRORS: |
255 if r.status == 200 or not HANDLE_ERRORS: |
254 return r |
256 return r |
255 else: |
257 else: |
256 return self.parent.error('http', req, r, r.status, r.reason, r.msg) |
258 return self.parent.error('http', req, r, |
257 |
259 r.status, r.msg, r.headers) |
258 |
260 |
259 def _reuse_connection(self, h, req, host): |
261 def _reuse_connection(self, h, req, host): |
260 """start the transaction with a re-used connection |
262 """start the transaction with a re-used connection |
261 return a response object (r) upon success or None on failure. |
263 return a response object (r) upon success or None on failure. |
262 This DOES not close or remove bad connections in cases where |
264 This DOES not close or remove bad connections in cases where |
369 def close_connection(self): |
371 def close_connection(self): |
370 self._handler._remove_connection(self._host, self._connection, close=1) |
372 self._handler._remove_connection(self._host, self._connection, close=1) |
371 self.close() |
373 self.close() |
372 |
374 |
373 def info(self): |
375 def info(self): |
374 return self.msg |
376 return self.headers |
375 |
377 |
376 def geturl(self): |
378 def geturl(self): |
377 return self._url |
379 return self._url |
378 |
380 |
379 def read(self, amt=None): |
381 def read(self, amt=None): |