robots.txt support for the tracker
Denis Ahrens <[email protected]>
| Newsgroups | gmane.network.bit-torrent.general |
|---|---|
| Message-ID | <[email protected]> |
Hi
This patch adds robots.txt support to the python tracker. Click the
following
google link and you know what I mean ;)
http://www.google.com/search?q=BitTorrent+download+info
Denis
Index: track.py
===================================================================
RCS file: /cvsroot/bittorrent/BitTorrent/BitTorrent/track.py,v
retrieving revision 1.96
diff -u -r1.96 track.py
--- track.py 4 Jun 2004 22:09:02 -0000 1.96
+++ track.py 18 Nov 2004 22:31:02 -0000
@@ -47,6 +47,7 @@
('keep_dead', 0, 'keep dead torrents after they expire (so they
still show up on your /scrape and web page)'),
('scrape_allowed', 'full', 'scrape access allowed (can be none,
specific or full)'),
('max_give', 200, 'maximum number of peers to give with any one
request'),
+ ('robots', '', 'file containing robots.txt data to return when a
bot passes by'),
]
def statefiletemplate(x):
@@ -133,6 +134,15 @@
h.close()
except:
print "**warning** specified favicon file -- %s --
does not exist." % favicon
+ robots = config['robots']
+ self.robots = None
+ if robots:
+ try:
+ h = open(robots, 'rb')
+ self.robots = h.read()
+ h.close()
+ except:
+ print "**warning** specified robots.txt file -- %s --
does not exist." % robots
self.rawserver = rawserver
self.becache1 = {}
self.becache2 = {}
@@ -347,6 +357,8 @@
return (200, 'OK', {'Content-Type':
'application/x-bittorrent', 'Content-Disposition': 'attachment;
filename=' + fname}, open(fpath, 'rb').read())
elif path == 'favicon.ico' and self.favicon != None:
return (200, 'OK', {'Content-Type' : 'image/x-icon'},
self.favicon)
+ elif path == 'robots.txt' and self.robots != None:
+ return (200, 'OK', {'Content-Type' : 'text/plain'},
self.robots)
if path != 'announce':
return (404, 'Not Found', {'Content-Type': 'text/plain',
'Pragma': 'no-cache'}, alas)
try:
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/BitTorrent/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/