##// END OF EJS Templates
keepalive: use getattr to avoid AttributeErrors when vcr is in use...
Augie Fackler -
r40415:41506e3b default
parent child Browse files
Show More
@@ -315,7 +315,7 b' class KeepAliveHandler(object):'
315 return r
315 return r
316
316
317 def _start_transaction(self, h, req):
317 def _start_transaction(self, h, req):
318 oldbytescount = h.sentbytescount
318 oldbytescount = getattr(h, 'sentbytescount', 0)
319
319
320 # What follows mostly reimplements HTTPConnection.request()
320 # What follows mostly reimplements HTTPConnection.request()
321 # except it adds self.parent.addheaders in the mix and sends headers
321 # except it adds self.parent.addheaders in the mix and sends headers
@@ -353,11 +353,12 b' class KeepAliveHandler(object):'
353
353
354 # This will fail to record events in case of I/O failure. That's OK.
354 # This will fail to record events in case of I/O failure. That's OK.
355 self.requestscount += 1
355 self.requestscount += 1
356 self.sentbytescount += h.sentbytescount - oldbytescount
356 self.sentbytescount += getattr(h, 'sentbytescount', 0) - oldbytescount
357
357
358 try:
358 try:
359 self.parent.requestscount += 1
359 self.parent.requestscount += 1
360 self.parent.sentbytescount += h.sentbytescount - oldbytescount
360 self.parent.sentbytescount += (
361 getattr(h, 'sentbytescount', 0) - oldbytescount)
361 except AttributeError:
362 except AttributeError:
362 pass
363 pass
363
364
General Comments 0
You need to be logged in to leave comments. Login now