Skip to content

If torrent is not private, leave private flag unset - #1411

Merged
DiegoRBaquero merged 1 commit into
masterfrom
is-private
May 25, 2018
Merged

If torrent is not private, leave private flag unset#1411
DiegoRBaquero merged 1 commit into
masterfrom
is-private

Conversation

@feross

@feross feross commented May 25, 2018

Copy link
Copy Markdown
Member

If torrent is not private, leave private flag unset. This ensures that the torrent info hash will match the result generated by other tools, including webtorrent-cli.

Fixes: https://github.com/webtorrent/webtorrent-hybrid/issues/79


More info:

WebTorrent Desktop uses the result of the "Private" checkbox at torrent creation time to set the torrent's private flag to true or false. Unfortunately, there's an issue with the way this private flag spec was designed. There are actually 3 possible values for the private flag:

  • private: true
  • private: false
  • not specified (defaults to false)

The problem is that private flag is part of the info section in the .torrent file, which means that each of these three values for private will produce a different info hash.

So, what's happening is that webtorrent-cli and webtorrent-hybrid are not setting private at all, while WebTorrent Desktop is setting it to false.

We should either set it to true or leave it not specified to match what webtorrent-cli, webtorrent-hybrid, and other mainstream torrent clients do.

If torrent is not private, leave private flag unset. This ensures that the torrent info hash will match the result generated by other tools, including webtorrent-cli.

@DiegoRBaquero DiegoRBaquero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to leave it unset rather than changing the others to setting it to false. It's unneeded info in the torrent tbh.

@codealchemist codealchemist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense and the change is looking good.
Thanks!

@DiegoRBaquero
DiegoRBaquero merged commit ad63ec8 into master May 25, 2018
@DiegoRBaquero
DiegoRBaquero deleted the is-private branch May 25, 2018 17:15
@feross

feross commented May 27, 2018

Copy link
Copy Markdown
Member Author

Thanks for the review!

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants