Monday, January 19th, 2009
Opera does it. Others talk about it. Robert Accettura posts about how he thinks we should implement BitTorrent in the browser.
He doesn’t want a
X-Torrent HTTP header as we can use
Accept-Encoding for the same goal. How would it work?
Assume my browser supports the BitTorrent protocol and I visit the following URL for a download:http://dl.robert.accettura.com/pub/myfile.tar.gz
My request would look something like this:Get: /pub/myfile.tar.gz Host: dl.robert.accettura.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:188.8.131.52) Gecko/2008120122 Firefox/3.0.5 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate,torrent Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://robert.accettura.com/download
The servers response would look something like this:Date: Sun, 18 Jan 2009 00:25:54 GMT Server: Apache Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: application/x-bittorrent
The content would be the actual torrent. The browser would handle as appropriate by opening a helper application or handling it internally. If I didn’t have
Accept-Encodingheader, I would have been served via HTTP like we are all accustomed.
Now what happens if the server is not responding? A fallback to the DNS level could be done.
First take the GET and generate a SHA1 checksum for the GET, in my example that would be:438296e855494825557824b691a09d06a86a21f1
Now to generate a DNS Query in the format
The response would look something like a Base64 encoded
.torrentfile broken up and served as
TXTrecords. Should the string not fit in one record (I think the limit is 512 bytes) the response could be broken up into multiple records and concatenated by the client to reassemble.
Odds of a collision with existing DNS space is limited due to the use of a SHA1 hash and the
_torrentsubdomain. It coexists peacefully.
The downside here is that if your server fails your DNS is going to take an extra query from any client capable of doing this. There is slight latency in this process.
The upside is that DNS scaling has come a long way and is rarely an issue for popular sites and web hosts. DNS can (and often is) cached by ISP’s resulting in an automatic edge CDN thanks to ISP’s. ISP’s can also mitigate traffic on their networks by caching on their side (something I also suggested in 2004).
BitTorrent may be used for illegal content, but so is HTTP. I think costs for ISP’s and websites could be significantly cut by making BitTorrent more transparent as a data transfer protocol.
What do you think?
Posted by Dion Almaer at 7:12 am