diff --git a/curl-timeout-head.patch b/curl-timeout-head.patch new file mode 100644 index 0000000..a104e0f --- /dev/null +++ b/curl-timeout-head.patch @@ -0,0 +1,48 @@ +commit 81d5f0fe31eb840f5e9b49afbb319d80ab03d107 +Author: Seth Vidal +Date: Tue Aug 4 11:57:49 2009 -0400 + + handle timeouts more correctly (with the exception) + and set timeouts to be connect timeouts since libcurl seems to actually honor timeouts - as opposed + to urllib. + closes rh bug # 515497 + +diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py +index cf51dff..5e3c0d7 100644 +--- a/urlgrabber/grabber.py ++++ b/urlgrabber/grabber.py +@@ -1542,13 +1542,12 @@ class PyCurlFileObject(): + # maybe to be options later + self.curl_obj.setopt(pycurl.FOLLOWLOCATION, 1) + self.curl_obj.setopt(pycurl.MAXREDIRS, 5) +- self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, 30) + + # timeouts + timeout = 300 + if opts.timeout: +- timeout = int(opts.timeout) +- self.curl_obj.setopt(pycurl.TIMEOUT, timeout) ++ self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, timeout) ++ + # ssl options + if self.scheme == 'https': + if opts.ssl_ca_cert: # this may do ZERO with nss according to curl docs +@@ -1607,12 +1606,17 @@ class PyCurlFileObject(): + # to other URLGrabErrors from + # http://curl.haxx.se/libcurl/c/libcurl-errors.html + # this covers e.args[0] == 22 pretty well - which will be common ++ if e.args[0] == 28: ++ err = URLGrabError(12, _('Timeout on %s: %s') % (self.url, e)) ++ err.url = self.url ++ raise err ++ code = self.http_code + if str(e.args[1]) == '': # fake it until you make it + msg = 'HTTP Error %s : %s ' % (self.http_code, self.url) + else: + msg = str(e.args[1]) + err = URLGrabError(14, msg) +- err.code = self.http_code ++ err.code = code + err.exception = e + raise err + diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec index 928fe29..2292657 100644 --- a/python-urlgrabber.spec +++ b/python-urlgrabber.spec @@ -3,8 +3,9 @@ Summary: A high-level cross-protocol url-grabber Name: python-urlgrabber Version: 3.9.0 -Release: 3%{?dist} +Release: 4%{?dist} Source0: urlgrabber-%{version}.tar.gz +Patch0: curl-timeout-head.patch License: LGPLv2+ Group: Development/Libraries @@ -22,6 +23,7 @@ authentication, proxies and more. %prep %setup -q -n urlgrabber-%{version} +%patch0 -p1 %build @@ -42,6 +44,10 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/urlgrabber %changelog +* Tue Aug 4 2009 Seth Vidal - 3.9.0-4 +- timeout patch for https://bugzilla.redhat.com/show_bug.cgi?id=515497 + + * Thu Jul 30 2009 Seth Vidal - 3.9.0-1 - new version - curl-based