--- bittorrent-3.4.2.orig/bittorrent.default +++ bittorrent-3.4.2/bittorrent.default @@ -0,0 +1,47 @@ +# Default configuration for bittorrent tracker, bttrack + +# If you want the bittorrent tracker to run, switch this to 1. +# If you change this, you will probably want to change +# ALLOWED_DIR as well, or anyone will be able to track anything +# just by pointing the .torrent at your server. +START_BTTRACK=0 + +# Set any bttrack option --foo by defining the variable FOO to the argument +# you'd like to pass with the --foo option. See `man bttrack` for a detailed +# discussion of the options. + +# Persistent state file +DFILE=/var/lib/bittorrent/bttrack.state + +# Port defaults to 80, which tends to be inconvenient +PORT=6969 + +# Only allow downloads for .torrent files in this directory +#ALLOWED_DIR=/srv/ftp + +# The following options do not correspond to bttrack options; they influence how +# bttrack's init script starts the daemon. + +# Run under this uid. Must have access to all files and directories involved, +# naturally, but should otherwise have minimal privileges to minimize any +# security risk. +#DAEMONUSER=bittorrent + +# chroot to this directory before starting the daemon. This can also help keep +# the daemon secure, but may interact with all sorts of file locations in +# unexpected ways. +#DAEMONCHROOT=/var/local/lib/bttrack-sandbox + +# Move to this directory before starting the daemon. This may be useful in +# conjunction with DAEMONCHROOT. +#DAEMONCHDIR=/var/local/lib/bttrack-sandbox + +# Run the daemon at this "nice" priority. Setting a positive value here will +# dissuade the system from giving all its CPU time to bttrack requests from the +# network. +DAEMONNICE=5 + +# Append log output from daemon to this file. Make sure this log is rotated +# from time to time so it doesn't fill up your disk. The daemon will of course +# need write access to the log file. +DAEMONLOGFILE=/var/log/bittorrent/bttrack.log --- bittorrent-3.4.2.orig/btreannounce.py +++ bittorrent-3.4.2/btreannounce.py @@ -1,11 +1,11 @@ #!/usr/bin/env python - + # Written by Henry 'Pi' James and Bram Cohen # see LICENSE.txt for license information - + from sys import argv from BitTorrent.bencode import bencode, bdecode - + if len(argv) < 3: print '%s http://new.uri:port/announce file1.torrent file2.torrent' % argv[0] print --- bittorrent-3.4.2.orig/btlaunchmany.py +++ bittorrent-3.4.2/btlaunchmany.py @@ -8,6 +8,7 @@ # see LICENSE.txt for license information from BitTorrent.download import download +from BitTorrent.fmt import fmttime, fmtsize from threading import Thread, Event, Lock from os import listdir from os.path import abspath, join, exists, getsize @@ -15,40 +16,6 @@ from time import sleep import traceback -def fmttime(n): - if n == -1: - return '(no seeds?)' - if n == 0: - return 'complete' - n = int(n) - m, s = divmod(n, 60) - h, m = divmod(m, 60) - if h > 1000000: - return 'n/a' - return '%d:%02d:%02d' % (h, m, s) - -def fmtsize(n, baseunit = 0, padded = 1): - unit = [' B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] - i = baseunit - while i + 1 < len(unit) and n >= 999: - i += 1 - n = float(n) / (1 << 10) - size = '' - if padded: - if n < 10: - size = ' ' - elif n < 100: - size = ' ' - if i != 0: - size += '%.1f %s' % (n, unit[i]) - else: - if padded: - size += '%.0f %s' % (n, unit[i]) - else: - size += '%.0f %s' % (n, unit[i]) - return size - - def dummy(*args, **kwargs): pass @@ -124,7 +91,9 @@ totaldown = 0 totaluptotal = 0.0 totaldowntotal = 0.0 - for file, threadinfo in threads.items(): + tdis = threads.items() + tdis.sort() + for file, threadinfo in tdis: uprate = threadinfo.get('uprate', 0) downrate = threadinfo.get('downrate', 0) uptxt = fmtsize(uprate, padded = 0) @@ -140,7 +109,7 @@ print '%s: try %d died, retry in %d' % (filename, trys, timeout) else: status = threadinfo.get('status','') - print '%s: Spd: %s/%s Tot: %s/%s [%s]' % (filename, uptxt, downtxt, uptotaltxt, downtotaltxt, status) + print '%s: Spd: %s/s:%s/s Tot: %s:%s [%s]' % (filename, uptxt, downtxt, uptotaltxt, downtotaltxt, status) totalup += uprate totaldown += downrate totaluptotal += uptotal @@ -150,7 +119,7 @@ totaldowntxt = fmtsize(totaldown, padded = 0) totaluptotaltxt = fmtsize(totaluptotal, baseunit = 2, padded = 0) totaldowntotaltxt = fmtsize(totaldowntotal, baseunit = 2, padded = 0) - print 'All: Spd: %s/%s Tot: %s/%s' % (totaluptxt, totaldowntxt, totaluptotaltxt, totaldowntotaltxt) + print 'All: Spd: %s/s:%s/s Tot: %s:%s' % (totaluptxt, totaldowntxt, totaluptotaltxt, totaldowntotaltxt) print stdout.flush() sleep(interval) @@ -176,7 +145,7 @@ self.done = 1 self.myinfo['done'] = 1 self.activity = 'complete' - self.display({'fractionDone' : 1}) + self.display({'fractionDone' : 1, 'downRate' : 0}) def err(self, msg): self.myinfo['errors'].append(msg) @@ -187,20 +156,21 @@ self.display() def choose(self, default, size, saveas, dir): + global filecheck self.myinfo['downfile'] = default self.myinfo['filesize'] = fmtsize(size) if saveas == '': saveas = default # it asks me where I want to save it before checking the file.. - self.myinfo['savefile'] = self.file[:-len(ext)] if exists(self.file[:-len(ext)]) and (getsize(self.file[:-len(ext)]) > 0): # file will get checked while (not filecheck.acquire(0) and not self.myinfo['kill'].isSet()): self.myinfo['status'] = 'disk wait' sleep(0.1) if not self.myinfo['kill'].isSet(): - self.myinfo['checking'] = 1 self.checking = 1 + self.myinfo['checking'] = 1 + self.myinfo['savefile'] = self.file[:-len(ext)] return self.file[:-len(ext)] def display(self, dict = {}): @@ -216,7 +186,7 @@ else: self.activity = activity elif timeEst is not None: - self.activity = fmttime(timeEst) + self.activity = fmttime(timeEst, 1) if fractionDone is not None: self.myinfo['status'] = '%s %.0f%%' % (self.activity, fractionDone * 100) else: --- bittorrent-3.4.2.orig/btrename.py +++ bittorrent-3.4.2/btrename.py @@ -1,33 +1,33 @@ #!/usr/bin/env python - -# Written by Henry 'Pi' James -# see LICENSE.txt for license information - -from sys import * -from os.path import * -from sha import * -from BitTorrent.bencode import * - -NAME, EXT = splitext(basename(argv[0])) -VERSION = '20021119' - -print '%s %s - change the suggested filename in a .torrent file' % (NAME, VERSION) -print - -if len(argv) != 3: - print '%s file.torrent new.filename.ext' % argv[0] - print - exit(2) # common exit code for syntax error - -metainfo_file = open(argv[1], 'rb') -metainfo = bdecode(metainfo_file.read()) -metainfo_file.close() -print 'old filename: %s' % metainfo['info']['name'] -metainfo['info']['name'] = argv[2] -print 'new filename: %s' % metainfo['info']['name'] -metainfo_file = open(argv[1], 'wb') -metainfo_file.write(bencode(metainfo)) -metainfo_file.close -print -print 'done.' -print + +# Written by Henry 'Pi' James +# see LICENSE.txt for license information + +from sys import * +from os.path import * +from sha import * +from BitTorrent.bencode import * + +NAME, EXT = splitext(basename(argv[0])) +VERSION = '20021119' + +print '%s %s - change the suggested filename in a .torrent file' % (NAME, VERSION) +print + +if len(argv) != 3: + print '%s file.torrent new.filename.ext' % argv[0] + print + exit(2) # common exit code for syntax error + +metainfo_file = open(argv[1], 'rb') +metainfo = bdecode(metainfo_file.read()) +metainfo_file.close() +print 'old filename: %s' % metainfo['info']['name'] +metainfo['info']['name'] = argv[2] +print 'new filename: %s' % metainfo['info']['name'] +metainfo_file = open(argv[1], 'wb') +metainfo_file.write(bencode(metainfo)) +metainfo_file.close +print +print 'done.' +print --- bittorrent-3.4.2.orig/setup.py +++ bittorrent-3.4.2/setup.py @@ -18,9 +18,8 @@ packages = ["BitTorrent"], - scripts = ["btdownloadgui.py", "btdownloadheadless.py", "btdownloadlibrary.py", - "bttrack.py", "btmakemetafile.py", "btlaunchmany.py", "btcompletedir.py", - "btdownloadcurses.py", "btcompletedirgui.py", "btlaunchmanycurses.py", - "btmakemetafile.py", "btreannounce.py", "btrename.py", "btshowmetainfo.py", - "bttest.py"] + scripts = ["btdownloadgui.py", "btdownloadheadless.py", + "bttrack.py", "btmakemetafile.py", "btlaunchmany.py", + "btdownloadcurses.py", "btlaunchmanycurses.py", + "btmakemetafile.py", "btreannounce.py", "btrename.py", "btshowmetainfo.py", "btcompletedir.py", "btcompletedirgui.py"] ) --- bittorrent-3.4.2.orig/btdownloadheadless.py +++ bittorrent-3.4.2/btdownloadheadless.py @@ -55,6 +55,8 @@ def error(self, errormsg): self.errors.append(errormsg) + if len(self.errors) > 5: + self.errors = self.errors[-5:] self.display({}) def display(self, dict): @@ -70,16 +72,16 @@ if dict.has_key('activity') and not self.done: self.timeEst = dict['activity'] if dict.has_key('downRate'): - self.downRate = '%.2f kB/s' % (float(dict['downRate']) / (1 << 10)) + self.downRate = '%.2f K/s' % (float(dict['downRate']) / (1 << 10)) if dict.has_key('upRate'): - self.upRate = '%.2f kB/s' % (float(dict['upRate']) / (1 << 10)) + self.upRate = '%.2f K/s' % (float(dict['upRate']) / (1 << 10)) if dict.has_key('upTotal'): - self.upTotal = '%.1f MiB' % (dict['upTotal']) + self.upTotal = '%.1f M' % (dict['upTotal']) if dict.has_key('downTotal'): - self.downTotal = '%.1f MiB' % (dict['downTotal']) + self.downTotal = '%.1f M' % (dict['downTotal']) print '\n\n' for err in self.errors: - print 'ERROR:\n' + err + '\n' + print 'ERROR: ' + err + '\n' print 'saving: ', self.file print 'percent done: ', self.percentDone print 'time left: ', self.timeEst @@ -95,7 +97,7 @@ stdout.flush() def chooseFile(self, default, size, saveas, dir): - self.file = '%s (%.1f MB)' % (default, float(size) / (1 << 20)) + self.file = '%s (%.1f M)' % (default, float(size) / (1 << 20)) if saveas != '': default = saveas self.downloadTo = abspath(default) --- bittorrent-3.4.2.orig/btmakemetafile.py +++ bittorrent-3.4.2/btmakemetafile.py @@ -29,7 +29,7 @@ def dummy(v): pass -def make_meta_file(file, url, piece_len_exp, +def make_meta_file(file, url, piece_len_exp = 18, flag = Event(), progress = dummy, progress_percent=1, comment = None, target = None): piece_length = 2 ** piece_len_exp a, b = split(file) --- bittorrent-3.4.2.orig/bittorrent.init +++ bittorrent-3.4.2/bittorrent.init @@ -0,0 +1,125 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: bittorrent +# Required-Start: $network $local_fs +# Required-Stop: $network $local_fs +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start a bittorrent tracker +# Description: Starts a bittorrent tracker, which +# aids bittorrent clients by locating +# other clients. +### END INIT INFO + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="BitTorrent tracker" +NAME=bttrack.bittorrent +DAEMON=/usr/bin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/bittorrent + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +PORT=6969 +DFILE=/var/lib/bittorrent/bttrack.state + +# Read config file if it is present. +if [ -r /etc/default/bittorrent ]; then + . /etc/default/bittorrent +fi + +# Add optional option $1 with argument $2 to OPTS, if $2 is nonempty +add_opt () { + if ! test -z "$2" ; then + OPTS="$OPTS $1 $2" + fi +} + +# Compose command-line arguments list for bttrack daemon, based on variables +# set in /etc/default/$NAME +OPTS="" +add_opt --dfile "$DFILE" +add_opt --port "$PORT" +add_opt --bind "$BIND" +add_opt --socket_timeout "$SOCKET_TIMEOUT" +add_opt --save_dfile_interval "$SAVE_DFILE_INTERVAL" +add_opt --timeout_downloaders_interval "$TIMEOUT_DOWNLOADERS_INTERVAL" +add_opt --reannounce_interval "$REANNOUNCE_INTERVAL" +add_opt --respose_size "$RESPONSE_SIZE" +add_opt --timeout_check_interval "$TIMEOUT_CHECK_INTERVAL" +add_opt --nat_check "$NAT_CHECK" +add_opt --min_time_between_log_flushes "$MIN_TIME_BETWEEN_LOG_FLUSHES" +add_opt --allowed_dir "$ALLOWED_DIR" +add_opt --parse_allowed_interval "$PARSE_ALLOWED_INTERVAL" +add_opt --show_names "$SHOW_NAMES" +add_opt --logfile "$DAEMONLOGFILE" +DAEMONOPTS="$OPTS" + +# Add arguments for start-stop-daemon, based on variables set in +# /etc/default/$NAME +OPTS="" +add_opt --chuid "$DAEMONUSER" +add_opt --chroot "$DAEMONCHROOT" +add_opt --chdir "$DAEMONCHDIR" +add_opt --nicelevel "$DAEMONNICE" +METAOPTS="$OPTS" + +# +#Function that starts the daemon/service. +# +d_start() { + if [ $START_BTTRACK -ne 1 ]; then + log_progress_msg "disabled in /etc/default/bittorrent" + return 1 + else + start-stop-daemon --start --background --quiet \ + --make-pidfile --pidfile "$PIDFILE" \ + $METAOPTS \ + --exec $DAEMON -- $DAEMONOPTS + return 0 + fi +} + +# +#Function that stops the daemon/service. +# +d_stop() { + start-stop-daemon --stop --oknodo --quiet --pidfile "$PIDFILE" +} + +case "$1" in + start) + log_daemon_msg "Starting $DESC" "$NAME" + d_start + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + d_stop + log_end_msg 0 + ;; + restart|force-reload) + log_daemon_msg "Restarting $DESC" "$NAME" + d_stop + sleep 1 + d_start + log_end_msg $? + ;; + status) + exit 4 + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 2 + ;; +esac + +exit 0 --- bittorrent-3.4.2.orig/btcompletedirgui.py +++ bittorrent-3.4.2/btcompletedirgui.py @@ -5,7 +5,7 @@ from sys import argv, version -from btcompletedir import completedir +from BitTorrent.btcompletedir import completedir from threading import Event, Thread from os.path import join, split from sys import argv @@ -40,11 +40,11 @@ b = wxBoxSizer(wxHORIZONTAL) b.Add(self.dirCtl, 1, wxEXPAND) - b.Add(10, 10, 0, wxEXPAND) + b.Add((10, 10), 0, wxEXPAND) button = wxButton(panel, -1, 'add file') b.Add(button, 0, wxEXPAND) EVT_BUTTON(frame, button.GetId(), self.select) - b.Add(5, 5, 0, wxEXPAND) + b.Add((5, 5), 0, wxEXPAND) c = wxButton(panel, -1, 'add dir') b.Add(c, 0, wxEXPAND) EVT_BUTTON(frame, c.GetId(), self.selectdir) @@ -66,7 +66,7 @@ border = wxBoxSizer(wxVERTICAL) border.Add(gridSizer, 0, wxEXPAND | wxNORTH | wxEAST | wxWEST, 25) b2 = wxButton(panel, -1, 'make') - border.Add(10, 10, 1, wxEXPAND) + border.Add((10, 10), 1, wxEXPAND) border.Add(b2, 0, wxALIGN_CENTER | wxSOUTH, 20) EVT_BUTTON(frame, b2.GetId(), self.complete) panel.SetSizer(border) @@ -119,7 +119,7 @@ gridSizer.Add(self.currentLabel, 0, wxEXPAND) self.gauge = wxGauge(panel, -1, range = 1000, style = wxGA_SMOOTH) gridSizer.Add(self.gauge, 0, wxEXPAND) - gridSizer.Add(10, 10, 1, wxEXPAND) + gridSizer.Add((10, 10), 1, wxEXPAND) self.button = wxButton(panel, -1, 'cancel') gridSizer.Add(self.button, 0, wxALIGN_CENTER) gridSizer.AddGrowableRow(2) --- bittorrent-3.4.2.orig/btcompletedir.py +++ bittorrent-3.4.2/btcompletedir.py @@ -7,7 +7,7 @@ from threading import Event from traceback import print_exc from sys import argv -from btmakemetafile import calcsize, make_meta_file, ignore +from BitTorrent.btmakemetafile import calcsize, make_meta_file, ignore def dummy(x): pass --- bittorrent-3.4.2.orig/btdownloadcurses.py +++ bittorrent-3.4.2/btdownloadcurses.py @@ -4,24 +4,13 @@ # see LICENSE.txt for license information from BitTorrent.download import download +from BitTorrent.fmt import fmtsize, fmttime from threading import Event from os.path import abspath from signal import signal, SIGWINCH from sys import argv, stdout from time import strftime, time -def fmttime(n): - if n == -1: - return 'download not progressing (file not being uploaded by others?)' - if n == 0: - return 'download complete!' - n = int(n) - m, s = divmod(n, 60) - h, m = divmod(m, 60) - if h > 1000000: - return 'n/a' - return 'finishing in %d:%02d:%02d' % (h, m, s) - def commaize(n): s = str(n) commad = s[-3:] @@ -30,30 +19,11 @@ commad = '%s,%s' % (s[-3:], commad) return commad -def fmtsize(n, baseunit = 0, padded = 1): - unit = [' B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] - i = baseunit - while i + 1 < len(unit) and n >= 999: - i += 1 - n = float(n) / (1 << 10) - size = '' - if padded: - if n < 10: - size = ' ' - elif n < 100: - size = ' ' - if i != 0: - size += '%.1f %s' % (n, unit[i]) - else: - if padded: - size += '%.0f %s' % (n, unit[i]) - else: - size += '%.0f %s' % (n, unit[i]) - return size - def winch_handler(signum, stackframe): global scrwin, scrpan, labelwin, labelpan, fieldw, fieldh, fieldwin, fieldpan + global winchanging # SIGWINCH. Remake the frames! + winchanging = 1 ## Curses Trickery curses.endwin() # delete scrwin somehow? @@ -68,9 +38,13 @@ fieldwin = curses.newwin(fieldh, fieldw, fieldy, fieldx) fieldpan = curses.panel.new_panel(fieldwin) prepare_display() + winchanging = 0 # This flag stops the torrent when set. mainkillflag = Event() +# This flag is set when winch is happening, so that we don't anger the curses gods +# by writing off the side of the screen +winchanging = 0 class CursesDisplayer: def __init__(self, mainerrlist): @@ -115,6 +89,9 @@ if self.last_update_time + 0.1 > time() and dict.get('fractionDone') not in (0.0, 1.0) and not dict.has_key('activity'): return self.last_update_time = time() + global winchanging + if winchanging == 1: + return global mainkillflag fractionDone = dict.get('fractionDone', None) timeEst = dict.get('timeEst', None) --- bittorrent-3.4.2.orig/btdownloadgui.py +++ bittorrent-3.4.2/btdownloadgui.py @@ -3,14 +3,17 @@ # Written by Bram Cohen and Myers Carpenter # see LICENSE.txt for license information -from sys import argv +from sys import argv, exit from BitTorrent import version from BitTorrent.download import download -from btdownloadheadless import print_spew +from BitTorrent.spewout import print_spew from threading import Event, Thread from os.path import join, split, exists from os import getcwd + from wxPython.wx import * +wxEVT_INVOKE = wxNewEventType() + from time import strftime, time from webbrowser import open_new from traceback import print_exc @@ -105,7 +108,7 @@ colSizer.Add(gridSizer, 0, wxEXPAND) colSizer.Add(rategridSizer, 0, wxEXPAND) - colSizer.Add(50, 50, 0, wxEXPAND) + colSizer.Add((50, 50), 0, wxEXPAND) self.cancelButton = wxButton(panel, -1, 'Cancel') colSizer.Add(self.cancelButton, 0, wxALIGN_CENTER) colSizer.AddGrowableCol(0) @@ -163,13 +166,15 @@ if timeEst is not None: self.timeEstText.SetLabel(hours(timeEst)) if downRate is not None: - self.downRateText.SetLabel('%.0f KiB/s' % (float(downRate) / (1 << 10))) + self.downRateText.SetLabel('%.0f K/s' % (float(downRate) / (1 << 10))) if upRate is not None: - self.upRateText.SetLabel('%.0f KiB/s' % (float(upRate) / (1 << 10))) + self.upRateText.SetLabel('%.0f K/s' % (float(upRate) / (1 << 10))) if downTotal is not None: self.downTotalText.SetLabel('%.1f M' % (downTotal)) if upTotal is not None: self.upTotalText.SetLabel('%.1f M' % (upTotal)) + self.frame.Refresh() + self.frame.Update() self.last_update_time = time() except: print_exc() @@ -228,7 +233,7 @@ return saveas = dl.GetPath() bucket[0] = saveas - self.fileNameText.SetLabel('%s (%.1f MB)' % (default, float(size) / (1 << 20))) + self.fileNameText.SetLabel('%s (%.1f M)' % (default, float(size) / (1 << 20))) self.timeEstText.SetLabel('Starting up...') self.fileDestText.SetLabel(saveas) self.filename = default @@ -266,30 +271,6 @@ def next(params, d, doneflag): try: - p = join(split(argv[0])[0], 'donated') - if not exists(p) and long(time()) % 3 == 0: - open_new('http://bitconjurer.org/BitTorrent/donate.html') - dlg = wxMessageDialog(d.frame, 'BitTorrent is Donation supported software. ' + - 'Please go to the donation page (which should be appearing for you now) and make a donation from there. ' + - 'Or you can click no and donate later.\n\nHave you made a donation yet?', - 'Donate!', wxYES_NO | wxICON_INFORMATION | wxNO_DEFAULT) - if dlg.ShowModal() == wxID_YES: - dlg.Destroy() - dlg = wxMessageDialog(d.frame, 'Thanks for your donation! You will no longer be shown donation requests.\n\n' + - "If you haven't actually made a donation and are feeling guilty (as you should!) you can always get to " + - "the donation page by clicking the 'about' link in the upper-right corner of the main BitTorrent window and " + - 'donating from there.', 'Thanks!', wxOK) - dlg.ShowModal() - dlg.Destroy() - try: - open(p, 'wb').close() - except IOError, e: - dlg = wxMessageDialog(d.frame, "Sorry, but I couldn't set the flag to not ask you for donations in the future - " + str(e), - 'Sorry!', wxOK | wxICON_ERROR) - dlg.ShowModal() - dlg.Destroy() - else: - dlg.Destroy() download(params, d.chooseFile, d.updateStatus, d.finished, d.error, doneflag, 100, d.newpath) if not d.fin: d.failed() --- bittorrent-3.4.2.orig/btlaunchmanycurses.py +++ bittorrent-3.4.2/btlaunchmanycurses.py @@ -4,10 +4,10 @@ # originally heavily borrowed code from btlaunchmany.py by Bram Cohen # and btdownloadcurses.py written by Henry 'Pi' James # now not so much. -# fmttime and fmtsize stolen from btdownloadcurses. # see LICENSE.txt for license information from BitTorrent.download import download +from BitTorrent.fmt import fmttime, fmtsize from threading import Thread, Event, Lock from os import listdir from os.path import abspath, join, exists, getsize @@ -16,38 +16,6 @@ from signal import signal, SIGWINCH import traceback -def fmttime(n): - if n == -1: - return 'download not progressing (no seeds?)' - if n == 0: - return 'download complete!' - n = int(n) - m, s = divmod(n, 60) - h, m = divmod(m, 60) - if h > 1000000: - return 'n/a' - return 'finishing in %d:%02d:%02d' % (h, m, s) - -def fmtsize(n, baseunit = 0, padded = 1): - unit = [' B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] - i = baseunit - while i + 1 < len(unit) and n >= 999: - i += 1 - n = float(n) / (1 << 10) - size = '' - if padded: - if n < 10: - size = ' ' - elif n < 100: - size = ' ' - if i != 0: - size += '%.1f %s' % (n, unit[i]) - else: - if padded: - size += '%.0f %s' % (n, unit[i]) - else: - size += '%.0f %s' % (n, unit[i]) - return size def dummy(*args, **kwargs): pass @@ -57,6 +25,7 @@ status = 'btlaunchmany starting..' filecheck = Lock() mainquitflag = Event() +winchanging = 0 def cleanup_and_quit(): status = 'Killing torrents..' @@ -126,67 +95,76 @@ def display_thread(displaykiller, mainquitflag): interval = 0.1 - global threads, status + global threads, status, mainwinh while 1: - inchar = mainwin.getch(); - if inchar == 12: # ^L - winch_handler() - elif inchar == ord('q'): # quit - mainquitflag.set() - # display file info - if (displaykiller.isSet()): - break - mainwin.erase() - winpos = 0 - totalup = 0 - totaldown = 0 - totaluptotal = 0.0 - totaldowntotal = 0.0 - for file, threadinfo in threads.items(): - uprate = threadinfo.get('uprate', 0) - downrate = threadinfo.get('downrate', 0) - uptxt = '%s/s' % fmtsize(uprate) - downtxt = '%s/s' % fmtsize(downrate) - uptotal = threadinfo.get('uptotal', 0.0) - downtotal = threadinfo.get('downtotal', 0.0) - uptotaltxt = fmtsize(uptotal, baseunit = 2) - downtotaltxt = fmtsize(downtotal, baseunit = 2) - filesize = threadinfo.get('filesize', 'N/A') - mainwin.addnstr(winpos, 0, threadinfo.get('savefile', file), mainwinw - 28, curses.A_BOLD) - mainwin.addnstr(winpos, mainwinw - 30, filesize, 8) - mainwin.addnstr(winpos, mainwinw - 21, downtxt, 10) - mainwin.addnstr(winpos, mainwinw - 10, uptxt, 10) - winpos = winpos + 1 - mainwin.addnstr(winpos, 0, '^--- ', 5) - if threadinfo.get('timeout', 0) > 0: - mainwin.addnstr(winpos, 6, 'Try %d: died, retrying in %d' % (threadinfo.get('try', 1), threadinfo.get('timeout')), mainwinw - 21) - else: - mainwin.addnstr(winpos, 6, threadinfo.get('status',''), mainwinw - 21) - mainwin.addnstr(winpos, mainwinw - 21, downtotaltxt, 8) - mainwin.addnstr(winpos, mainwinw - 10, uptotaltxt, 8) - winpos = winpos + 1 - totalup += uprate - totaldown += downrate - totaluptotal += uptotal - totaldowntotal += downtotal - # display statusline - statuswin.erase() - statuswin.addnstr(0, 0, status, mainwinw) - # display totals line - totaluptxt = '%s/s' % fmtsize(totalup) - totaldowntxt = '%s/s' % fmtsize(totaldown) - totaluptotaltxt = fmtsize(totaluptotal, baseunit = 2) - totaldowntotaltxt = fmtsize(totaldowntotal, baseunit = 2) - - totalwin.erase() - totalwin.addnstr(0, mainwinw - 29, 'Totals:', 7); - totalwin.addnstr(0, mainwinw - 21, totaldowntxt, 10) - totalwin.addnstr(0, mainwinw - 10, totaluptxt, 10) - totalwin.addnstr(1, mainwinw - 21, totaldowntotaltxt, 8) - totalwin.addnstr(1, mainwinw - 10, totaluptotaltxt, 8) - curses.panel.update_panels() - curses.doupdate() - sleep(interval) + if winchanging != 1: # writing now is okay. + inchar = mainwin.getch(); + if inchar == 12: # ^L + winch_handler() + elif inchar == ord('q'): # quit + mainquitflag.set() + # display file info + if (displaykiller.isSet()): + break + mainwin.erase() + winpos = 0 + totalup = 0 + totaldown = 0 + totaluptotal = 0.0 + totaldowntotal = 0.0 + tdis = threads.items() + tdis.sort() + missed = 0 + for file, threadinfo in tdis: + if (winpos + 3) >= mainwinh: + missed = missed + 1 + continue + uprate = threadinfo.get('uprate', 0) + downrate = threadinfo.get('downrate', 0) + uptxt = '%s/s' % fmtsize(uprate) + downtxt = '%s/s' % fmtsize(downrate) + uptotal = threadinfo.get('uptotal', 0.0) + downtotal = threadinfo.get('downtotal', 0.0) + uptotaltxt = fmtsize(uptotal, baseunit = 2) + downtotaltxt = fmtsize(downtotal, baseunit = 2) + filesize = threadinfo.get('filesize', 'N/A') + mainwin.addnstr(winpos, 0, threadinfo.get('savefile', file), mainwinw - 28, curses.A_BOLD) + mainwin.addnstr(winpos, mainwinw - 30, filesize, 8) + mainwin.addnstr(winpos, mainwinw - 21, downtxt, 10) + mainwin.addnstr(winpos, mainwinw - 10, uptxt, 10) + winpos = winpos + 1 + mainwin.addnstr(winpos, 0, '^--- ', 5) + if threadinfo.get('timeout', 0) > 0: + mainwin.addnstr(winpos, 6, 'Try %d: died, retrying in %d' % (threadinfo.get('try', 1), threadinfo.get('timeout')), mainwinw - 21) + else: + mainwin.addnstr(winpos, 6, threadinfo.get('status',''), mainwinw - 21) + mainwin.addnstr(winpos, mainwinw - 21, downtotaltxt, 8) + mainwin.addnstr(winpos, mainwinw - 10, uptotaltxt, 8) + winpos = winpos + 1 + totalup += uprate + totaldown += downrate + totaluptotal += uptotal + totaldowntotal += downtotal + if missed > 0: + mainwin.addnstr(winpos, 0, '(%d more)' % missed, mainwinw) + # display statusline + statuswin.erase() + statuswin.addnstr(0, 0, status, mainwinw) + # display totals line + totaluptxt = '%s/s' % fmtsize(totalup) + totaldowntxt = '%s/s' % fmtsize(totaldown) + totaluptotaltxt = fmtsize(totaluptotal, baseunit = 2) + totaldowntotaltxt = fmtsize(totaldowntotal, baseunit = 2) + + totalwin.erase() + totalwin.addnstr(0, mainwinw - 29, 'Totals:', 7); + totalwin.addnstr(0, mainwinw - 21, totaldowntxt, 10) + totalwin.addnstr(0, mainwinw - 10, totaluptxt, 10) + totalwin.addnstr(1, mainwinw - 21, totaldowntotaltxt, 8) + totalwin.addnstr(1, mainwinw - 10, totaluptotaltxt, 8) + curses.panel.update_panels() + curses.doupdate() + sleep(interval) class StatusUpdater: def __init__(self, file, params, name): @@ -239,6 +217,9 @@ return saveas def display(self, dict = {}): + global winchanging + if winchanging == 1: # If we write now, we could write off the edge of the + return # screen and make curses mad :( fractionDone = dict.get('fractionDone', None) timeEst = dict.get('timeEst', None) activity = dict.get('activity', None) @@ -285,15 +266,19 @@ def winch_handler(signum = SIGWINCH, stackframe = None): global scrwin, mainwin, mainwinw, headerwin, totalwin, statuswin global scrpan, mainpan, headerpan, totalpan, statuspan + global winchanging + winchanging = 1 # SIGWINCH. Remake the frames! ## Curses Trickery curses.endwin() - # delete scrwin somehow? scrwin.refresh() scrwin = curses.newwin(0, 0, 0, 0) - scrh, scrw = scrwin.getmaxyx() - scrpan = curses.panel.new_panel(scrwin) - ### Curses Setup + make_curses_window() + winchanging = 0 + +def make_curses_window(): + global scrwin, mainwin, mainwinw, headerwin, totalwin, statuswin + global scrpan, mainpan, headerpan, totalpan, statuspan, mainwinh scrh, scrw = scrwin.getmaxyx() scrpan = curses.panel.new_panel(scrwin) mainwinh = scrh - 5 # - 2 (bars) - 1 (debugwin) - 1 (borderwin) - 1 (totalwin) @@ -315,10 +300,12 @@ mainwin.scrollok(0) headerwin.scrollok(0) totalwin.scrollok(0) - statuswin.addstr(0, 0, 'window resize: %s x %s' % (scrw, scrh)) + statuswin.addstr(0, 0, 'window size: %s x %s' % (scrw, scrh)) statuswin.scrollok(0) prepare_display() + + if __name__ == '__main__': if (len(argv) < 2): print """Usage: btlaunchmanycurses.py @@ -327,7 +314,7 @@ """ exit(-1) dietrace = 0 - try: + try: import curses import curses.panel scrwin = curses.initscr() @@ -338,31 +325,7 @@ exit(-1) try: signal(SIGWINCH, winch_handler) - ### Curses Setup - scrh, scrw = scrwin.getmaxyx() - scrpan = curses.panel.new_panel(scrwin) - mainwinh = scrh - 5 # - 2 (bars) - 1 (debugwin) - 1 (borderwin) - 1 (totalwin) - mainwinw = scrw - 4 # - 2 (bars) - 2 (spaces) - mainwiny = 2 # + 1 (bar) + 1 (titles) - mainwinx = 2 # + 1 (bar) + 1 (space) - # + 1 to all windows so we can write at mainwinw - mainwin = curses.newwin(mainwinh, mainwinw+1, mainwiny, mainwinx) - mainpan = curses.panel.new_panel(mainwin) - - headerwin = curses.newwin(1, mainwinw+1, 1, mainwinx) - headerpan = curses.panel.new_panel(headerwin) - - totalwin = curses.newwin(2, mainwinw+1, scrh-4, mainwinx) - totalpan = curses.panel.new_panel(totalwin) - - statuswin = curses.newwin(1, mainwinw+1, scrh-2, mainwinx) - statuspan = curses.panel.new_panel(statuswin) - mainwin.scrollok(0) - headerwin.scrollok(0) - totalwin.scrollok(0) - statuswin.addstr(0, 0, 'btlaunchmany started') - statuswin.scrollok(0) - prepare_display() + make_curses_window() displaykiller = Event() displaythread = Thread(target = display_thread, name = 'display', args = [displaykiller, mainquitflag]) displaythread.setDaemon(1) --- bittorrent-3.4.2.orig/debian/postinst +++ bittorrent-3.4.2/debian/postinst @@ -0,0 +1,44 @@ +#! /bin/sh +# postinst script for bittorrent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure|abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- bittorrent-3.4.2.orig/debian/bittorrent-multi-downloader.bittorrent.1 +++ bittorrent-3.4.2/debian/bittorrent-multi-downloader.bittorrent.1 @@ -0,0 +1,31 @@ +.TH "BITTORRENT-MULTI-DOWNLOADER" 1 "Jan 18 2003" +.SH NAME +bittorrent-multi-downloader \- multiple file clients for bittorrent +.SH SYNOPSIS +.nf +.B btlaunchmany \fIdirname\fP [ option ... ] +.B btlaunchmanycurses \fIdirname\fP [ option ... ] +.fi +.SH DESCRIPTION +This manual page documents briefly the \fBbtlaunchmany\fP and +\fBbtlaunchmanycurses\fP commands. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +\fBbtlaunchmany\fP is a program that eases the use of +bittorrent in multiple-downloader situations. The program checks +a directory for torrent files. When it finds any, it starts a +separate downloader thread for each file. +.SH OPTIONS + +These programs have the exact same options as the normal +downloaders, which are documented in \fBbittorrent-downloader\fP(1). + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1), +.BR bttrack (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/rules +++ bittorrent-3.4.2/debian/rules @@ -0,0 +1,124 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +PYDEF=$(shell pyversions -d) +PYVERS=$(shell pyversions -r) + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp fix-doc + +build-stamp: configure-stamp + dh_testdir + set -e + + for python in $(PYVERS); do \ + python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \ + $$python setup.py build; \ + done + touch build-stamp + +clean: + dh_testroot + dh_testdir + for python in $(PYVERS); do \ + python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \ + $$python setup.py clean; \ + done + rm -f build-stamp configure-stamp + dh_clean + + rm -rf build/ BitTorrent/*.pyc *.pyc + rm -rf www-doc/bittorrent_logo.png + + dh_clean + +update-doc: + if [ ! -d www-doc ] ; then mkdir www-doc ; fi + cd www-doc && /usr/bin/wget --proxy=off -L -nd -A html,png,gif -k --no-parent -q -m -r -l 1 http://bitconjurer.org/BitTorrent/documentation.html + find www-doc -type f -a \( -name "*.gif" -o -name "*.png" \) | \ + while read file ; do cat www-doc/`basename $$file` | uuencode `basename $$file` > www-doc/`basename $$file`.uu ; done + -rm -f www-doc/robots.txt www-doc/*.gif www-doc/*.png + +clean-doc: + -rm -f www-doc/* + +fix-doc: + # We do this in order to prevent dpkg-source from breaking + cd www-doc/ && for i in *.uu; do uudecode $$i; done + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + set -e; \ + for python in $(PYVERS); do \ + pydir=$$python \ + python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \ + $$python setup.py install --root=debian/tmp; \ + cp debian/tmp/usr/bin/btmakemetafile.py \ + debian/tmp/usr/bin/btcompletedir.py \ + debian/tmp/usr/lib/$$pydir/site-packages/BitTorrent; \ + done + + : # Replace all '#!' calls to python with /usr/bin/python + : # and make them executable + for i in `find debian -mindepth 3 -type f`; do \ + sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\1,' \ + $$i > $$i.temp; \ + if cmp --quiet $$i $$i.temp; then \ + rm -f $$i.temp; \ + else \ + mv -f $$i.temp $$i; \ + chmod 755 $$i; \ + echo "fixed interpreter: $$i"; \ + fi; \ + done + + + +# Build architecture-independent files here. +binary-arch: build install +# We have nothing to do by default. + + +# Build architecture-dependent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installmenu + dh_installmime + dh_installman + # .bittorrent for alternatives + ( cd debian/tmp/usr/bin && \ + for i in btdownloadgui btdownloadheadless bttrack btmakemetafile btlaunchmany btdownloadcurses btlaunchmanycurses btreannounce btrename btshowmetainfo btcompletedir btcompletedirgui; \ + do mv $$i.py $$i.bittorrent; done ) + dh_installchangelogs + dh_installinit + dh_install --sourcedir=debian/tmp + dh_link + dh_compress + dh_fixperms + dh_pysupport + dh_python + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- bittorrent-3.4.2.orig/debian/changelog +++ bittorrent-3.4.2/debian/changelog @@ -0,0 +1,319 @@ +bittorrent (3.4.2-11.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix bashism in debian/rules. Closes: #477252. + + -- Peter Eisentraut Sun, 25 May 2008 03:52:26 +0200 + +bittorrent (3.4.2-11) unstable; urgency=low + + * Add LSB logging functionality. (thanks David!) Closes: #384724 + * Clarify short desciptions of packages. Closes: #418964. + * Moved initscript into examples directory, as it was largely + unused. Closes: #423901. + * Example initscript now honors START_BTTRACK. Closes: 369831. + + -- Michael Janssen Tue, 15 May 2007 19:25:40 -0500 + +bittorrent (3.4.2-10) unstable; urgency=low + + * Remove dependency on obselete python-wxgtk2.4. + + -- Michael Janssen Wed, 18 Oct 2006 08:57:07 -0500 + +bittorrent (3.4.2-9) unstable; urgency=low + + * Acknowledge NMU. Closes: #383744 + * Remove nowxmsg code from btdownloadgui, since btdownloadgui depends + on python-wxgtk2.6 now, we don't need to detect it. + Closes: #393428 + * Remove wxWidgets detection code from btdownloadgui, we depend on it + so don't need to detect it anymore. Closes: #393431 + * Fix distutils shebang lines so that we don't depend on python2.3. + Closes: #387022 + * Add /var/log/bittorrent for the default log location when running + tracker from initscript. Closes: #383510 + * Add some helpful remarks in /etc/default/bittorrent. + + -- Michael Janssen Wed, 18 Oct 2006 08:44:08 -0500 + +bittorrent (3.4.2-8.1) unstable; urgency=medium + + * Non-maintainer upload. + * Applied a patch from Michael Vogt to make it work with python2.4 + (HTTPHandler.http_open() return changed) pulled from 3.4.2-3ubuntu2. + Closes: #383744 + + -- Mohammed Adnène Trojette Tue, 29 Aug 2006 16:43:05 +0200 + +bittorrent (3.4.2-8) unstable; urgency=low + + * Make BitTorrent modules accessible. Closes: #381586 + + -- Michael Janssen Sat, 5 Aug 2006 21:00:57 -0500 + +bittorrent (3.4.2-7) unstable; urgency=low + + * Output a period if we try to stop the tracker when it's not running. + Closes: #345902 + * Fix logging in tracker init script to actually log. + Closes: #369820 + * Install the init script at the defaults, since we disable the daemon + in /etc/default/bittorrent now. + * Add LSB comments to the top of the init script. + Closes: #376944 + * Add some code to fix the "GUI doesn't update" bug. + Closes: #212809 + * Python transition. + Closes: #380773 + + -- Michael Janssen Tue, 1 Aug 2006 23:21:15 -0500 + +bittorrent (3.4.2-6) unstable; urgency=medium + + * Change dependencies so that bittorrent-gui is installable again. + Closes: #323556 + * Include initscript (off by default) for bttrack. + Closes: #198848, #325573, #322736 + * Change URL in debian/copyright. Closes: #329706 + * Move fmttime and fmtsize into the library. Closes: #219381 + + -- Michael Janssen Tue, 29 Nov 2005 22:00:47 -0600 + +bittorrent (3.4.2-5) unstable; urgency=low + + * Fix btcompletedir(gui) so they work. Closes: #306398 + * Ship btcompletedir and btmakemetafile in site-packages so that + btcompletedir(gui) work. Closes: #298974 + * The fix for #284809 breaks many torrents, therefore I'm reversing it. + Closes: #315510 + * Don't continue trying to write torrent names when we don't have + space on the window to do so. Closes: #311547 + * Standards Version 3.6.2.0 + * New manpage btcompletedirgui.1. Closes: #311933 + + -- Michael Janssen Wed, 20 Jul 2005 20:24:29 -0500 + +bittorrent (3.4.2-4) unstable; urgency=high + + * High-urgency upload for sarge targetted probably-should-be-RC bugfix. + * Invoke update-alternatives --remove in the prerm scripts. This was not + only leaving dangling symlinks around, but preventing bittornado to + properly set up itself after bittorrent was removed. See dpkg bugs + #285686 and #308838 for reference. Thanks go highly to Adeodato Simó + for the patch. Closes: #286966, #281371. + * Reinitialize curses when the window is resized, and make a flag for + when the window is reinitializing - this should fix this persistent + bug. Closes: #247361. + * Added announce URL existence check. Closes: #267210. + * Use incoming ports as outgoing ports also for easier traffic shaping. + Closes: #284809. + * Limit errors spewed by btdownloadheadless to 5 so that they don't + fill up the screen. Closes: #296184. + * Remove mimetype stuff from scripts because dh_installmime does it + for us, isn't that nice? + * Place new btcompletedir manpage. Thanks to Danilo Piazzalunga. + Closes: #285187. + * Fix typos in bttrack.1. Closes: #288668, #310346. + * I'm so tired of the KiB/KB issue, so I'm following the lead of + a great tool called df. When it outputs human-readable units, + they're in powers of 2, but they don't have any B or iB or + whatever. BitTorrent in Debian is now similar. Closes: #289321. + * Fix bittorrent-downloader manpage so --spew and --max_initiate + don't run together. Closes: #306480. + + -- Michael Janssen Wed, 20 Jul 2005 17:04:27 -0500 + +bittorrent (3.4.2-3) unstable; urgency=low + + * Split bittorrent package into bittorrent and bittorrent-gui + to be compliant with Policy 11.8.1. closes: #180396 + + Falling back to btdownloadcurses from btdownloadgui + is pointless if it isn't installed. closes: #219466 + + This also solves the problem with the obsolete + message, it doesn't exist anymore. closes: #278583 + * Use the alternatives system so that we can all get along, + and be installed together in harmony. closes: #263003 + * Apply patch so that --allow_get uses hex for it's URLs + instead of raw SHA-1 binary hashes. closes: #275637 + * Fix typo in btlaunchmany. closes: #262974 + * Fix problem with guide.html. closes: #265506 + + -- Michael Janssen Sun, 7 Nov 2004 00:16:07 -0600 + +bittorrent (3.4.2-2) unstable; urgency=low + + * Changed KiB/s and KB/s to kB/s, changed / to : in btlaunchmany, + added "/s" to transfer rates. closes: #247236 + * Sort display of files on btlaunchmany, btlaunchmanycurses to be + sorted by torrent file name. closes: #247237 + * Set download rate to 0 when complete with file (btlaunchmany). + closes: #247239 + * Add TOS setting code to outgoing as well as incomign connections. + closes: #253499 + + -- Michael Janssen Fri, 16 Jul 2004 09:57:43 -0500 + +bittorrent (3.4.2-1) unstable; urgency=low + + * New upstream release + + -- Michael Janssen Mon, 5 Apr 2004 01:23:54 -0500 + +bittorrent (3.4.1a-1) unstable; urgency=low + + * The "not enough time in the day" release. + * New upstream release. closes: #236740 + + Tracker problems don't popup error messages if the transfer + is still working anymore. closes: #217572 + * Use dh_python to get python deps and postinst handled, yay! + closes: #215119 + * Remove empty usr/sbin directory from the package. closes: #219382 + * Fix btreannounce manpage. closes: #228116 + * Add some html documentation to the package. (thanks Javier) + closes: #219038 + + -- Michael Janssen Fri, 26 Mar 2004 15:01:00 -0600 + +bittorrent (3.3-4) unstable; urgency=low + + * Made btdownloadgui exit cleanly when we can't find wxpython. + * Remove some useless code that got included from backport patches + when the 3.2.1 -> 3.3 switch happened. + + -- Michael Janssen Fri, 26 Mar 2004 13:36:40 -0600 + +bittorrent (3.3-3) unstable; urgency=low + + * Removed annoying and unreliable, non-policy compliant donation + asking code. closes: #215983, #212940 + * Re-add warning code for people who don't have wxpython. + * Fix manpage because btdownloadprefetched doesn't exist anymore. + closes: #213388 + + -- Michael Janssen Wed, 15 Oct 2003 21:13:47 -0500 + +bittorrent (3.3-2) unstable; urgency=low + + * The "test before you upload" release. + * Fixed problem with btdownloadgui because of executable renaming. + closes: #212662 + + -- Michael Janssen Wed, 24 Sep 2003 23:05:02 -0500 + +bittorrent (3.3-1) unstable; urgency=low + + * New upstream release + + Files/URLs accepted on command line now. closes: #200267 + + New allocation method. closes: #193455 + + Major curses updates. closes: #212172 + * Fixed typo in bittorrent-downloader page. closes: #211377 + + -- Michael Janssen Wed, 24 Sep 2003 21:51:19 -0500 + +bittorrent (3.2.1b-5) unstable; urgency=low + + * The "DOH!" release. + * Fix syntax error in btlaunchmanycurses. closes: #206135 + + -- Michael Janssen Mon, 18 Aug 2003 22:07:27 -0500 + +bittorrent (3.2.1b-4) unstable; urgency=low + + * The "why oh why am I not following CVS" release. + * Import the system function before we use it. closes: #196305 + * Release the lock if a thread dies while checking the file(s). + closes: #196397 + * Call WINCH handler when an error happens in btlaunchmanycurses, + so that the screen doesn't get as garbled. closes: #200559 + * Add ^L parsing to btdownloadcurses so that people can get rid of + annoying urllib bugs. closes: #200648, #195605 + * Repackage against new python. closes: #205850 + * Change error time displayed by btdownloadcurses to use the appropriate + locale's representation. closes: #196395 + + -- Michael Janssen Sun, 17 Aug 2003 19:23:33 -0500 + +bittorrent (3.2.1b-3) unstable; urgency=low + + * The "summer is finally here" release. + * Change btdownloadcurses to display only as many errors that can fit + on the screen. closes: #189371 + * Remove .py manpages I forgot about last time. closes: #191801 + * Fix mailcap so it doesn't point to a nonexistent script. + closes: #193502 + * Change the non-X11 entry to start the curses version + * Make files get closed cleanly. closes: #193624 + * Change the mass downloaders so they only check one torrent at a time + so we don't step on each other for disk accesses. closes: #193302 + + -- Michael Janssen Thu, 22 May 2003 18:19:08 -0500 + +bittorrent (3.2.1b-2) unstable; urgency=low + + * The "didn't I do this once already?" release. + * Change shebang line to use python2.2 (again). + closes: #190089, #190150 + * Rename scripts without .py and removed links. closes: #189304 + * Change recommends to libwxgtk2.4-python. closes: #189570 + * Fixed mailcap. closes: #189015, #188691 + + -- Michael Janssen Tue, 22 Apr 2003 08:51:37 -0500 + +bittorrent (3.2.1b-1) unstable; urgency=low + + * New Upstream Release. closes: #187054 + * Wrote manpages for bittorrent-multi-downloader, btrename, + btreannounce, btshowmetainfo + + -- Michael Janssen Fri, 11 Apr 2003 00:23:27 -0500 + +bittorrent (3.1-5) unstable; urgency=low + + * Change '/usr/bin/env python' to '/usr/bin/env python2.2' since + we depend on python > 2.2 | python2.2, and python2.2 doesn't + have 'python' in it. + * Call python2.2 in postinst as well. closes: #185852 + + -- Michael Janssen Sun, 23 Mar 2003 00:13:48 -0600 + +bittorrent (3.1-4) unstable; urgency=low + + * Add optional depend on python2.2 so we can get into testing. + * Add options --max_upload_rate, --check_hashes, --alloc_pause, and + --snub_time to bittorrent-downloaders.1. closes: #182634 + * Make btdownloadcurses die nicely and display the list of + arguments like btdownloadheadless does. closes: #183289 + * Change the filename in FAQ.txt to a unix-like filename. + closes: #179159 + * Update to Standards-Version 3.5.9. + * Update to debhelper 4, change depends line appropriately. + * Install btlaunchmany.py too. + + -- Michael Janssen Mon, 17 Mar 2003 02:03:32 -0600 + +bittorrent (3.1-3) unstable; urgency=low + + * Added python-dev to build-depends. closes: #179035 + * Changed wxGtk test to fail instead of pass when + libwxgtk2.2-python is installed, which bittorrent doesn't work + with. closes: #179047 + * Changed wxGtk failure message to note that libwxgtk2.2-python is + insufficient. + + -- Michael Janssen Thu, 30 Jan 2003 10:46:29 -0600 + +bittorrent (3.1-2) unstable; urgency=low + + * Don't ship .pyc. Compile .pyc and .pyo when installed. + * libwxgtk2.3-python isn't in testing, tell people this. + * Added mime-support to Suggests. + + -- Michael Janssen Fri, 24 Jan 2003 20:56:08 -0600 + +bittorrent (3.1-1) unstable; urgency=low + + * Initial Release. + + -- Michael Janssen Sat, 18 Jan 2003 02:23:11 -0600 + --- bittorrent-3.4.2.orig/debian/btcompletedir.bittorrent.1 +++ bittorrent-3.4.2/debian/btcompletedir.bittorrent.1 @@ -0,0 +1,47 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTCOMPLETEDIR" 1 "Feb 10 2005" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +btcompletedir \- makes a .torrent file for every specified file +.SH SYNOPSIS +.B btcompletedir \fItracker_announce_address\fP \fIfile\fP [\fIfile\fP...] +.SH DESCRIPTION +This manual page documents briefly the \fBbtcompletedir\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbtcompletedir\fP is a program that generates the torrent info files +which are distributed to bittorrent clients (usually via the WWW) in order +to inform them where the designated tracker for the torrent is located, and +to allow them to verify the file's contents. +.PP +\fBbtcompletedir\fP requires at least two arguments. The first is the +"announce" address of a tracker (ex. http://127.0.0.1:6969/announce). +Every subsequent argument is a file that the torrent info file will be +generated for. + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/bittorrent-gui.postinst +++ bittorrent-3.4.2/debian/bittorrent-gui.postinst @@ -0,0 +1,58 @@ +#! /bin/sh +# postinst script for bittorrent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + for i in btcompletedirgui btdownloadgui ; do + update-alternatives \ + --install /usr/bin/$i $i /usr/bin/$i.bittorrent 110 \ + --slave /usr/share/man/man1/$i.1.gz $i.1.gz /usr/share/man/man1/$i.bittorrent.1.gz + done + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + for i in btcompletedirgui btdownloadgui ; do + update-alternatives \ + --install /usr/bin/$i $i /usr/bin/$i.bittorrent 110 \ + --slave /usr/share/man/man1/$i.1.gz $i.1.gz /usr/share/man/man1/$i.bittorrent.1.gz + done + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- bittorrent-3.4.2.orig/debian/pycompat +++ bittorrent-3.4.2/debian/pycompat @@ -0,0 +1 @@ +2 --- bittorrent-3.4.2.orig/debian/bittorrent.prerm +++ bittorrent-3.4.2/debian/bittorrent.prerm @@ -0,0 +1,50 @@ +#! /bin/sh +# prerm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +PACKAGE="bittorrent" + +dpkg --listfiles $PACKAGE | + awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | + xargs rm -f >&2 + + + +case "$1" in + remove|upgrade|deconfigure) +# install-info --quiet --remove /usr/info/#PACKAGE#.info.gz + for i in btcompletedir btdownloadcurses btdownloadheadless btlaunchmany btlaunchmanycurses btmakemetafile btreannounce btrename btshowmetainfo bttrack ; do + update-alternatives --remove $i /usr/bin/$i.bittorrent + done + + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- bittorrent-3.4.2.orig/debian/bittorrent-downloader.bittorrent.1 +++ bittorrent-3.4.2/debian/bittorrent-downloader.bittorrent.1 @@ -0,0 +1,137 @@ +.TH "BITTORRENT-DOWNLOADER" 1 "Sep 24 2003" +.SH NAME +bittorrent-downloader \- download files using a scatter-gather network +.SH SYNOPSIS +.nf +.B btdownloadheadless [ option ... ] \fIURL\fB +.B btdownloadheadless [ option ... ] \fIfilename\fB +.B btdownloadcurses [ option ... ] \fIURL\fB +.B btdownloadcurses [ option ... ] \fIfilename\fB +.B btdownloadgui [ option ... ] \fIURL\fB +.B btdownloadgui [ option ... ] \fIfilename\fB +.fi +.br +.B +.SH DESCRIPTION +This manual page documents briefly the \fBbtdownloadheadless\fP, +\fBbtdownloadcurses\fP, and \fBbtdownloadgui\fP commands. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +These are all programs that allow a user to download files using +bittorrent, a peer to peer, scatter-gather network protocol. +They all have the same options. +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +.TP +.B \-\-responsefile \fIfilename\fP +treat \fIfilename\fP as a file which the server reponse was stored in. If this +option is used, no filename or URL should be present on the command line. +.TP +.B \-\-url \fIurl\fP +retrieve the torrent info file from \fIurl\fP. If this option is used, no +filename or URL should be present on the command line. +.TP +.B \-i \fIip\fP | \-\-ip \fIip\fP +report \fIip\fP as your IP to the tracker +.TP +.B \-\-bind \fIip\fP +bind to \fIip\fP instead of the default +.TP +.B \-\-minport \fIportnum\fP +set \fIportnum\fP as the minimum port to listen on, counts up if unavailable (default 6881) +.TP +.B \-\-maxport \fIportnum\fP +set \fIportnum\fP as the maximum port to listen on (default 6889) +.TP +.B \-\-saveas \fIfilename\fP +store the downloaded file to \fIfilename\fP, instead of querying user (gui) or +using the filename stored in the torrent info file +.TP +.B \-\-max_uploads \fInum\fP +Only allow \fInum\fP uploads at once (default 4) +.TP +.B \-\-max_upload_rate \fIkbytes\fP +maximum rate to upload at in kilobytes, 0 means no limit (default 0) +.TP +.B \-\-keepalive_interval \fIsecs\fP +pause \fIsecs\fP seconds between sending keepalives (default 120.0) +.TP +.B \-\-download_slice_size \fIbytes\fP +query for \fIbytes\fP bytes per request (default 32768) +.TP +.B \-\-request_backlog \fInum\fP +keep \fInum\fP requests in a single pipe at once (default 5) +.TP +.B \-\-max_message_length \fIbytes\fP +set \fIbytes\fP to the maximum length prefix encoding you'll accept over the wire - larger values get the connection dropped (default 8388608) +.TP +.B \-\-timeout \fIsecs\fP +wait \fIsecs\fP before closing sockets which nothing has been recieved on (default 300.0) +.TP +.B \-\-timeout_check_interval \fIsecs\fP +check whether connections have timed out every \fIsecs\fP seconds (default 60.0) +.TP +.B \-\-max_slice_length \fIbytes\fP +requests from peers larger than \fIbytes\fP bytes are ignored (default 131072) +.TP +.B \-\-max_rate_recalculate_interval \fIsecs\fP +connections that pause longer than \fIsecs\fP seconds are given reduced rate (default 15.0) +.TP +.B \-\-max_rate_period \fIsecs\fP +set \fIsecs\fP to the maximum amount of time to guess the current rate estimate represents (default 20.0) +.TP +.B \-\-upload_rate_fudge \fIsecs\fP +set the time equivalent of writing to kernel-level TCP buffer to \fIsecs\fP (default 5.0) +.TP +.B \-\-display_interval \fIsecs\fP +update displayed information every \fIsecs\fP seconds (default 0.1) +.TP +.B \-\-rerequest_interval \fIsecs\fP +request more peers every \fIsecs\fP seconds (default 300) +.TP +.B \-\-min_peers \fInum\fP +do not rerequest if we have \fInum\fP peers already (default 20) +.TP +.B \-\-http_timeout \fIsecs\fP +wait \fIsecs\fP seconds before assuming a http connection has timed out (default 60) +.TP +.B \-\-snub_time \fIsecs\fP +wait \fIsecs\fP seconds for data to come in over a connection before assuming it's semi-permanently choked (default 30.0) +.TP +.B \-\-spew \fI 1 | 0 \fP +whether to display diagnostic info to stdout. This option is not useful when +using btdownloadcurses or btdownloadgui. (default 0) +.TP +.B \-\-max_initiate \fInum\fP +stop initiating new connections when we have \fInum\fP peers (default 40) +.TP +.B \-\-check_hashes \fI 1 | 0 \fP +whether to check hashes on disk (defaults to 1) +.TP +.B \-\-report_hash_failures \fI 1 | 0 \fP +whether to report to the user that hash failuers occur (non-fatal, common error) (default 0) +.TP +.B \-\-rarest_first_priority_cutoff \fInum\fP +the number of peers which need to have a piece before other partials take +priority over rarest first (default 3) + +.SH SEE ALSO +.BR bttrack (1), +.BR btmakemetafile (1), +.BR btlaunchmany (1). + +More information on the \fBBitTorrent\fR protocol used for distributing files is available +at +.B http://bitconjurer.org/BitTorrent/protocol.html + +You will also find a full description on the advantages of the protocol in the academic paper +.B "Incentives Build Robustness in BitTorrent" +available at +.B http://bitconjurer.org/BitTorrent/bittorrentecon.pdf +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/bittorrent-gui.install +++ bittorrent-3.4.2/debian/bittorrent-gui.install @@ -0,0 +1 @@ +/usr/bin/*gui* --- bittorrent-3.4.2.orig/debian/bittorrent.docs +++ bittorrent-3.4.2/debian/bittorrent.docs @@ -0,0 +1,3 @@ +README.txt +credits.txt +www-doc/*.{html,png,gif} --- bittorrent-3.4.2.orig/debian/btrename.bittorrent.1 +++ bittorrent-3.4.2/debian/btrename.bittorrent.1 @@ -0,0 +1,44 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTRENAME" 1 "Jan 18 2003" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +btrename \- change the suggested filename inside a bittorrent file +.SH SYNOPSIS +\fBbttrack\fP \fItorrent\fP \fInewfilename\fP +.SH DESCRIPTION +This manual page documents briefly the \fBbtrename\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbtrename\fP is a program which will change the suggested +filename presented to the user for a bittorrent file. This +will make the downloader save it as a different name by default. +The torrent specified by the \fItorrent\fP option is modified +in-place, changing the suggested filename to \fInewfilename\fP. + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1), +.BR btreannounce (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/bittorrent.README.Debian +++ bittorrent-3.4.2/debian/bittorrent.README.Debian @@ -0,0 +1,10 @@ + +This package used to include a init script which was largely unused and +cluttered up the boot process unnecessarily. +It is preserved in the /usr/share/doc/bittorrent/examples directory with +it's defaults file. In order to restore previous functionality, simply run: + +# cp /usr/share/doc/bittorrent/examples/bittorrent.init /etc/init.d/bittorrent +# cp /usr/share/doc/bittorrent/examples/bittorrent.default /etc/default/bittorrent +# update-rc.d bittorrent defaults + --- bittorrent-3.4.2.orig/debian/control +++ bittorrent-3.4.2/debian/control @@ -0,0 +1,48 @@ +Source: bittorrent +Section: net +Priority: optional +Maintainer: Michael Janssen +Build-Depends: debhelper (>= 5.0.37.2) +Build-Depends-Indep: python-all-dev (>= 2.3.5-11), python, python-dev, sharutils, python-support (>= 0.3) +Standards-Version: 3.7.2.0 + +Package: bittorrent +Architecture: all +Depends: ${python:Depends}, lsb-base (>= 3.0-10) +Suggests: bittorrent-gui +Recommends: mime-support +Provides: ${python:Provides} +XB-Python-Version: ${python:Versions} +Description: Original BitTorent client - console tools + BitTorrent is a tool for distributing files. It's extremely + easy to use - downloads are started by clicking on hyperlinks. + Whenever more than one person is downloading at once + they send pieces of the file(s) to each other, thus relieving + the central server's bandwidth burden. Even with many + simultaneous downloads, the upload burden on the central server + remains quite small, since each new downloader introduces new + upload capacity. + . + This package contains the tools which are used for console-only + downloading. If you want the GUI interface, install the + bittorrent-gui package. + . + Homepage: http://bitconjurer.org/BitTorrent/ + +Package: bittorrent-gui +Architecture: all +Depends: ${python:Depends}, bittorrent (>= 3.4.2-1), python-wxgtk2.6 +XB-Python-Version: ${python:Versions} +Description: Original BitTorrent client - GUI tools + BitTorrent is a tool for distributing files. It's extremely + easy to use - downloads are started by clicking on hyperlinks. + Whenever more than one person is downloading at once + they send pieces of the file(s) to each other, thus relieving + the central server's bandwidth burden. Even with many + simultaneous downloads, the upload burden on the central server + remains quite small, since each new downloader introduces new + upload capacity. + . + This package contains the GUI tools for downloading. + . + Homepage: http://bitconjurer.org/BitTorrent/ --- bittorrent-3.4.2.orig/debian/postrm +++ bittorrent-3.4.2/debian/postrm @@ -0,0 +1,38 @@ +#! /bin/sh +# postrm script for bittorrent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 --- bittorrent-3.4.2.orig/debian/btcompletedirgui.bittorrent.1 +++ bittorrent-3.4.2/debian/btcompletedirgui.bittorrent.1 @@ -0,0 +1,42 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTCOMPLETEDIR" 1 "Feb 10 2005" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +btcompletedirgui \- GUI tool for creating .torrent files +.SH SYNOPSIS +.B btcompletedirgui +.SH DESCRIPTION +This manual page documents briefly the \fBbtcompletedirgui\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbtcompletedirgui\fP is a program that generates the torrent info files +which are distributed to bittorrent clients (usually via the WWW) in order +to inform them where the designated tracker for the torrent is located, and +to allow them to verify the file's contents. + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/copyright +++ bittorrent-3.4.2/debian/copyright @@ -0,0 +1,33 @@ +This package was debianized by Michael Janssen on +Sat, 18 Jan 2003 02:23:11 -0600. + +It was downloaded from http://www.bittorrent.com + +Upstream Author: Bram Cohen + +Copyright: + +Unless otherwise noted, all files are released under the MIT +license, exceptions contain licensing information in them. + +Copyright (C) 2001-2002 Bram Cohen + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +The Software is provided "AS IS", without warranty of any kind, +express or implied, including but not limited to the warranties of +merchantability, fitness for a particular purpose and +noninfringement. In no event shall the authors or copyright holders +be liable for any claim, damages or other liability, whether in an +action of contract, tort or otherwise, arising from, out of or in +connection with the Software or the use or other dealings in the +Software. --- bittorrent-3.4.2.orig/debian/bittorrent-gui.manpages +++ bittorrent-3.4.2/debian/bittorrent-gui.manpages @@ -0,0 +1 @@ +debian/btcompletedirgui.bittorrent.1 --- bittorrent-3.4.2.orig/debian/bittorrent-gui.links +++ bittorrent-3.4.2/debian/bittorrent-gui.links @@ -0,0 +1 @@ +usr/share/man/man1/bittorrent-downloader.bittorrent.1.gz usr/share/man/man1/btdownloadgui.bittorrent.1.gz --- bittorrent-3.4.2.orig/debian/btshowmetainfo.bittorrent.1 +++ bittorrent-3.4.2/debian/btshowmetainfo.bittorrent.1 @@ -0,0 +1,40 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTSHOWMETAINFO" 1 "Jan 18 2003" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +btshowmetainfo \- display information in bittorrent files +.SH SYNOPSIS +\fBbtshowmetainfo\fP \fIfile\fP [ file ... ] +.SH DESCRIPTION +This manual page documents briefly the \fBbtshowmetainfo\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbtshowmetainfo\fP is a program which will display the information +stored in a bittorrent file. + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/bittorrent.NEWS.Debian +++ bittorrent-3.4.2/debian/bittorrent.NEWS.Debian @@ -0,0 +1,5 @@ + +The initscript which was previously in this package has been removed because +it was largely unused and cluttered the boot process. Instructions +for enabling the init-script functionality are in +/usr/share/doc/bittorrent/README.Debian. --- bittorrent-3.4.2.orig/debian/bittorrent-gui.prerm +++ bittorrent-3.4.2/debian/bittorrent-gui.prerm @@ -0,0 +1,48 @@ +#! /bin/sh +# prerm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +PACKAGE="bittorrent" + +dpkg --listfiles $PACKAGE | + awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | + xargs rm -f >&2 + + + +case "$1" in + remove|upgrade|deconfigure) + for i in btcompletedirgui btdownloadgui ; do + update-alternatives --remove $i /usr/bin/$i.bittorrent + done + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- bittorrent-3.4.2.orig/debian/bittorrent.links +++ bittorrent-3.4.2/debian/bittorrent.links @@ -0,0 +1,4 @@ +usr/share/man/man1/bittorrent-downloader.bittorrent.1.gz usr/share/man/man1/btdownloadcurses.bittorrent.1.gz +usr/share/man/man1/bittorrent-downloader.bittorrent.1.gz usr/share/man/man1/btdownloadheadless.bittorrent.1.gz +usr/share/man/man1/bittorrent-multi-downloader.bittorrent.1.gz usr/share/man/man1/btlaunchmany.bittorrent.1.gz +usr/share/man/man1/bittorrent-multi-downloader.bittorrent.1.gz usr/share/man/man1/btlaunchmanycurses.bittorrent.1.gz --- bittorrent-3.4.2.orig/debian/pyversions +++ bittorrent-3.4.2/debian/pyversions @@ -0,0 +1 @@ +2.3- --- bittorrent-3.4.2.orig/debian/dirs +++ bittorrent-3.4.2/debian/dirs @@ -0,0 +1,4 @@ +usr/bin +usr/share/bittorrent +var/lib/bittorrent +var/log/bittorrent --- bittorrent-3.4.2.orig/debian/bittorrent-gui.mime +++ bittorrent-3.4.2/debian/bittorrent-gui.mime @@ -0,0 +1 @@ +application/x-bittorrent; /usr/bin/btdownloadgui --responsefile %s; test=test -n "$DISPLAY" --- bittorrent-3.4.2.orig/debian/btreannounce.bittorrent.1 +++ bittorrent-3.4.2/debian/btreannounce.bittorrent.1 @@ -0,0 +1,43 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTREANNOUNCE" 1 "Jan 18 2003" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +btreannounce \- change the announce address of a torrent file. +.SH SYNOPSIS +\fBbtreannounce\fP \fIurl\fP \fItorrent\fP [ \fItorrent\fP ... ] +.SH DESCRIPTION +This manual page documents briefly the \fBbtreannounce\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbtreannounce\fP is a program which will change the announce +address of one or more existing torrent files. +The torrent files will be modified to use the new +announce url given by the \fIurl\fP argument. + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1), +.BR btrename (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/bittorrent.examples +++ bittorrent-3.4.2/debian/bittorrent.examples @@ -0,0 +1,2 @@ +bittorrent.init +bittorrent.default --- bittorrent-3.4.2.orig/debian/btmakemetafile.bittorrent.1 +++ bittorrent-3.4.2/debian/btmakemetafile.bittorrent.1 @@ -0,0 +1,52 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTMAKEMETAFILE" 1 "Jan 18 2003" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +btmakemetafile \- program to generate torrent info files for bittorrent +.SH SYNOPSIS +.B btmakemetafile \fIfile\fP \fItracker_announce_address\fP [ option ... ] +.SH DESCRIPTION +This manual page documents briefly the \fBbtmakemetafile\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbtmakemetafile\fP is a program that generates the torrent info files +which are distributed to bittorrent clients (usually via the WWW) in order +to inform them where the designated tracker for the torrent is located, and +to allow them to verify the file's contents. +.PP +\fBbtmakemetafile\fP takes two arguments. Both are required. The first +is the file that the torrent info file will be generated for. The second is +the "announce" address of a tracker (ex. http://127.0.0.1:6969/announce). +.SH OPTIONS +.TP +.B \-\-piece_size_pow2 \fIarg\fP +which power of 2 to set the piece size to (default: 18) + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btrename (1), +.BR btreannounce (1), +.BR bttrack (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/bittorrent.mime +++ bittorrent-3.4.2/debian/bittorrent.mime @@ -0,0 +1 @@ +application/x-bittorrent; /usr/bin/btdownloadcurses --responsefile %s; test=test -z "$DISPLAY"; needsterminal --- bittorrent-3.4.2.orig/debian/bittorrent.manpages +++ bittorrent-3.4.2/debian/bittorrent.manpages @@ -0,0 +1,8 @@ +debian/bittorrent-downloader.bittorrent.1 +debian/bttrack.bittorrent.1 +debian/btmakemetafile.bittorrent.1 +debian/bittorrent-multi-downloader.bittorrent.1 +debian/btreannounce.bittorrent.1 +debian/btrename.bittorrent.1 +debian/btshowmetainfo.bittorrent.1 +debian/btcompletedir.bittorrent.1 --- bittorrent-3.4.2.orig/debian/bttrack.bittorrent.1 +++ bittorrent-3.4.2/debian/bttrack.bittorrent.1 @@ -0,0 +1,88 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH "BTTRACK" 1 "Jan 18 2003" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +bttrack \- tracker for bittorrent +.SH SYNOPSIS +.B bttrack \fI [ option ... ] +.SH DESCRIPTION +This manual page documents briefly the \fIbttrack\fP +command. +This manual page was written for the Debian distribution +because the original program does not have a manual page. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBbttrack\fP is a program that serves as a "tracker" for +bittorrent clients. This program keeps track of the completion +of each client, and communicates that information when requested +to other clients. +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +.TP +.B \-\-port \fIportnum\fP +listen on port \fIportnum\fP (default 80) +.TP +.B \-\-dfile \fIfilename\fP +store recent downloader info in \fIfilename\fP +.TP +.B \-\-bind \fIip\fP +bind to \fIip\fP instead of the default +.TP +.B \-\-socket_timeout \fIsecs\fP +timeout for closing connections (default 15) +.TP +.B \-\-save_dfile_interval \fIsecs\fP +seconds between saving dfile (default 300) +.TP +.B \-\-timeout_downloaders_interval \fIsecs\fP +seconds between expiring downloaders (default 2700) +.TP +.B \-\-reannounce_interval \fIsecs\fP +seconds downloaders should wait between reannouncements (default 1800) +.TP +.B \-\-response_size \fInum\fP +number of peers to send in an info message (default 50) +.TP +.B \-\-timeout_check_interval \fIsecs\fP +time to wait between checking if any connections have timed out (default 5) +.TP +.B \-\-nat_check \fI[ 1 | 0 ]\fP +whether to check back and ban downloaders behind NAT (default 1) +.TP +.B \-\-min_time_between_log_flushes \fIsecs\fP +minimum time it must have been since the last flush to do another one (default 3.0) +.TP +.B \-\-allowed_dir \fIpath\fP +only allow downloads for .torrents in this directory (default '') +.TP +.B \-\-parse_allowed_interval \fImins\fP +minutes between reloading of allowed_dir (default 15) +.TP +.B \-\-show_names \fI[ 1 | 0 ]\fP +whether to display names from allowed dir (default 1) + +.SH SEE ALSO +.BR bittorrent-downloader (1), +.BR btmakemetafile (1). +.br +.SH AUTHOR +This manual page was written by Michael Janssen , +for the Debian GNU/Linux system (but may be used by others). --- bittorrent-3.4.2.orig/debian/prerm +++ bittorrent-3.4.2/debian/prerm @@ -0,0 +1,46 @@ +#! /bin/sh +# prerm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +PACKAGE="bittorrent" + +dpkg --listfiles $PACKAGE | + awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | + xargs rm -f >&2 + + + +case "$1" in + remove|upgrade|deconfigure) +# install-info --quiet --remove /usr/info/#PACKAGE#.info.gz + ;; + failed-upgrade) + ;; + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- bittorrent-3.4.2.orig/debian/compat +++ bittorrent-3.4.2/debian/compat @@ -0,0 +1 @@ +4 --- bittorrent-3.4.2.orig/debian/bittorrent.install +++ bittorrent-3.4.2/debian/bittorrent.install @@ -0,0 +1,11 @@ +usr/bin/btcompletedir.bittorrent +usr/bin/btdownloadcurses.bittorrent +usr/bin/btdownloadheadless.bittorrent +usr/bin/btlaunchmany.bittorrent +usr/bin/btlaunchmanycurses.bittorrent +usr/bin/btmakemetafile.bittorrent +usr/bin/btreannounce.bittorrent +usr/bin/btrename.bittorrent +usr/bin/btshowmetainfo.bittorrent +usr/bin/bttrack.bittorrent +usr/lib --- bittorrent-3.4.2.orig/debian/bittorrent.postinst +++ bittorrent-3.4.2/debian/bittorrent.postinst @@ -0,0 +1,58 @@ +#! /bin/sh +# postinst script for bittorrent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + for i in btcompletedir btdownloadcurses btdownloadheadless btlaunchmany btlaunchmanycurses btmakemetafile btreannounce btrename btshowmetainfo bttrack ; do + update-alternatives \ + --install /usr/bin/$i $i /usr/bin/$i.bittorrent 110 \ + --slave /usr/share/man/man1/$i.1.gz $i.1.gz /usr/share/man/man1/$i.bittorrent.1.gz + done + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + for i in btcompletedir btdownloadcurses btdownloadheadless btlaunchmany btlaunchmanycurses btmakemetafile btreannounce btrename btshowmetainfo bttrack ; do + update-alternatives \ + --install /usr/bin/$i $i /usr/bin/$i.bittorrent 110 \ + --slave /usr/share/man/man1/$i.1.gz $i.1.gz /usr/share/man/man1/$i.bittorrent.1.gz + done + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- bittorrent-3.4.2.orig/www-doc/introduction.html +++ bittorrent-3.4.2/www-doc/introduction.html @@ -0,0 +1,38 @@ + + + + + + + + BitTorrent: Introduction + + + + +
+

You have a great product, many +customers, and are delivering your product to hordes of happy customers online. Serving large files creates problems of scaling, flash crowds, and reliability. As you grow, they become more central to your business, but your bandwidth costs go up as well. It's a vicious cycle.

+

There is a solution. BitTorrent is a simple software product which addresses all of these problems.

+

The key to cheap file distribution is to tap the unutilized upload capacity of your customers. It's free. Their contribution grows at the same rate as their demand, creating limitless scalability for a fixed cost.

+
+

Problem: more customers require more bandwidth

+ Problem +

The BitTorrent Solution: customers help distribute content

+ Solution +
+

BitTorrent is not just a concept, but has a functioning implementation, already capable of swarming downloads across unreliable networks. This is the result of over two years of intensive development.

+
+ + --- bittorrent-3.4.2.orig/www-doc/protocol.html +++ bittorrent-3.4.2/www-doc/protocol.html @@ -0,0 +1,177 @@ + + + + + + + + BitTorrent: Protocol Specification + + + + +
+

BitTorrent is a protocol for distributing files. It identifies content by URL and is designed to integrate seamlessly with the web. Its advantage over plain HTTP is that when multiple downloads of the same file happen concurrently, the downloaders upload to each other, making it possible for the file source to support very large numbers of downloaders with only a modest increase in its load.

+

A BitTorrent file distribution consists of these entities:

+
    +
  • An ordinary web server
  • +
  • A static 'metainfo' file
  • +
  • A BitTorrent tracker
  • +
  • An 'original' downloader
  • +
  • The end user web browsers
  • +
  • The end user downloaders
  • +
+

There are ideally many end users for a single file.

+

To start serving, a host goes through the following steps:

+
    +
  1. Start running a tracker (or, more likely, have one running already).
  2. +
  3. Start running an ordinary web server, such as apache, or have one already.
  4. +
  5. Associate the extension .torrent with mimetype application/x-bittorrent on their web server (or have done so already).
  6. +
  7. Generate a metainfo (.torrent) file using the complete file to be served and the URL of the tracker.
  8. +
  9. Put the metainfo file on the web server.
  10. +
  11. Link to the metainfo (.torrent) file from some other web page.
  12. +
  13. Start a downloader which already has the complete file (the 'origin').
  14. +
+

To start downloading, a user does the following:

+
    +
  1. Install BitTorrent (or have done so already).
  2. +
  3. Surf the web.
  4. +
  5. Click on a link to a .torrent file.
  6. +
  7. Select where to save the file locally, or select a partial download to resume.
  8. +
  9. Wait for download to complete.
  10. +
  11. Tell downloader to exit (it keeps uploading until this happens).
  12. +
+

The connectivity is as follows:

+
    +
  • The web site is serving up static files as normal, but kicking off the BitTorrent helper app on the clients.
  • +
  • The tracker is receiving information from all downloaders and giving them random lists of peers. This is done over HTTP or HTTPS.
  • +
  • Downloaders are periodically checking in with the tracker to keep it informed of their progress, and are uploading to and downloading from each other via direct connections. These connections use the BitTorrent peer protocol, which operates over TCP.
  • +
  • The origin is uploading but not downloading at all, since it has the entire file. The origin is necessary to get the entire file into the network. Often for popular downloads the origin can be taken down after a while since several downloads may have completed and been left running indefinitely.
  • +
+

Metainfo file and tracker responses are both sent in a simple, efficient, and extensible format called bencoding (pronounced 'bee encoding'). Bencoded messages are nested dictionaries and lists (as in Python), which can contain strings and integers. Extensibility is supported by ignoring unexpected dictionary keys, so additional optional ones can be added later.

+

Bencoding is done as follows:

+
    +
  • Strings are length-prefixed base ten followed by a colon and the string. For example 4:spam corresponds to 'spam'.
  • +
  • Integers are represented by an 'i' followed by the number in base 10 followed by an 'e'. For example i3e corresponds to 3 and i-3e corresponds to -3. Integers have no size limitation. i-0e is invalid. All encodings with a leading zero, such as i03e, are invalid, other than i0e, which of course corresponds to 0.
  • +
  • Lists are encoded as an 'l' followed by their elements (also bencoded) followed by an 'e'. For example l4:spam4:eggse corresponds to ['spam', 'eggs'].
  • +
  • Dictionaries are encoded as a 'd' followed by a list of alternating keys and their corresponding values followed by an 'e'. For example, d3:cow3:moo4:spam4:eggse corresponds to {'cow': 'moo', 'spam': 'eggs'} and d4:spaml1:a1:bee corresponds to {'spam': ['a', 'b']} . Keys must be strings and appear in sorted order (sorted as raw strings, not alphanumerics).
  • +
+

Metainfo files are bencoded dictionaries with the following keys:

+
+
announce
+
+

The URL of the tracker.

+
+
info
+
+

This maps to a dictionary, with keys described below.

+

The name key maps to a string which is the suggested name to save the file (or directory) as. It is purely advisory.

+

piece length maps to the number of bytes in each piece the file is split into. For the purposes of transfer, files are split into fixed-size pieces which are all the same length except for possibly the last one which may be truncated. Piece length is almost always a power of two, most commonly 218 = 256 K (BitTorrent prior to version 3.2 uses 220 = 1 M as default).

+

pieces maps to a string whose length is a multiple of 20. It is to be subdivided into strings of length 20, each of which is the SHA1 hash of the piece at the corresponding index.

+

There is also a key length or a key files, but not both or neither. If length is present then the download represents a single file, otherwise it represents a set of files which go in a directory structure.

+

In the single file case, length maps to the length of the file in bytes.

+

For the purposes of the other keys, the multi-file case is treated as only having a single file by concatenating the files in the order they appear in the files list. The files list is the value files maps to, and is a list of dictionaries containing the following keys:

+
+
length
+
The length of the file, in bytes.
+
path
+
A list of strings corresponding to subdirectory names, the last of which is the actual file name (a zero length list is an error case).
+
+

In the single file case, the name key is the name of a file, in the muliple file case, it's the name of a directory.

+
+
+

Tracker queries are two way. The tracker receives information via HTTP GET parameters and returns a bencoded message. Note that although the current tracker implementation has its own web server, the tracker could run very nicely as, for example, an apache module.

+

Tracker GET requests have the following keys:

+
+
info_hash
+
+

The 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. Note that this is a substring of the metainfo file. This value will almost certainly have to be escaped.

+
+
peer_id
+
+

A string of length 20 which this downloader uses as its id. Each downloader generates its own id at random at the start of a new download. This value will also almost certainly have to be escaped.

+
+
ip
+
+

An optional parameter giving the IP (or dns name) which this peer is at. Generally used for the origin if it's on the same machine as the tracker.

+
+
port
+
+

The port number this peer is listening on. Common behavior is for a downloader to try to listen on port 6881 and if that port is taken try 6882, then 6883, etc. and give up after 6889.

+
+
uploaded
+
+

The total amount uploaded so far, encoded in base ten ascii.

+
+
downloaded
+
+

The total amount downloaded so far, encoded in base ten ascii.

+
+
left
+
+

The number of bytes this peer still has to download, encoded in base ten ascii. Note that this can't be computed from downloaded and the file length since it might be a resume, and there's a chance that some of the downloaded data failed an integrity check and had to be re-downloaded.

+
+
event
+
+

This is an optional key which maps to started, completed, or stopped (or empty, which is the same as not being present). If not present, this is one of the announcements done at regular intervals. An announcement using started is sent when a download first begins, and one using completed is sent when the download is complete. No completed is sent if the file was complete when started. Downloaders send an announcement using 'stopped' when they cease downloading.

+
+
+

Tracker responses are bencoded dictionaries. If a tracker response has a key failure reason, then that maps to a human readable string which explains why the query failed, and no other keys are required. Otherwise, it must have two keys: interval, which maps to the number of seconds the downloader should wait between regular rerequests, and peers. peers maps to a list of dictionaries corresponding to peers, each of which contains the keys peer id, ip, and port, which map to the peer's self-selected ID, IP address or dns name as a string, and port number, respectively. Note that downloaders may rerequest on nonscheduled times if an event happens or they need more peers.

+

If you want to make any extensions to metainfo files or tracker queries, please coordinate with Bram Cohen to make sure that all extensions are done compatibly.

+

BitTorrent's peer protocol operates over TCP. It performs efficiently without setting any socket options.

+

Peer connections are symmetrical. Messages sent in both directions look the same, and data can flow in either direction.

+

The peer protocol refers to pieces of the file by index as described in the metainfo file, starting at zero. When a peer finishes downloading a piece and checks that the hash matches, it announces that it has that piece to all of its peers.

+

Connections contain two bits of state on either end: choked or not, and interested or not. Choking is a notification that no data will be sent until unchoking happens. The reasoning and common techniques behind choking are explained later in this document.

+

Data transfer takes place whenever one side is interested and the other side is not choking. Interest state must be kept up to date at all times - whenever a downloader doesn't have something they currently would ask a peer for in unchoked, they must express lack of interest, despite being choked. Implementing this properly is tricky, but makes it possible for downloaders to know which peers will start downloading immediately if unchoked.

+

Connections start out choked and not interested.

+

When data is being transferred, downloaders should keep several piece requests queued up at once in order to get good TCP performance (this is called 'pipelining'.) On the other side, requests which can't be written out to the TCP buffer immediately should be queued up in memory rather than kept in an application-level network buffer, so they can all be thrown out when a choke happens.

+

The peer wire protocol consists of a handshake followed by a never-ending stream of length-prefixed messages. The handshake starts with character ninteen (decimal) followed by the string 'BitTorrent protocol'. The leading character is a length prefix, put there in the hope that other new protocols may do the same and thus be trivially distinguishable from each other.

+

All later integers sent in the protocol are encoded as four bytes big-endian.

+

After the fixed headers come eight reserved bytes, which are all zero in all current implementations. If you wish to extend the protocol using these bytes, please coordinate with Bram Cohen to make sure all extensions are done compatibly.

+

