From abccff16ea2e6908c62dfe5592ee4e5c83016716 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 26 May 2004 23:00:21 +0000 Subject: [PATCH] fall back to GET on bad status line git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1317 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/HttpUrlData.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/linkcheck/HttpUrlData.py b/linkcheck/HttpUrlData.py index e1a76ee1..55bf449b 100644 --- a/linkcheck/HttpUrlData.py +++ b/linkcheck/HttpUrlData.py @@ -124,7 +124,16 @@ class HttpUrlData (ProxyUrlData): fallback = False redirectCache = [self.url] while True: - response = self._getHttpResponse() + try: + response = self._getHttpResponse() + except httplib2.BadStatusLine: + # some servers send empty HEAD replies + if self.method=="HEAD": + self.method = "GET" + redirectCache = [self.url] + fallback = True + continue + raise self.headers = response.msg debug(BRING_IT_ON, response.status, response.reason, self.headers) # proxy enforcement (overrides standard proxy)