robots.txt support for v3.9

Denis Ahrens <[email protected]>
Newsgroups gmane.network.bit-torrent.general
Message-ID <[email protected]>
Hi

I want to drop this patch here so I know where it is! ;)

Denis

--- track2.py 2004-12-30 23:12:29.000000000 +0100
+++ track.py 2004-12-30 23:39:34.000000000 +0100
@@ -62,6 +62,7 @@
  ('infopage_redirect', '', 'a URL to redirect the info page to'),
  ('show_names', 1, 'whether to display names from allowed dir'),
  ('favicon', '', 'file containing x-icon data to return when browser 
requests favicon.ico'),
+ ('robots', '', 'file containing robots.txt data to return when a 
bot/crawler requests robots.txt'),
  ('only_local_override_ip', 2, "ignore the ip GET parameter from 
machines which aren't on local network IPs (0 = never, 1 = always, 2 = 
ignore if NAT checking is not enabled). HTTP proxy headers giving 
address of original client are treated the same as --ip."),
  ('logfile', '', 'file to write the tracker logs, use - for stdout 
(default)'),
  ('allow_get', 0, 'use with allowed_dir; adds a /file?hash={hash} url 
that allows users to download the torrent file'),
@@ -205,6 +206,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,'r')
+ self.robots = h.read()
+ h.close()
+ except:
+ print "**warning** specified robots.txt file -- %s -- does not 
exist." % robots
  self.rawserver = rawserver
  self.cached = {} # format: infohash: [[time1, l1, s1], [time2, l2, 
s2], [time3, l3, s3]]
  self.cached_t = {} # format: infohash: [time, cache]
@@ -674,6 +684,8 @@
  return self.get_file(params('info_hash'))
  if path == 'favicon.ico' and self.favicon is not None:
  return (200, 'OK', {'Content-Type' : 'image/x-icon'}, self.favicon)
+ if path == 'robots.txt' and self.robots is not None:
+ return (200, 'OK', {'Content-Type' : 'image/x-icon'}, self.robots)
  if path != 'announce':
  return (404, 'Not Found', {'Content-Type': 'text/plain', 'Pragma': 
'no-cache'}, alas)



 
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.