Next comes the 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. (This is the same value which is announced as info_hash to the tracker, only here it's raw instead of quoted here). If both sides don't send the same value, they sever the connection. The one possible exception is if a downloader wants to do multiple downloads over a single port, they may wait for incoming connections to give a download hash first, and respond with the same one if it's in their list.

+

After the download hash comes the 20-byte peer id which is reported in tracker requests and contained in peer lists in tracker responses. If the receiving side's peer id doesn't match the one the initiating side expects, it severs the connection.

+

That's it for handshaking, next comes an alternating stream of length prefixes and messages. Messages of length zero are keepalives, and ignored. Keepalives are generally sent once every two minutes, but note that timeouts can be done much more quickly when data is expected.

+

All non-keepalive messages start with a single byte which gives their type. The possible values are:

+
    +
  • 0 - choke
  • +
  • 1 - unchoke
  • +
  • 2 - interested
  • +
  • 3 - not interested
  • +
  • 4 - have
  • +
  • 5 - bitfield
  • +
  • 6 - request
  • +
  • 7 - piece
  • +
  • 8 - cancel
  • +
+

'choke', 'unchoke', 'interested', and 'not interested' have no payload.

+

'bitfield' is only ever sent as the first message. Its payload is a bitfield with each index that downloader has sent set to one and the rest set to zero. Downloaders which don't have anything yet may skip the 'bitfield' message. The first byte of the bitfield corresponds to indices 0 - 7 from high bit to low bit, respectively. The next one 8-15, etc. Spare bits at the end are set to zero.

+

The 'have' message's payload is a single number, the index which that downloader just completed and checked the hash of.

+

'request' messages contain an index, begin, and length. The last two are byte offsets. Length is generally a power of two unless it gets truncated by the end of the file. All current implementations use 215, and close connections which request an amount greater than 217.

+

'cancel' messages have the same payload as request messages. They are generally only sent towards the end of a download, during what's called 'endgame mode'. When a download is almost complete, there's a tendency for the last few pieces to all be downloaded off a single hosed modem line, taking a very long time. To make sure the last few pieces come in quickly, once requests for all pieces a given downloader doesn't have yet are currently pending, it sends requests for everything to everyone it's downloading from. To keep this from becoming horribly inefficient, it sends cancels to everyone else every time a piece arrives.

+

'piece' messages contain an index, begin, and piece. Note that they are correlated with request messages implicitly. It's possible for an unexpected piece to arrive if choke and unchoke messages are sent in quick succession and/or transfer is going very slowly.

+

Downloaders generally download pieces in random order, which does a reasonably good job of keeping them from having a strict subset or superset of the pieces of any of their peers.

+

Choking is done for several reasons. TCP congestion control behaves very poorly when sending over many connections at once. Also, choking lets each peer use a tit-for-tat-ish algorithm to ensure that they get a consistent download rate.

+

The choking algorithm described below is the currently deployed one. It is very important that all new algorithms work well both in a network consisting entirely of themselves and in a network consisting mostly of this one.

+

There are several criteria a good choking algorithm should meet. It should cap the number of simultaneous uploads for good TCP performance. It should avoid choking and unchoking quickly, known as 'fibrillation'. It should reciprocate to peers who let it download. Finally, it should try out unused connections once in a while to find out if they might be better than the currently used ones, known as optimistic unchoking.

+

The currently deployed choking algorithm avoids fibrillation by only changing who's choked once every ten seconds. It does reciprocation and number of uploads capping by unchoking the four peers which it has the best download rates from and are interested. Peers which have a better upload rate but aren't interested get unchoked and if they become interested the worst uploader gets choked. If a downloader has a complete file, it uses its upload rate rather than its download rate to decide who to unchoke.

+

For optimistic unchoking, at any one time there is a single peer which is unchoked regardless of it's upload rate (if interested, it counts as one of the four allowed downloaders.) Which peer is optimistically unchoked rotates every 30 seconds. To give them a decent chance of getting a complete piece to upload, new connections are three times as likely to start as the current optimistic unchoke as anywhere else in the rotation.

+
+ + --- bittorrent-3.4.2.orig/www-doc/press.html +++ bittorrent-3.4.2/www-doc/press.html @@ -0,0 +1,35 @@ + + + + + + + + BitTorrent: Press + + + + +
+
    +
  • 2003-03-31: "Red Hat Linux 9 is out, and as of today the ISOs are officially available to Red Hat Network subscribers ($60/yr). Or, as of right now, you can grab the same ISOs using BitTorrent." - slashdot

  • +
  • 2002-07-26: "How do you simulate a slashdotting? Especially when you've already shrugged off one bona fide, slashdot.org appearence?" - NTK

  • +
  • 2002-03-19: "Finally, real P2P with brains" - slashdot

  • +
  • 2002-01-09: "Two new services that aim to allow the burden of file downloads to be shared between web surfers" - New Scientist

  • +
  • 2001-11-19: BitTorrent has received a grant from linuxfund.

  • +
  • 2001-07-16: "Bram Cohen's latest project is nothing if not ambitious: a novel way to share files that he hopes will best rivals like Napster, Freenet, and Gnutella." - Wired Online

  • +
+
+ + --- bittorrent-3.4.2.orig/www-doc/download.html +++ bittorrent-3.4.2/www-doc/download.html @@ -0,0 +1,88 @@ + + + + + + + + BitTorrent: Download + + + + +
+

Current version: 3.4.2, released on April 4, 2004.

+

Available downloads:

+
    +
  • Windows +installer (If you don't know what you want, you probably want this). +
    + + +
    +
  • +
  • Mac OS X +image
  • +
  • Debian package: testing or + unstable
  • +
  • Red Hat package: try a search
  • +
  • Python source: + zip, tar or + cvs
  • +
  • To create .torrent files under Windows: CompleteDir
  • +
+

New in 3.4.2:

+
    +
  • Fixed some bugs, including an important tracker bug +
  • Added 'warning message' so trackers can send non-fatal human readable messages to clients +
  • Fixed problem where some users got 'could not find file' message +
+

New in 3.4.1:

+
    +
  • Client no longer complains of connection to tracker problems when transfers are still working +
  • Lots and lots of bandwidth savings (the 'compact' tracker parameter) +
  • Better support for peers with dynamic IPs (the 'key' tracker parameter) +
  • Lots of bug fixes +
+

New in 3.3:

+
    +
  • Files now only get allocated as they're downloaded and don't fragment the hard drive
  • +
  • Large torrents no longer hose the CPU
  • +
  • Better network utilization and more consistent download rates
  • +
  • Poorly seeded torrents get out faster
  • +
  • Several important bug fixes
  • +
+

New in 3.2:

+
    +
  • Better network utilization
  • +
  • More even and consistent download rates
  • +
  • Read-only files now supported for seeding
  • +
  • The Windows build now takes command line arguments
  • +
  • Several bug fixes
  • +
+
+ + --- bittorrent-3.4.2.orig/www-doc/guide.html +++ bittorrent-3.4.2/www-doc/guide.html @@ -0,0 +1,71 @@ + + + + + + + + BitTorrent: File Server's Guide + + + + +
+

This is a how-to for making files publicly available via BitTorrent, and it's primarily written for people running Windows. But even if you're not running Windows, the steps you need to do are quite similar, and you can find further instructions in README.txt in the source distribution.

+
    +
  1. Get a tracker

    +

    You need a tracker for downloaders to be able to find each other. Because of this central role, a tracker should be on a very reliable Internet connection. Therefore it's strongly recommended that you use a tracker running on a stable server system (as opposed to your unstable Windows desktop system).

    +

    Everyone else making files available via BitTorrent is using a tracker, and a single tracker can handle a huge number of files with very little load. So you could ask others for the URL of their trackers. (Tracker URL is contained in .torrent files.) However, you should never use anyone's tracker without the owner's permission. That would be intrusive, for the least.

    +

    If you want to set up your own tracker, follow the instructions in the README.txt in the source distribution.

    +
  2. +
  3. Get a web server

    +

    Any web server will do, but you must associate the extension .torrent with the mimetype application/x-bittorrent. You should ask your web server's administrator to set it up.

    +

    If you are the web server administrator, either add the line

    +

    AddType application/x-bittorrent .torrent

    +

    To httpd.conf, or

    +

    application/x-bittorrent torrent

    +

    to mime.types.

    +
  4. +
  5. Make the .torrent files

    +

    Download and install CompleteDir from the download page. It will install under Start > All Programs > CompleteDir.

    +

    Next, take all the files you would like to make .torrent's for and put them in a single directory. If there's a whole directory you'd like to make a single .torrent for, make it a subdirectory. If you only want to make a .torrent of one file, put it in a directory by itself.

    +

    Then run CompleteDir. Click on 'Select' and select the directory which you put all the files in. Enter the URL of the tracker you're using in the 'Announce URL' field. You can leave the piece size at the default value. (Smaller piece sizes cause better performance, but make bigger .torrent files.)

    +

    Click 'Make' and .torrent files will be created. For a file named spam, a file named spam.torrent will be created.

    +

    If you want to create more .torrent files, you don't have to remove the old ones, just add the new files to the directory and click 'Make' again. CompleteDir checks for existing .torrent's and doesn't regenerate them.

    +
  6. +
  7. Put the .torrent files on your web server

    +

    Do this however you normally put files on your web server, for .torrent files are just ordinary static files.

    +
  8. +
  9. Install BitTorrent on your machine

    +

    Given that you're reading this you've probably installed BitTorrent already, but if not get it from the download page.

    +
  10. +
  11. Start a complete downloader

    +

    For people to be able to download it is necessary that there be at least one downloader which has everything to begin with. Enter the URL you put the .torrent file at into your web browser, and select the complete local file (or directory) as the location to save to. After checking that the integrity of the file(s), the downloader will report that the download has succeeded, and wait for peers to upload to.

    +

    If there are multiple files you'd like to distribute, and they're not grouped into a single .torrent, you have to start a separate downloader for each .torrent file.

    +

    It is essential that your complete downloader be able to receive incoming connections. If you're behind a firewall or NAT, you should forward ports 6881 through 6889 to your machine. (The first downloader uses 6881, the next 6882, etc. The range is configurable.)

    +
  12. +
  13. Link to the .torrent file

    +

    You can link to the .torrent file using an ordinary hyperlink. Sending the URL in email also works.

    +
  14. +
+

Have fun!

+
+ + --- bittorrent-3.4.2.orig/www-doc/FAQ.html +++ bittorrent-3.4.2/www-doc/FAQ.html @@ -0,0 +1,143 @@ + + + + + + + + BitTorrent: Frequently Asked Questions + + + + +
+
+
Where can I find stuff to download using BitTorrent?
+
+

You can find lots of things here and from Smiler's BitTorrent links.

+
+
Help! My download isn't working!
+
+

Please read this FAQ to see if it solves your problem, and if that doesn't work try this FAQ. If that doesn't help, post a question to the technical support mailing list. Be sure to mention what +operating system you're running, the url of the file you're trying to download, what version of BitTorrent you're running, and explain exactly what behavior you're seeing.

+

Do not post questions about where to find files or announcements of files being avialable to this +mailing list. For that, try using a search engine.

+
+
BitTorrent is great! How can I help?
+
+

You can give a donation.

+
+
What is BitTorrent uploading from my machine?
+
+

Pieces of the file you're currently downloading. BitTorrent trades pieces you have with pieces your +peers have.

+
+
I don't want you stealing my bandwidth! How can I stop it from uploading?
+
+

You could hack the source to not upload, but then your download rate would suck. BitTorrent downloaders engage in tit-for-tat with their peers, so leeches have very little success downloading.

+
+
I get an error message starting with 'problem connecting to tracker', what should I do?
+
+

The tracker for the one particular file you're trying to download is probably down. Try to download again later.

+

Alternately, this error message may indicate that your net connection is down or doesn't allow arbitrary outgoing connections, which is necessary for BitTorrent to work.

+
+
BitTorrent makes my machine blue screen! What should I do?
+
+

If you have a DSL modem, especially an Alcatel, you should upgrade your drivers. If you have a Linksys network card, you may have to upgrade your network card drivers as well.

+
+
When I click on BitTorrent links is says 'file not found'. What do I do?
+
+

This problem was recently fixed. You should install the latest version.

+
+
Can I use BitTorrent on Mac OS 9?
+
+

After installing MacPython, you should be able to use btdownloadheadless.py from the source.

+
+
Does BitTorrent support resuming?
+
+

Yes, just save your download to the same location as the existing partial download. BitTorrent will resume where it left off after checking the partial download.

+
+
How can I contribute to a file distribution without downloading?
+
+

Just leave BitTorrent running after it's done downloading. If you already have the complete file(s), restart downloading and resume to the existing file(s).

+
+
How do I know the download isn't corrupted?
+
+

BitTorrent does cryptographic hashing (SHA1) of all data. When you see "Download succeeded!" you can be sure that BitTorrent has already verified the integrity of the data. The integrity and authenticity of a BitTorrent download is as good as the original request to the tracker. Checking the MD5/CRC32/other hash of a file downloaded via BitTorrent is redundant.

+
+
I'm behind a firewall/NAT, can I use BitTorrent?
+
+

Yes, but you will get better performance if other peers can connect to you. See here for +detailed instructions on how to allow incoming BitTorrent connections.

+
+
How many downloads can BitTorrent support?
+
+

For very popular files, BitTorrent can support roughly a thousand times as many downloads as http +can. Recent changes may change this to ten thousand.

+
+
I published a file but whenever I try to download it hangs saying "connecting to peers" and/or the download just never starts.
+
+

You need to leave at least one downloader running which already has the whole file. Make sure other peers can connect to this downloader (preferably not behind firewall or NAT!)

+
+
I started a complete downloader but still noone can download, what gives?
+
+

If your tracker and downloader are on the same machine or within the same private IP range, you need to start the downloader with the --ip parameter, followed by it's public IP. Otherwise "localhost" could be assumed.

+
+
What language is BitTorrent written in?
+
+

Python. And it uses wxWindows +for its GUI.

+
+
When is the Java/C/whatever implementation going to be ready?
+
+

See the BitTorrent ports mailing list.

+
+
How do I limit the amount of bandwidth consumed by BitTorrent?
+
+

Use the --max_upload_rate command line parameter, which takes an upload rate in kilobytes/sec.

+
+
Does BitTorrent contain spyware or adware?
+
+

No, BitTorrent contains no spyware, adware, or any other kind of -ware.

+

Some warez sites are distributing spyware-wrapped versions of the BitTorrent installer. Please only download +the BitTorrent installer from this site.

+
+
What license is BitTorrent released under?
+
+

MIT License, which basically lets you do anything you want with it so long as you leave the license notification in the source.

+
+
How can I download on a headless machine?
+
+

There are btdownloadheadless.py, btdownloadcurses.py and others available in the source distribution.

+
+
I can't use Paypal, can I still make a donation?
+
+

You can send a check or money order to: +

Bram Cohen
+227 Bellevue Way NE Suite 152
+Bellevue, WA 98004

+
+
Where can I find more information about BitTorrent?
+
+

If you're looking for information on where to find files downloadable using BitTorrent, try using a +search engine.

+

If you have a development or technical support question, see the documentation page, the development mailing list, or join #bittorrent on irc.freenode.net. (I repeat, this channel is not for file distribution!)

+
+
+
+ + --- bittorrent-3.4.2.orig/www-doc/bittorrent_logo.png.uu +++ bittorrent-3.4.2/www-doc/bittorrent_logo.png.uu @@ -0,0 +1,113 @@ +begin 644 bittorrent_logo.png +MB5!.1PT*&@H````-24A$4@```'@```!X"`,````.NL;@```#`%!,5$565JDT +M-)B+B\7^_=T[.YDQ,9$W-YD@((X[.YC[^MM55:G]^]L>'HTU-9GZ^MHB(H]@ +M8*-D9*3KA'0G)XWW]]D='8D'!X$?'X_P[]&)B;K>`0$D)(S=#PXY.9LF)I$D +M))!#0Y?='QW=$A'/0#Z.CKK82D7=+RR5E;K+3$E$1)P2$H6,C+KM[="_O\_> +M%Q46%H?3/S[B3T?@-C#*4U'#P\PU-9KG:U[W]]@\/)J:FK_Y^=OBAWA96:/[ +M^]U34Y[9'1WD7E3O[]%=7:/R\MHX.)D.#H3/S[?W]=:G/DY,A(2)J?G8_6UKW0T,V+B[/KF(:GI\C(QJ^HGY^(B,/@ +MQ:\H*)%]?9CBEH:\B(';=&K-S;1B8JZ8F(G:VK_WX<;%=&_*RLONK9FNK)^T +MEHS&9V3DL)RTM,3I>6O`KYVKJ[_`;&F_GY3EY``"MK<:4E,@R +M,IC*RK.TLZ)`0)RIJ9A/3YVXN*2]O::]O;[*VMLS@X,3[^]S!P:OAX=1^?J]H:+"ZNKFEI;W[^]N5E;[Q\=3Y^=ED +M9*7U]=GBXL8X.)9:6JN`P(N+I0"`G\V-IJ_O\?X +M^-GT]-CT]-5=7:SZ^MT='8[JZLRZNLG@WL,C(Y`?'XP\/)U03U[JWE_:>MO;:6ENIR+)JJ2*"6/5@?:'"01"* +M#P2552P&>?34)>4AB$`/*@07""@L`4$J+$$H\E@!PU,@>J`!$8M($%`\1#0% +ME>C!!R%FS^1^>V82`T2*D)Y[_V#8*_/-_IC]V_NWO_W;7V8R2?Y_=$R:`)X` +MG@#^,X"1XL`7W(J*BOU"-,S'N#4*O/_C77!\?""Y"\FU3A,\WH]'Q#2D'+GM +M8@ZWBZ*Q(0WIL@HP.L`CJ&/.#S4('0##+Z%++OS)Y.-B<<=<@CEN1A2/9I'[$;T[;.3=_SD]UTM^M^Y]4U>3_!6[)A.9^G`%X:PQ\+L)8)P=Y7 +M(E8+W+0*6@\\U*Q#Z'I<1,Y1/CYIOF*TBB`6'[^8W*JOSR:(9GW]L)PI0VE3 +M7*F"=^JI_HG&%!:6CNATY)1+]H?=/BP+U]><9,@OCA\UM+E +M5!C!9B_UB8IQ%J,#NW8=X$,@R-%^B,#])B;K11"*R:?7[>,##'A/UXB15C+4 +MO<<]X%:Q$J%DF#FV9U"R&*D!%JW3(5H"7.:QB;49]<)U;!Y18IE,\SOO")\? +M!+<&1AI:=NU?@JMNG;V(Y*)Y!.\K79CWLSP>;QU!_)A00'M-ZH7(A."UK%I$ +M$+P?+J*?\%2QV?L,U0&+OR*(11G.`SY#,%+=F)T5-/#B',O)N,]^$05H +M\A*ZKKVA`W$7,?-^FCKS_"*2;V&#K>/!U_I*$1:!OI/7T9:GBU@-<`=@K?4, +MVDXL.IC#/0_-SXDT//LCS.SB0YXQEL@-K.\VB'"XSSD4J$,0AS]#O[8`&X<" +M#^8$P;5^X*&#+B8$T1K8#!#.N#E=OZ5X<7AQ@]IQMP*_]]52`SSE%MVMM0=9 +MSN(:&'A[QH7D?T#W#_F<\NT0XPCP3!!/QI/NP\+M^6KMA"6@[Q,568(7Q'<^ +M4<<;MA/L,!]`.>C+G0=-^7P'_^&W@9NM#[WP81VO5T=US2*&FB\B:M`GVV&D +MD7QQ$&XQY\(4)#;1PES@X_F(\KI% +MZ`8T?`+-M4>M8K.ANZ(:X'UM0+9EESI@W.3BL+`6-@]B(%D'3YVE'%KBP8W` +M!YZFJ`8$L\E;FH,CK=6C`T_M(8\"4!D8&/1*ZR<<"*OF$JU1]51S&0#,/NPK +M?N\FP9X7N5Z]@.S$8>(3"?^YU.7\6;AHS>$BS.%!7[BA`"CF930T844+]'## +M2SZGZP`,U"^B0RXV85.]$E$!Q69_PF`7E-PMSPWB.3O`1TZ +M&24(!D:T+%X:EA9IB*BNQZQCLW4SG!&>1OT8OEJMQB02?AX5.(QC+N*!@6+B +MH;0$'`%@'&UK`PPI"CR],*4'7;H^AG\.\Q52=,S-J$=T/*]QQ20:*(Y +MJ+C@)H]H:5]7V87X6#-B+J"=$#/-2Q:QB>0\YG%M>]`G2`VP\`"SFGA^K)(NO&J)PR4=E$Q]&;$< +M]UGGBQB^UH4?W`(88`O,H'SY=H+7#MO69%]F^_R'LQ9T7R1,!!^5?MKX6WJJG>D,I\P03J]],?IS@)%0X,\)3RFZO6!FJ8'%L<[. +M';9/:C^ +M?VVUVFQ%>?5)I$E@)/`/#DW=E&KS>`=)WB:`A>?LXXWLK/+;RFB&@=Z^Q_U2BF?R[[A0E]+.HP]F_^)P0X`T +M!%Q7Q9EO6F9U5UMVA;Q+XO*<[.[KEL@&P*`Y[^Z'RRODCK9/MZZ.KZY$F@!& +M@JKRPE]6GZF5`,Q+F00*,$P;M`VT2V2,]\/\W=%Z(7%H_,`PO=5YOZ1;>3^5 +MD?\"W +M5IN\1@*]F-+GM#%`L]USI_L*5#)>;8OTV7G+WH#M2>K'NZ4Z-B3%=/69K_-/ +MW.WKH6>49A@@<6PKF`>;]G[@_?9LUV#S<0%C7,>K\>XI*S[2VWW;?=K1Z?]% +MZ0;%,'#;_[@/D_P":F00V'3,2R][SYR15UTW'N"ZW*K`9N.>8E4VV*!J6NB:.S`(O.?0Q.3_.USXRK- +M*^-^KN9DFMH9?PCPE)I_B'"XO][QC%KP9C148%9OG;C;? +MHM0#5.SOL*(TOY/B^07)B,G?23K(@7DZL+'K?>-2HY`M8P1&:\S-S>N:!O4[ +M-WCJIOR_T(.C0XE64*`:B\ES1KW)9]-_<\J[L6:LP&N$0]E")SEY5G^#207% +MP*)!&2]I&Z\Q"8@V53FP-S7+872K>1AP4U.3&MG.W69G90O<8O5@XIDN%,\R +MB'.2\I89WW8*%6@PYZH+-;)NPUNA1$+M3K`G4H4:L532T]=-TM[:=Z/G5R'- +M`KD'IQP2 +M909"1Y8R/V&\LWZ+YN1J#EC`B?[;97HZ5>.9%A!EG&-A*;M4&M\KTASPU>A\ +M6X5N#,M`J!K@F5*8V@<+RRLU!EP7$OVV[:L17X=0ZAXT8H6@2F1_,5Z=MP=I +M;([+B[(&Z`R$(?F90J69-291>+OQBA)H"OC7^0N_*5/)0*1#,A`FVBEOF62A +M:YRF@$^ZFN4K1DQGU_2(0:69[S57E-X/O*-3EHDT!:S7:*.2@?P3VPR]M(JI +MYB=?S[0.J=00<&+LF=H_RD!>>8UGNR=B(S +MN$XCP$+[S)FS<'9')WBT@>WKV+;I?ZBLI(QGI7J<.(T`?UL>_LW[JAF(5&T& +M0G]GEY%EWHWACD@3P'&A6PVND0/2`2C`+6U@FZJ\=^>>LI(V9J7^`=>C!$:) +ML79M3YC=$//YA/E\V&_#,#S8JYU5Y'!2`\""4+.LZ2]>DX&0JAD(R7RO-+B= +M:8_&#QQ7/N.,[7.2W@&5?,(GD*QD6-6K7;O@4:]@_`_8_#.W&@"!$+T,J_^# +M"\TSS?!0[]U/G;:9CQNX(^0CJS8FQQB2@9"RUSPA,7#/VX+&"WS.=?=%>TOH2%;&,$.L4C>&>M]Z:^%(&C(J +M8$&Y7E:;5"D1=-S2\3SH"0F=@5!VW^,[H"$CI`.31J73[J8]950DRP;H0GT] +MIXB]1BIKAG@WCJ@AHP$VY\1/:[O/*`-PJXQ>2J5MZ*UPN/>#K"*.8%R/C<_% +MAQO;*I2!R4`8359Y!J+ZA$2A(4:OWQM'`2P(-BMK@[AE5.(:(QJTAF"5IJ)Z +MN%=2NR#3OF[LP*@J;W:I+69/F\3EKU1Y"]L,O;1N#_?6ED;'GAL[\,EJLQ-E +M"IY'FX%@6W8YOS3V!AHKL+C:-=UXEH))A73@-(.6ZVLDO3,.]TJD>Z>E<,S' +M"(QR'9QF;I2]?#@TQU!H!7Z(^CKOLV\^N52+4[TZ/GGQP+ +M<-/F6%/KHP_5YAB*#&0DKXW5UKQMPC$`5W(*SUBU]2O5>%`&0K':1V<@Y+`, +MA/+V6[C/<-CRYL""WA3K;^[?Z68XO*Z28UQG/KM']/;<66!77BUX4^"ZJKRL +MV/N8-/J+B8)8S"HE%,SE:[PV_=TO99__ENJJ]KG7","BQ%!3=X.^U^<8(V<@ +M(-IW(,$VL#+C%+\1L+#*(>_2,5IX%3E&=]\]U;RN>W`&,L3;T_<6!+:M77K* +M,L$;``LWS[_M?DQ[I!QCY`SD(?/ZH#;]H^`JT:B!1557'X5?N2,=EF.,.@/! +M:P%[+WNGKC:J$HX2N"ZQ//-=NZ/WE!+Q*L>0JF0@:KU2Q@L\XW9GE +M]L)1O841;0G)NUW:]D2AP\H<`[Z(7E=$[S/U7I7\1`*!#:ZV%[OCDW+7C.(M +M3.7)6".]=_([F1RC3U497O<,1*KR#(3^3QFM\/\FIQ\MU]JT!2?L;A<]J%HC1Z$Q4EZ0^\-Z#2 +MO[?7O]K?/M'?WG%SW,E*P4KE+S@F#7L50OU2JHGZ_;K&#Y4W+1._]9D`G@"> +;`)X`'O7QO]BVR,66=S/3`````$E%3D2N0F"" +` +end --- bittorrent-3.4.2.orig/www-doc/documentation.html +++ bittorrent-3.4.2/www-doc/documentation.html @@ -0,0 +1,49 @@ + + + + + + + + BitTorrent: Documentation + + + + +
+

For common users:

+ +

For content distributors:

+ +

For developers:

+ +

For academics:

+ +
+ + --- bittorrent-3.4.2.orig/www-doc/donate.html +++ bittorrent-3.4.2/www-doc/donate.html @@ -0,0 +1,52 @@ + + + + + + + + BitTorrent: Donate! + + + + +
+ Bram Cohen +

Hi! I'm Bram Cohen, the author of BitTorrent.

+

I maintain BitTorrent for a living. This is my only job.

+

If you use BitTorrent and would like to help support it please make a donation.

+ +

If you can't use Paypal, you can send a check or money order to:

+

Bram Cohen
+ 227 Bellevue Way NE #152
+ Bellevue, WA 98004


+

New! New!
+ Now you can get a cool-looking BitTorrent shirt! Only $14.95, it +helps support BitTorrent and you get a shirt too! Order +here.

+
+ + --- bittorrent-3.4.2.orig/www-doc/index.html +++ bittorrent-3.4.2/www-doc/index.html @@ -0,0 +1,44 @@ + + + + + + + + The Official BitTorrent Home Page + + + + +
+ +

Welcome to the official +BitTorrent web site!

+
    +
  • 2004-04-04: 3.4.2, probably the last release before 3.5, is now out, download here. +
  • 2004-03-11: 3.4.1, which fixes all the major problems in 3.4 and has yet even more tracker bandwidth +savings, +is now out. +
  • 2003-09-24: Long awaited release 3.3 is out. Everybody please upgrade
  • +
  • 2003-09-24: New website launched
  • +
+

If you are new to BitTorrent, be sure to read the Introduction to understand how BitTorrent works. If you have any questions, please refer to the FAQ.

+
+

BitTorrent, its logo and its web site are all copyright © 2001-2003 Bram Cohen. The logo and the web site are designed by + +Henry 'Pi' James. The web site is compliant to XHTML 1.1 and CSS 2.

+
+ + --- bittorrent-3.4.2.orig/BitTorrent/zurllib.py +++ bittorrent-3.4.2/BitTorrent/zurllib.py @@ -35,8 +35,14 @@ if DEBUG: pprint.pprint(headers.dict) url = fp.url - return addinfourldecompress(fp, headers, url) - + resp = addinfourldecompress(fp, headers, url) + # As of Python 2.4 http_open response also has 'code' and 'msg' + # members, and HTTPErrorProcessor breaks if they don't exist. + if 'code' in dir(fp): + resp.code = fp.code + if 'msg' in dir(fp): + resp.msg = fp.msg + return resp class addinfourldecompress(addinfourl): """Do gzip decompression if necessary. Do addinfourl stuff too.""" --- bittorrent-3.4.2.orig/BitTorrent/btformats.py +++ bittorrent-3.4.2/BitTorrent/btformats.py @@ -55,8 +55,9 @@ if type(message) != DictType: raise ValueError check_info(message.get('info')) - if type(message.get('announce')) != StringType: - raise ValueError + announce = message.get('announce') + if type(announce) != StringType or len(announce) == 0: + raise ValueError, 'bad torrent file - announce is invalid' def check_peers(message): if type(message) != DictType: --- bittorrent-3.4.2.orig/BitTorrent/spewout.py +++ bittorrent-3.4.2/BitTorrent/spewout.py @@ -0,0 +1,44 @@ + +# This file created for Debian because btdownloadcurses can't +# find btdownloadheadless because we rename it. + +def print_spew(spew): + s = StringIO() + s.write('\n\n\n') + for c in spew: + s.write('%20s ' % c['ip']) + if c['initiation'] == 'local': + s.write('l') + else: + s.write('r') + rate, interested, choked = c['upload'] + s.write(' %10s ' % str(int(rate))) + if c['is_optimistic_unchoke']: + s.write('*') + else: + s.write(' ') + if interested: + s.write('i') + else: + s.write(' ') + if choked: + s.write('c') + else: + s.write(' ') + + rate, interested, choked, snubbed = c['download'] + s.write(' %10s ' % str(int(rate))) + if interested: + s.write('i') + else: + s.write(' ') + if choked: + s.write('c') + else: + s.write(' ') + if snubbed: + s.write('s') + else: + s.write(' ') + s.write('\n') + print s.getvalue() --- bittorrent-3.4.2.orig/BitTorrent/fmt.py +++ bittorrent-3.4.2/BitTorrent/fmt.py @@ -0,0 +1,45 @@ +# Written by Michael Janssen +# See LICENSE.txt for license information + +def fmttime(n, compact = 0): + if n == -1: + if compact: + return '(no seeds?)' + else: + return 'download not progressing (no seeds?)' + if n == 0: + if compact: + return "complete" + else: + return 'download complete!' + n = int(n) + m, s = divmod(n, 60) + h, m = divmod(m, 60) + if h > 1000000: + return 'n/a' + if compact: + return '%d:%02d:%02d' % (h, m, s) + else: + return 'finishing in %d:%02d:%02d' % (h, m, s) + +def fmtsize(n, baseunit = 0, padded = 1): + unit = [' B', ' K', ' M', ' G', ' T', ' P', ' E', ' Z', ' Y'] + i = baseunit + while i + 1 < len(unit) and n >= 999: + i += 1 + n = float(n) / (1 << 10) + size = '' + if padded: + if n < 10: + size = ' ' + elif n < 100: + size = ' ' + if i != 0: + size += '%.1f %s' % (n, unit[i]) + else: + if padded: + size += '%.0f %s' % (n, unit[i]) + else: + size += '%.0f %s' % (n, unit[i]) + return size + --- bittorrent-3.4.2.orig/BitTorrent/track.py +++ bittorrent-3.4.2/BitTorrent/track.py @@ -258,7 +258,7 @@ szt = sz * n # Transferred for this torrent tt = tt + szt if self.allow_get == 1: - linkname = '' + self.allowed[name]['name'] + '' + linkname = '' + self.allowed[name]['name'] + '' else: linkname = self.allowed[name]['name'] s.write('%s%s%s%i%i%i%s\n' \ @@ -308,8 +308,8 @@ fs[name]['name'] = self.allowed[name]['name'] r = {'files': fs} return (200, 'OK', {'Content-Type': 'text/plain'}, bencode(r)) - 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()) --- bittorrent-3.4.2.orig/BitTorrent/Storage.py +++ bittorrent-3.4.2/BitTorrent/Storage.py @@ -88,7 +88,7 @@ h.seek(begin) h.write(s[total: total + end - begin]) total += end - begin - + def close(self): for h in self.handles.values(): h.close() --- bittorrent-3.4.2.orig/BitTorrent/RawServer.py +++ bittorrent-3.4.2/BitTorrent/RawServer.py @@ -129,6 +129,10 @@ handler = self.handler sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setblocking(0) + try: + sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, 32) + except: + pass sock.bind((self.bindaddr, 0)) try: sock.connect_ex(dns)