How BEP 19 HTTP and FTP Seeding Works
BitTorrent Enhancement Proposal 19 (BEP 19), titled “WebSeed - HTTP/FTP Seeding (GetRight style),” defines a standardized mechanism allowing BitTorrent clients to download piece data from traditional web servers (HTTP) or FTP servers alongside standard peer-to-peer swarms. This specification bridges the gap between client-server architectures and decentralized networks, enabling content publishers to guarantee file availability, bootstrap new torrents without dedicated seedboxes, and provide fallback bandwidth when peer availability is low.
The url-list Metadata
Key
BEP 19 implements web seeding by introducing a new key called
url-list into the root or the info dictionary
of a .torrent file. The url-list can contain
either a single URL string or a list of URL strings pointing to HTTP or
FTP endpoints hosting the target content. When a compatible BitTorrent
client loads the torrent metadata, it reads this key and registers the
provided URLs as WebSeeds.
Request Mechanics and Byte Ranges
To download pieces from a web server without requiring custom
server-side BitTorrent software, BEP 19 utilizes standard HTTP
Range headers (RFC 7233) and FTP REST
commands.
- Single-File Torrents: If the torrent contains only
one file, the URL directly references that file. The client requests
specific byte ranges corresponding to the boundaries of the required
BitTorrent pieces using standard HTTP range requests (e.g.,
Range: bytes=0-524287). - Multi-File Torrents: If the torrent contains
multiple files, the URL in
url-listacts as a root directory prefix (indicated by a trailing slash). The client resolves individual file paths by appending the sub-paths listed in the torrent’sfilesdictionary. When a BitTorrent piece spans across multiple files, the client splits the piece request into separate HTTP byte-range requests for each respective file.
Data Integrity and Verification
Even though data is retrieved over standard HTTP/FTP connections
rather than the peer wire protocol, the torrent client treats the
incoming data identically to peer-sourced data. Once a full piece is
downloaded from the web server, the client computes its cryptographic
SHA-1 hash and validates it against the corresponding hash in the
torrent’s pieces string. If the hash fails, the downloaded
data is discarded, preventing corrupted or tampered web data from
entering the swarm.
Swarm Integration and Client Strategy
A standard client implementing BEP 19 treats an HTTP/FTP source as a specialized peer with distinct behaviors:
- Upload Conservation: Web seeds are typically treated as read-only peers; the client does not attempt to upload pieces to the HTTP/FTP server.
- Choking and Rate Limiting: Clients typically deprioritize web seeds when sufficient P2P seeds and peers are available, reducing bandwidth costs for the server host.
- Initial Seeding: If a swarm has zero active seeders, the client can fetch the entire dataset from the web seed, transition into a peer seeder, and redistribute pieces to the rest of the swarm.