[patch] 3.4.2 track.py - fix for correct links with "--allow_get 1"

"Gregory P. Smith" <[email protected]>
Newsgroups gmane.network.bit-torrent.general
Message-ID <[email protected]>
The --allow_get 1 support in track.py is broken.  it uses a binary
sha1 in a hyperlink.  the attached patch against cvs fixes it to use
and expect a hex value.

  ----------

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	9 Oct 2004 09:17:54 -0000
@@ -255,7 +255,7 @@
                         szt = sz * n   # Transferred for this torrent
                         tt = tt + szt
                         if self.allow_get == 1:
-                            linkname = '<a href="/file?info_hash=' + quote(name) + '">' + self.allowed[name]['name'] + '</a>'
+                            linkname = '<a href="/file?info_hash=' + b2a_hex(name) + '">' + self.allowed[name]['name'] + '</a>'
                         else:
                             linkname = self.allowed[name]['name']
                         s.write('<tr><td><code>%s</code></td><td>%s</td><td align="right">%s</td><td align="right">%i</td><td align="right">%i</td><td align="right">%i</td><td align="right">%s</td></tr>\n' \
@@ -340,8 +340,8 @@
             return self.get_infopage()
         elif path == 'scrape':
             return self.get_scrape(paramslist)
-        elif (path == 'file') and (self.allow_get == 1) and params.has_key('info_hash') and self.allowed.has_key(params['info_hash']):
-            hash = params['info_hash']
+        elif (path == 'file') and (self.allow_get == 1) and params.has_key('info_hash') and self.allowed.has_key(a2b_hex(params['info_hash'])):
+            hash = a2b_hex(params['info_hash'])
             fname = self.allowed[hash]['file']
             fpath = self.allowed[hash]['path']
             return (200, 'OK', {'Content-Type': 'application/x-bittorrent', 'Content-Disposition': 'attachment; filename=' + fname}, open(fpath, 'rb').read())


[Non-text portions of this message have been removed]



------------------------ 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/
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.