From cac1a017271567123d415e07b1d29f76f8f11365 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Mon, 10 Aug 2009 16:22:50 +0200 Subject: [PATCH] Handle httplib errors (Debian bug 529740) Even though the usage of urllib2 should not throw any httplib errors, this works around the bug and lets urlwatch work with servers that send a bad status line. Thanks to Bastian Kleineidam for reporting. --- urlwatch | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/urlwatch b/urlwatch index 8aa39f6..075e040 100755 --- a/urlwatch +++ b/urlwatch @@ -85,6 +85,7 @@ except ImportError: import shutil import os import urllib2 +import httplib import socket import difflib import datetime @@ -263,6 +264,13 @@ if __name__ == '__main__': log.error('got timeout while loading url: %s' % error) if display_errors: details += foutput('error', url, error, summary) + except httplib.error, error: + # This is to workaround a bug in urllib2, see + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529740 + log.error('got httplib error while loading url: %s' % error) + if display_errors: + details += foutput('error', url, (repr(error) + + '\n' + str(error)).strip(), summary) count += 1 -- 2.11.4.GIT