Skip to content
Snippets Groups Projects
Commit 588f1e9a authored by Augie Fackler's avatar Augie Fackler
Browse files

http: work around custom http client classes that refuse extra attrs

I have no idea what is going on with our custom http client code at Google,
but it chokes on these extra attributes we're tucking on http clients. Since
it feels more than a little wrong to just stuff extra data on a client, let's
degrade gracefully when the client class refuses the attributes.
parent 7e4ffe27
Branches
Tags
No related merge requests found
......@@ -405,5 +405,11 @@
return True
def close(self):
try:
reqs, sent, recv = (self._urlopener.requestscount,
self._urlopener.sentbytescount,
self._urlopener.receivedbytescount)
except AttributeError:
return
self.ui.note(_('(sent %d HTTP requests and %d bytes; '
'received %d bytes in responses)\n') %
......@@ -408,8 +414,6 @@
self.ui.note(_('(sent %d HTTP requests and %d bytes; '
'received %d bytes in responses)\n') %
(self._urlopener.requestscount,
self._urlopener.sentbytescount,
self._urlopener.receivedbytescount))
(reqs, sent, recv))
# End of ipeerconnection interface.
......
......@@ -442,7 +442,10 @@
data = self._raw_read(amt)
self.receivedbytescount += len(data)
self._connection.receivedbytescount += len(data)
try:
self._connection.receivedbytescount += len(data)
except AttributeError:
pass
try:
self._handler.parent.receivedbytescount += len(data)
except AttributeError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment