added support for http seeds (BEP 17)

This commit is contained in:
Arvid Norberg
2008-12-30 03:54:07 +00:00
parent 96a771ef8b
commit e5d3755afb
17 changed files with 890 additions and 91 deletions

View File

@@ -41,8 +41,8 @@ following features:
* supports local peer discovery (multicasts for peers on the same local network)
* adjusts the length of the request queue depending on download rate.
* has an adjustable read and write disk cache for improved disk throughput.
* multitracker extension support (supports both the `specification by John Hoffman`__
and the uTorrent interpretation).
* multitracker extension support (supports both strict `BEP 12`_ and the
uTorrent interpretation).
* tracker scrapes
* supports both sparse files and compact file allocation (where pieces
are kept consolidated on disk)
@@ -51,12 +51,12 @@ following features:
* fast resume support, a way to get rid of the costly piece check at the
start of a resumed torrent. Saves the storage state, piece_picker state
as well as all local peers in a separate fast-resume file.
* `HTTP seeding`_, as `specified by Michael Burford of GetRight`__.
* `HTTP seeding`_, as specified in `BEP 17`_ and `BEP 19`_.
* piece picking on block-level (as opposed to piece-level).
This means it can download parts of the same piece from different peers.
It will also prefer to download whole pieces from single peers if the
download speed is high enough from that particular peer.
* supports the `udp-tracker protocol`_ by Olaf van der Spek.
* supports `BEP 15`_ the udp-tracker protocol.
* queues torrents for file check, instead of checking all of them in parallel.
* supports http proxies and basic proxy authentication
* gzipped tracker-responses
@@ -80,7 +80,10 @@ following features:
.. _`DHT extensions`: dht_extensions.html
__ http://home.elp.rr.com/tur/multitracker-spec.txt
__ http://www.getright.com/seedtorrent.html
.. _`BEP 12`: http://bittorrent.org/beps/bep_0012.html
.. _`BEP 15`: http://bittorrent.org/beps/bep_0015.html
.. _`BEP 17`: http://bittorrent.org/beps/bep_0017.html
.. _`BEP 19`: http://bittorrent.org/beps/bep_0019.html
.. _`extension protocol`: extension_protocol.html
.. _`udp-tracker protocol`: udp_tracker_protocol.html

View File

@@ -1,7 +1,7 @@
# this makefile assumes that you have docutils and rst2pdf installed
WEB_PATH = ~/Documents/rasterbar/web/products/libtorrent
DOCUTILS = ~/docutils
DOCUTILS = ~/docutils-0.5
TARGETS = index \
udp_tracker_protocol \

View File

@@ -1269,6 +1269,9 @@ The ``torrent_info`` has the following synopsis::
bool priv() const;
std::vector<std::string> const& url_seeds() const;
void add_url_seed(std::string const& url);
std::vector<std::string> const& http_seeds() const;
void add_http_seed(std::string const& url);
size_type total_size() const;
int piece_length() const;
@@ -1473,17 +1476,20 @@ The input range is assumed to be valid within the torrent. ``file_offset``
must refer to a valid file, i.e. it cannot be >= ``num_files()``.
url_seeds() add_url_seed()
--------------------------
url_seeds() add_url_seed() http_seeds() add_http_seed()
-------------------------------------------------------
::
std::vector<std::string> const& url_seeds() const;
void add_url_seed(std::string const& url);
std::vector<std::string> const& http_seeds() const;
void add_http_seed(std::string const& url);
If there are any url-seeds in this torrent, ``url_seeds()`` will return a
vector of those urls. If you're creating a torrent file, ``add_url_seed()``
adds one url to the list of url-seeds. Currently, the only transport protocol
If there are any url-seeds or http seeds in this torrent, ``url_seeds()``
and ``http_seeds()`` will return a vector of those urls.
``add_url_seed()`` and ``add_http_seed()`` adds one url to the list of
url/http seeds. Currently, the only transport protocol
supported for the url is http.
See `HTTP seeding`_ for more information.
@@ -1687,6 +1693,10 @@ Its declaration looks like this::
void remove_url_seed(std::string const& url);
std::set<std::string> url_seeds() const;
void add_http_seed(std::string const& url);
void remove_http_seed(std::string const& url);
std::set<std::string> http_seeds() const;
void set_ratio(float ratio) const;
void set_max_uploads(int max_uploads) const;
void set_max_connections(int max_connections) const;
@@ -2225,6 +2235,19 @@ automatically from the list.
See `HTTP seeding`_ for more information.
add_http_seed() remove_http_seed() http_seeds()
-----------------------------------------------
::
void add_http_seed(std::string const& url);
void remove_http_seed(std::string const& url);
std::set<std::string> http_seeds() const;
These functions are identical as the ``*_url_seed()`` variants, but they
operate on BEP 17 web seeds instead of BEP 19.
See `HTTP seeding`_ for more information.
queue_position() queue_position_up() queue_position_down() queue_position_top() queue_position_bottom()
-------------------------------------------------------------------------------------------------------
@@ -5514,17 +5537,23 @@ Don't have metadata:
HTTP seeding
------------
The HTTP seed extension implements `this specification`__.
There are two kinds of HTTP seeding. One with that assumes a smart
(and polite) client and one that assumes a smart server. These
are specified in `BEP 19`_ and `BEP 17`_ respectively.
The libtorrent implementation assumes that, if the URL ends with a slash
libtorrent supports both. In the libtorrent source code and API,
BEP 19 urls are typically referred to as *url seeds* and BEP 17
urls are typically referred to as *HTTP seeds*.
The libtorrent implementation of `BEP 19`_ assumes that, if the URL ends with a slash
('/'), the filename should be appended to it in order to request pieces from
that file. The way this works is that if the torrent is a single-file torrent,
only that filename is appended. If the torrent is a multi-file torrent, the
torrent's name '/' the file name is appended. This is the same directory
structure that libtorrent will download torrents into.
__ http://www.getright.com/seedtorrent.html
.. _`BEP 17`: http://bittorrent.org/beps/bep_0017.html
.. _`BEP 19`: http://bittorrent.org/beps/bep_0019.html
filename checks
===============
@@ -5544,7 +5573,7 @@ __ http://www.boost.org/libs/filesystem/doc/index.htm
acknowledgments
===============
Written by Arvid Norberg. Copyright |copy| 2003-2006
Written by Arvid Norberg. Copyright |copy| 2003-2008
Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson