Song Zhang | 7 Jan 2010 18:51
Picon

Re: partial download

Hi,

Could you pls tell me from which version(lowest version) of mainline BitTorrent ( Bram Cohen) begin to support PEX  ? thanks !


_______________________________________________
BitTorrent mailing list
BitTorrent <at> lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/bittorrent
Song Zhang | 8 Jan 2010 01:06
Picon

mainline BT version for PEX

Hi,

Could you pls tell me from which version(lowest version) of mainline BitTorrent ( Bram Cohen) begin to support PEX  ? thanks !

_______________________________________________
BitTorrent mailing list
BitTorrent <at> lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/bittorrent
Harold Feit | 8 Jan 2010 11:58
Favicon
Gravatar

Re: mainline BT version for PEX

If you're referring to an open-source version, none of them do.
The 6.x version tree does.

Song Zhang wrote:
> Hi,
> 
> Could you pls tell me from which version(lowest version) of mainline
> BitTorrent ( Bram Cohen) begin to support PEX  ? thanks !
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> BitTorrent mailing list
> BitTorrent <at> lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/bittorrent
Jon Bellamy | 8 Jan 2010 16:56
Picon
Favicon

Re: Dht Local Node Id

Does anyone knwo the answer to the question below?


From: y2jb <at> hotmail.co.uk
To: bittorrent <at> lists.ibiblio.org
Date: Tue, 8 Dec 2009 14:30:47 +0000
Subject: [bittorrent] Dht Local Node Id

.ExternalClass .ecxhmmessage P {padding:0px;} .ExternalClass body.ecxhmmessage {font-size:10pt;font-family:Verdana;} I currently save my routing table everytime my dht client is shutdown, however i regenerate my local dht node id (to a random 160 bit id)
everytime the client starts up. Should i also save my local node id?

Cheers

Jon

New! Receive and respond to mail from other email accounts from within Hotmail Find out how.
Got a cool Hotmail story? Tell us now
_______________________________________________
BitTorrent mailing list
BitTorrent <at> lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/bittorrent
Adrian Ulrich | 8 Jan 2010 20:06
Picon

Re: Dht Local Node Id

> Does anyone knwo the answer to the question below?

> I currently save my routing table everytime my dht client is shutdown, however i regenerate my local dht
node id (to a random 160 bit id) 
> everytime the client starts up. Should i also save my local node id?

No, it doesn't matter. (There might be some benefit if the user has a static IP)

But why do you save the complete routing table? It will be outdated after a few hours anyway.
Just save some random good nodes, use them to boot (if all of them fail -> use router.utorrent.com /
router.bitflu.org) and
re-build the routing table.

Regards,
 Adrian
Alan McGovern | 20 Jan 2010 16:02
Picon
Gravatar

How should .torrent files with unsorted info dictionary keys be handled

I'm going to keep this short and link to a longer post [0] if you want more background. Basically I'm hoping that all of us will be able to agree on one method of handling these invalid torrents and implement that for the next release of our software. We should also update the unofficial spec (http://wiki.theory.org/BitTorrentSpecification) and also try to get the official spec ammended with the results of this discussion.

Essentially the problem is that if a .torrent file exists which has unsorted dictionary keys [1] in its info dictionary then there are three ways in which it can be parsed and two possible infohashes which can be generated:

1) You can decode the info dictionary, order the keys (as per spec) then generate the infohash using the sorted keys.

2) You can take a substring from the .torrent file which spans the info dictionary and just run those raw bytes through a SHA1 hash and generate the info hash. This generates a *different* infohash as to method 1.

3) Discard the torrent as invalid and refuse to process.

So pros and cons:
Approach 1:
Pro: This approach implies that if an invalid bencoded dictionary is found it should be converted into a valid representation and used.

Pro: This should be relatively trivial for most clients to implement.

Con: The letter of the spec [2] says that we should always use a substring of the .torrent metadata. Strictly speaking this approach goes against the spec. However, we have to assume that when the spec refers to ".torrent metadata' it refers to *specification compliant* .torrent metadata. i.e. the keys in the metadata must be sorted for it to be considered valid .torrent metadata. Conversely, if the keys are *not* sorted then the data should not be considered valid .torrent metadata. If that's the case, then why are you generating a valid infohash from invalid metadata?

Con: You need a non-spec compliant way of decoding bencoded data.

Approach 2:
Pro: You follow the letter of the bittorrent specification but still break the BEncoding specification.

Con: I'd argue that this is slightly more complex to implement as you may now need to double parse the .torrent file in order to generate the infohash. The first time you pass it through your bencoded data decoder to generate your in-memory representation. Then you have to parse the file manually a second time to find the start and end of the info dictionary and extract that substring.

Con: I'd argue that you're breaking the spirit of the specification again as you're now running under the assumption that invalid bencoded data is valid .torrent metadata and the spec doesn't explicitly allow this ;)

Approach 3:

Pro: Simplest to implement as you just have to make your bencoded data decoder spec compliant. Once this happens, the .torrent won't be loadable so that question of how to generate the infohash never has to be answered.

Con: It will render some torrents unloadable but those should be a very small percentage.

[0] http://forum.utorrent.com/viewtopic.php?pid=431793#p431793
[1] http://wiki.theory.org/BitTorrentSpecification#dictionaries
[2] "The 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. Note that this is a substring of the metainfo file."

_______________________________________________
BitTorrent mailing list
BitTorrent <at> lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/bittorrent
Harold Feit | 20 Jan 2010 19:02
Favicon
Gravatar

Re: How should .torrent files with unsorted info dictionary keys be handled

I'll put my two cents in quick.
Take option three. The specification is clearly defined, if your
dictionary's keys aren't sorted properly, you're in violation and should
NOT be encouraged to continue to be in violation.

Alan McGovern wrote:
> I'm going to keep this short and link to a longer post [0] if you want
> more background. Basically I'm hoping that all of us will be able to
> agree on one method of handling these invalid torrents and implement
> that for the next release of our software. We should also update the
> unofficial spec (http://wiki.theory.org/BitTorrentSpecification) and
> also try to get the official spec ammended with the results of this
> discussion.
> 
> Essentially the problem is that if a .torrent file exists which has
> unsorted dictionary keys [1] in its info dictionary then there are three
> ways in which it can be parsed and two possible infohashes which can be
> generated:
> 
> 1) You can decode the info dictionary, order the keys (as per spec) then
> generate the infohash using the sorted keys.
> 
> 2) You can take a substring from the .torrent file which spans the info
> dictionary and just run those raw bytes through a SHA1 hash and generate
> the info hash. This generates a *different* infohash as to method 1.
> 
> 3) Discard the torrent as invalid and refuse to process.
> 
> So pros and cons:
> Approach 1:
> Pro: This approach implies that if an invalid bencoded dictionary is
> found it should be converted into a valid representation and used.
> 
> Pro: This should be relatively trivial for most clients to implement.
> 
> Con: The letter of the spec [2] says that we should always use a
> substring of the .torrent metadata. Strictly speaking this approach goes
> against the spec. However, we have to assume that when the spec refers
> to ".torrent metadata' it refers to *specification compliant* .torrent
> metadata. i.e. the keys in the metadata must be sorted for it to be
> considered valid .torrent metadata. Conversely, if the keys are *not*
> sorted then the data should not be considered valid .torrent metadata.
> If that's the case, then why are you generating a valid infohash from
> invalid metadata?
> 
> Con: You need a non-spec compliant way of decoding bencoded data.
> 
> Approach 2:
> Pro: You follow the letter of the bittorrent specification but still
> break the BEncoding specification.
> 
> Con: I'd argue that this is slightly more complex to implement as you
> may now need to double parse the .torrent file in order to generate the
> infohash. The first time you pass it through your bencoded data decoder
> to generate your in-memory representation. Then you have to parse the
> file manually a second time to find the start and end of the info
> dictionary and extract that substring.
> 
> Con: I'd argue that you're breaking the spirit of the specification
> again as you're now running under the assumption that invalid bencoded
> data is valid .torrent metadata and the spec doesn't explicitly allow
> this ;)
> 
> Approach 3:
> 
> Pro: Simplest to implement as you just have to make your bencoded data
> decoder spec compliant. Once this happens, the .torrent won't be
> loadable so that question of how to generate the infohash never has to
> be answered.
> 
> Con: It will render some torrents unloadable but those should be a very
> small percentage.
> 
> [0] http://forum.utorrent.com/viewtopic.php?pid=431793#p431793
> [1] http://wiki.theory.org/BitTorrentSpecification#dictionaries
> [2] "The 20 byte sha1 hash of the bencoded form of the info value from
> the metainfo file. Note that this is a substring of the metainfo file."
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> BitTorrent mailing list
> BitTorrent <at> lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/bittorrent
Andrew Brampton | 20 Jan 2010 19:08
Picon
Picon
Gravatar

Re: How should .torrent files with unsorted info dictionary keys be handled

I would say option one, as you should be generous on input, strict on
output. If however, it would be non trivial to compute the hash from
anything other than the substring, I would go with option three.

Andrew

2010/1/20 Alan McGovern <alan.mcgovern <at> gmail.com>:
> I'm going to keep this short and link to a longer post [0] if you want more
> background. Basically I'm hoping that all of us will be able to agree on one
> method of handling these invalid torrents and implement that for the next
> release of our software. We should also update the unofficial spec
> (http://wiki.theory.org/BitTorrentSpecification) and also try to get the
> official spec ammended with the results of this discussion.
>
> Essentially the problem is that if a .torrent file exists which has unsorted
> dictionary keys [1] in its info dictionary then there are three ways in
> which it can be parsed and two possible infohashes which can be generated:
>
> 1) You can decode the info dictionary, order the keys (as per spec) then
> generate the infohash using the sorted keys.
>
> 2) You can take a substring from the .torrent file which spans the info
> dictionary and just run those raw bytes through a SHA1 hash and generate the
> info hash. This generates a *different* infohash as to method 1.
>
> 3) Discard the torrent as invalid and refuse to process.
>
> So pros and cons:
> Approach 1:
> Pro: This approach implies that if an invalid bencoded dictionary is found
> it should be converted into a valid representation and used.
>
> Pro: This should be relatively trivial for most clients to implement.
>
> Con: The letter of the spec [2] says that we should always use a substring
> of the .torrent metadata. Strictly speaking this approach goes against the
> spec. However, we have to assume that when the spec refers to ".torrent
> metadata' it refers to *specification compliant* .torrent metadata. i.e. the
> keys in the metadata must be sorted for it to be considered valid .torrent
> metadata. Conversely, if the keys are *not* sorted then the data should not
> be considered valid .torrent metadata. If that's the case, then why are you
> generating a valid infohash from invalid metadata?
>
> Con: You need a non-spec compliant way of decoding bencoded data.
>
> Approach 2:
> Pro: You follow the letter of the bittorrent specification but still break
> the BEncoding specification.
>
> Con: I'd argue that this is slightly more complex to implement as you may
> now need to double parse the .torrent file in order to generate the
> infohash. The first time you pass it through your bencoded data decoder to
> generate your in-memory representation. Then you have to parse the file
> manually a second time to find the start and end of the info dictionary and
> extract that substring.
>
> Con: I'd argue that you're breaking the spirit of the specification again as
> you're now running under the assumption that invalid bencoded data is valid
> .torrent metadata and the spec doesn't explicitly allow this ;)
>
> Approach 3:
>
> Pro: Simplest to implement as you just have to make your bencoded data
> decoder spec compliant. Once this happens, the .torrent won't be loadable so
> that question of how to generate the infohash never has to be answered.
>
> Con: It will render some torrents unloadable but those should be a very
> small percentage.
>
> [0] http://forum.utorrent.com/viewtopic.php?pid=431793#p431793
> [1] http://wiki.theory.org/BitTorrentSpecification#dictionaries
> [2] "The 20 byte sha1 hash of the bencoded form of the info value from the
> metainfo file. Note that this is a substring of the metainfo file."
> _______________________________________________
> BitTorrent mailing list
> BitTorrent <at> lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/bittorrent
>
>
Alan McGovern | 20 Jan 2010 20:49
Picon
Gravatar

Re: How should .torrent files with unsorted info dictionary keys be handled

Hi,

On Wed, Jan 20, 2010 at 6:08 PM, Andrew Brampton <andrew <at> bramp.freeserve.co.uk> wrote:
I would say option one, as you should be generous on input, strict on
output. If however, it would be non trivial to compute the hash from
anything other than the substring, I would go with option three.

I think you've confused option 1 and 2 there, or I just described them wrong. Option 1 was decode the unordered keys and then sort them in memory, then use this new representation to generate the infohash.

Option 2 was to take the unordered keys directly as they are in the .torrent file and generate the infohash using the unordered keys.

If i had to choose between option 1 and 2 I'd go with 1 as i feel it follows the spec closer then option 2. The spec was written with the assumption that valid bencoded metadata would be supplied. Therefore lines where it refers to using a 'substring' should (in my eyes) be interpreted to mean taking a substring from the valid metadata. So if the data is invalid, you should make it valid and then take your substring.

However, my library currently does option 3 and I've been highly against changing that to support option 1 for a long time now ;) Having some clients support option 1 and others support option 2 is the problem I'm trying to tackle here. Ideally (in my eyes) we should all use option 3, otherwise we need to settle on 1 or 2. Input from both uTorrent and Azureus would be great as they are the two biggest players, so if anyone knows uTorrent/Azureus devs, please try to get them to chime in.

Thanks,
Alan.
 

Andrew

2010/1/20 Alan McGovern <alan.mcgovern <at> gmail.com>:
> I'm going to keep this short and link to a longer post [0] if you want more
> background. Basically I'm hoping that all of us will be able to agree on one
> method of handling these invalid torrents and implement that for the next
> release of our software. We should also update the unofficial spec
> (http://wiki.theory.org/BitTorrentSpecification) and also try to get the
> official spec ammended with the results of this discussion.
>
> Essentially the problem is that if a .torrent file exists which has unsorted
> dictionary keys [1] in its info dictionary then there are three ways in
> which it can be parsed and two possible infohashes which can be generated:
>
> 1) You can decode the info dictionary, order the keys (as per spec) then
> generate the infohash using the sorted keys.
>
> 2) You can take a substring from the .torrent file which spans the info
> dictionary and just run those raw bytes through a SHA1 hash and generate the
> info hash. This generates a *different* infohash as to method 1.
>
> 3) Discard the torrent as invalid and refuse to process.
>
> So pros and cons:
> Approach 1:
> Pro: This approach implies that if an invalid bencoded dictionary is found
> it should be converted into a valid representation and used.
>
> Pro: This should be relatively trivial for most clients to implement.
>
> Con: The letter of the spec [2] says that we should always use a substring
> of the .torrent metadata. Strictly speaking this approach goes against the
> spec. However, we have to assume that when the spec refers to ".torrent
> metadata' it refers to *specification compliant* .torrent metadata. i.e. the
> keys in the metadata must be sorted for it to be considered valid .torrent
> metadata. Conversely, if the keys are *not* sorted then the data should not
> be considered valid .torrent metadata. If that's the case, then why are you
> generating a valid infohash from invalid metadata?
>
> Con: You need a non-spec compliant way of decoding bencoded data.
>
> Approach 2:
> Pro: You follow the letter of the bittorrent specification but still break
> the BEncoding specification.
>
> Con: I'd argue that this is slightly more complex to implement as you may
> now need to double parse the .torrent file in order to generate the
> infohash. The first time you pass it through your bencoded data decoder to
> generate your in-memory representation. Then you have to parse the file
> manually a second time to find the start and end of the info dictionary and
> extract that substring.
>
> Con: I'd argue that you're breaking the spirit of the specification again as
> you're now running under the assumption that invalid bencoded data is valid
> .torrent metadata and the spec doesn't explicitly allow this ;)
>
> Approach 3:
>
> Pro: Simplest to implement as you just have to make your bencoded data
> decoder spec compliant. Once this happens, the .torrent won't be loadable so
> that question of how to generate the infohash never has to be answered.
>
> Con: It will render some torrents unloadable but those should be a very
> small percentage.
>
> [0] http://forum.utorrent.com/viewtopic.php?pid=431793#p431793
> [1] http://wiki.theory.org/BitTorrentSpecification#dictionaries
> [2] "The 20 byte sha1 hash of the bencoded form of the info value from the
> metainfo file. Note that this is a substring of the metainfo file."
> _______________________________________________
> BitTorrent mailing list
> BitTorrent <at> lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/bittorrent
>
>

_______________________________________________
BitTorrent mailing list
BitTorrent <at> lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/bittorrent
Josef Drexler | 20 Jan 2010 21:05
Favicon

Re: How should .torrent files with unsorted info dictionary keys be handled

On Jan 20, 2010, at 8:49 PM, Alan McGovern wrote:
> However, my library currently does option 3 and I've been highly  
> against changing that to support option 1 for a long time now ;)  
> Having some clients support option 1 and others support option 2 is  
> the problem I'm trying to tackle here. Ideally (in my eyes) we  
> should all use option 3, otherwise we need to settle on 1 or 2.  
> Input from both uTorrent and Azureus would be great as they are the  
> two biggest players, so if anyone knows uTorrent/Azureus devs,  
> please try to get them to chime in.

libTorrent/rTorrent used to do option 1 (generate valid bencode from  
a slightly broken .torrent file), but I changed it so that it now  
refuses to recognize the .torrent file. From the thread you linked  
and my observations, utorrent does option 2, taking the SHA1 of the  
info substring even if it isn't valid bencode data.

If just refusing the files isn't acceptable, and we need to settle on  
option 1 or 2, I'll definitely be happier with option 1 (and not just  
because in libTorrent the code to do this is already there, but  
dormant). Accepting broken input and processing it as if it was  
valid, instead of fixing it first, is just wrong.

--

-- 
Josef Drexler
josef <at> ttdpatch.net

Gmane