root / dotorg / v6 / html / beps / bep_0017.rst

Revision 10603, 4.2 kB (checked in by dave, 11 months ago)

John Hoffman's announce-list extension.

Line 
1BEP: 17
2Title: HTTP Seeding
3Version: $Revision$
4Last-Modified: $Date$
5Author:  John Hoffman <theshadow@degreez.net>, DeHackEd
6Status:  Draft
7Type:    Standards Track
8Created: 07-Feb-2008
9Post-History:
10
11
12Metadata Extension
13==================
14
15* "httpseeds"
16
17In the main area of the metadata file and not part of the "info"
18section, will be a new key, "httpseeds".  This key will refer to a
19list of URLs, and will contain a list of web addresses where torrent
20data can be retrieved.  This key may be safely ignored if the client
21is not capable of using it.
22
23Examples::
24
25  d['httpseeds'] = [ 'http://www.whatever.com/seed.php' ]
26
27This specifies the client can retrieve data by accessing the given
28URL with the parameters supplied in the protocol specification
29below::
30
31  d['httpseeds'] = [ 'http://www.site1.com/source1.php',
32                     'http://www.site2.com/source2.php'  ]
33
34More than one URL may be specified; if so, the client will attempt
35to access both URLs to download seed data.
36
37
38Protocol
39========
40
41The client calls the URL given, in the following format::
42
43  <url>?info_hash=[hash]&piece=[piece]{&ranges=[start]-[end]{,[start]-[end]}...}
44
45Examples::
46
47  http://www.whatever.com/seed.php?info_hash=%9C%D9i%8A%F5Uu%1A%91%86%AE%06lW%EA%21W%235%E0&piece=3
48  http://www.whatever.com/seed.php?info_hash=%9C%D9i%8A%F5Uu%1A%91%86%AE%06lW%EA%21W%235%E0&piece=8&ranges=49152-131071,180224-262143
49
50The URL would be for a script which has access to the files
51contained in the torrent, and to the metadata (.torrent) file
52itself, so that it may calculate what byte ranges to pull from
53what files.  One such script has been written by DeHackEd, and
54is available at http://bt.degreez.net .
55
56The script should return, if everything is okay, either a status
57of 200 (OK) and a block of data (either the entire piece if no
58ranges were given, or the ranges of data requested for that piece
59appended together), in binary format, or 503 (Service Temporarily
60Unavailable), with the body of the return being an ASCII integer
61value specifying how long the client should wait before retrying.
62The client should consider any other return code as an error.
63In the case of an error, the client should retry, but should
64retry less often if the failure to contact the seed continues.
65
66
67Server-side Implementation Notes
68================================
69
70The purpose of the http seed script is to limit access to the
71data being downloaded so that the web server isn't overwhelmed
72by clients asking for the data.  If it weren't for this limiting,
73there would be no way to prevent someone from coding a client
74to try to download continuously or multiply, resulting in a
75heavy load on the server.  Limiting the download rate also
76allows an http seed script to be run on a web account where
77the total amount of data downloaded is restricted or may result
78in extra service charges.
79
80The script must provide three major functions:
81
821. Limit its average upload to a reasonable level.
83
842. Intelligently tell peers how long they should wait before
85   retrying.
86
873. translate from an info-hash and piece number to a byte range
88   within a file or set of files, and return those bytes.
89
90Another highly desirable function is to check whether peers are
91retrying too often, and to automatically ban those peers.
92
93Other desirable features include a way of monitoring the tracker
94the torrent is using and to stop uploading data if sufficient
95P2P seeds exist, and a way to feed back to the tracker to show
96a seed is present.
97
98
99
100Client-side Implementation Notes
101================================
102
103The prototype code base has a default retry time of 30 seconds;
104after 3 retries with errors, the time is lengthened with each
105cycle.
106
107The prototype code will not display any errors with contacting
108http seeds (unless the URL given in the .torrent is incorrect)
109until it has received data from that seed.  (The prototype code
110also won't display any errors for any http reply that was
111actually received.)
112
113Current behavior is:  Request the rarest piece you're missing
114in entirety that you can locate.  If you have no pieces that
115aren't partially downloaded, skip one retry cycle, then start
116requesting partials.  If you receive a 503 response, set the
117retry time equal to the integer value received in the response.
Note: See TracBrowser for help on using the browser.