summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2010-08-16 23:51:45 -0400
committerStef Walter <stefw@gnome.org>2012-09-18 10:11:47 +0200
commit8d92019665ee13288f6483725c8cedd318812566 (patch)
tree1c1e743fb5d7a226dd66c77b9a434e1054fcdbc1
parentef4f2df124459706f9e826038b47b57d49592829 (diff)
Workaround for the "bad status line" error. Not the most elegant thing in the world.
-rwxr-xr-xgit-bz24
1 files changed, 22 insertions, 2 deletions
diff --git a/git-bz b/git-bz
index b480b00..3e9268d 100755
--- a/git-bz
+++ b/git-bz
@@ -889,6 +889,12 @@ def get_connection(host, https):
return connections[identifier]
+def kill_connection(host, https):
+ identifier = (host, https)
+ if identifier in connections:
+ del connections[identifier]
+
+
class BugServer(object):
def __init__(self, host, path, https, auth_user=None, auth_password=None):
self.host = host
@@ -918,10 +924,24 @@ class BugServer(object):
url = self.path + url
seen_urls = []
+ retries = 0
connection = get_connection(self.host, self.https)
while True:
- connection.request(method, url, data, headers)
- response = connection.getresponse()
+
+ # BMO seems to generate some "bad status line" exception intermittently.
+ try:
+ connection.request(method, url, data, headers)
+ response = connection.getresponse()
+ except httplib.BadStatusLine:
+ retries = retries + 1
+ print "Got bad status line - retrying..."
+ connection.close()
+ kill_connection(self.host, self.https)
+ time.sleep(2)
+ connection = get_connection(self.host, self.https)
+ continue
+ retries = 0
+
seen_urls.append(url)
# Redirect status codes: