equal
deleted
inserted
replaced
313 DEBUG.info("re-using connection to %s (%d)", host, id(h)) |
313 DEBUG.info("re-using connection to %s (%d)", host, id(h)) |
314 |
314 |
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 |
322 # in a deterministic order (to make testing easier). |
322 # in a deterministic order (to make testing easier). |
323 headers = util.sortdict(self.parent.addheaders) |
323 headers = util.sortdict(self.parent.addheaders) |
351 if urllibcompat.hasdata(req): |
351 if urllibcompat.hasdata(req): |
352 h.send(data) |
352 h.send(data) |
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 |
364 class HTTPHandler(KeepAliveHandler, urlreq.httphandler): |
365 class HTTPHandler(KeepAliveHandler, urlreq.httphandler): |
365 pass |
366 pass |