aboutsummaryrefslogtreecommitdiff
path: root/net-p2p/py-bittorrent-devel/files
diff options
context:
space:
mode:
authorMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2005-01-06 18:33:11 +0000
committerMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2005-01-06 18:33:11 +0000
commitdc9079bdf7c95eda8555924f30e8920f3a5a3bac (patch)
treefb58354a3c7237a767ee1ba1381efac6eacf5412 /net-p2p/py-bittorrent-devel/files
parent4a58d04c9f78347e203510982d9f291d84a6fadb (diff)
downloadports-dc9079bdf7c95eda8555924f30e8920f3a5a3bac.tar.gz
ports-dc9079bdf7c95eda8555924f30e8920f3a5a3bac.zip
Notes
Diffstat (limited to 'net-p2p/py-bittorrent-devel/files')
-rw-r--r--net-p2p/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/net-p2p/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py b/net-p2p/py-bittorrent-devel/files/patch-BitTorrent::zurllib.py
new file mode 100644
index 000000000000..0b6211e87d94
--- /dev/null
+++ b/net-p2p/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: