I had a couple of email exchanges today with folks that were setting up BitTorrent enclosure feeds. The question of how to deal with the required"length" attribute arose. This can be tricky if you're running a third party feed for files that you're not yourself hosting.


The key point is that the length field specifies the length of the .torrent file, not the length of the larger file that the .torrent helps you download. So in the following example




the length attibute is set to about 25kb, the size of the .torrent file itself, and not 329MB, the size of the ZIP archive.


When setting up a feed for .torrent files that live on some other server, you can either a) issue an HTTP HEAD request and check the Content-Length field, or b) fetch the .torrent and check its size. Here is an example of what an HTTP HEAD request looks like from the command line.


[Andrew Grumet's Weblog]