diff options
author | lioux <lioux@FreeBSD.org> | 2005-01-07 02:33:11 +0800 |
---|---|---|
committer | lioux <lioux@FreeBSD.org> | 2005-01-07 02:33:11 +0800 |
commit | 7872ab1432660ea7c5246de2b8419baeaff2917c (patch) | |
tree | f8802ae77efccc1fda44953488200a7647e6d466 /net | |
parent | fc571f0f566367f6a72b048b4612ef9f72e863f3 (diff) | |
download | freebsd-ports-gnome-7872ab1432660ea7c5246de2b8419baeaff2917c.tar.gz freebsd-ports-gnome-7872ab1432660ea7c5246de2b8419baeaff2917c.tar.zst freebsd-ports-gnome-7872ab1432660ea7c5246de2b8419baeaff2917c.zip |
o Add a missing exception handler around httplib requests
o Bump PORTREVISION
Approved by: portmgr (krion)
Obtained from: John Hoffman BitTornado Developer <theshadow@degreez.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/py-bittorrent-devel/Makefile | 2 | ||||
-rw-r--r-- | net/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py | 45 |
2 files changed, 46 insertions, 1 deletions
diff --git a/net/py-bittorrent-devel/Makefile b/net/py-bittorrent-devel/Makefile index c31c2dc04295..818fbc5b1bd7 100644 --- a/net/py-bittorrent-devel/Makefile +++ b/net/py-bittorrent-devel/Makefile @@ -7,7 +7,7 @@ PORTNAME= BitTorrent PORTVERSION= 3.9.0 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 1 CATEGORIES?= net python MASTER_SITES= http://www.bittorrent.com/ diff --git a/net/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py b/net/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py new file mode 100644 index 000000000000..0b6211e87d94 --- /dev/null +++ b/net/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py @@ -0,0 +1,45 @@ +--- BitTorrent/zurllib.py.orig Wed Jan 5 20:41:27 2005 ++++ BitTorrent/zurllib.py Wed Jan 5 20:41:50 2005 +@@ -10,7 +10,7 @@ + + # Written by John Hoffman + +-from httplib import HTTPConnection ++from httplib import HTTPConnection, HTTPException + from urlparse import urlparse + import socket + from gzip import GzipFile +@@ -20,6 +20,15 @@ + + MAX_REDIRECTS = 10 + ++class btHTTPcon(HTTPConnection): # attempt to add automatic connection timeout ++ def connect(self): ++ HTTPConnection.connect(self) ++ try: ++ self.sock.settimeout(30) ++ except: ++ pass ++ ++ + class urlopen: + def __init__(self, url): + self.tries = 0 +@@ -39,11 +48,14 @@ + if query: + url += '?'+query + # if fragment: +- self.connection = HTTPConnection(netloc) +- self.connection.request('GET', url, None, ++ try: ++ self.connection = btHTTPcon(netloc) ++ self.connection.request('GET', url, None, + { 'User-Agent': 'BitTorrent/' + version, + 'Accept-Encoding': 'gzip' } ) +- self.response = self.connection.getresponse() ++ self.response = self.connection.getresponse() ++ except HTTPException, e: ++ raise IOError, ('http error', str(e)) + status = self.response.status + if status in (301,302): + try: |