From 1300548d0a635d16c22457ea7c00fa7a716db5cb Mon Sep 17 00:00:00 2001 From: James Vega Date: Fri, 20 Feb 2004 22:46:10 +0000 Subject: [PATCH] We should also be catching timeouts on the read. --- src/webutils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/webutils.py b/src/webutils.py index 61a8e587d..b6b7287ef 100644 --- a/src/webutils.py +++ b/src/webutils.py @@ -69,10 +69,13 @@ def getUrlFd(url): def getUrl(url, size=None): """Gets a page. Returns a string that is the page gotten.""" fd = getUrlFd(url) - if size is None: - text = fd.read() - else: - text = fd.read(size) + try: + if size is None: + text = fd.read() + else: + text = fd.read(size) + except socket.timeout, e: + raise WebError, TIMED_OUT fd.close() return text