Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.add(torrentUrl) erronously adds the local client port #768

Closed
mrozbarry opened this issue Apr 24, 2016 · 6 comments
Closed

.add(torrentUrl) erronously adds the local client port #768

mrozbarry opened this issue Apr 24, 2016 · 6 comments

Comments

@mrozbarry
Copy link

@mrozbarry mrozbarry commented Apr 24, 2016

  • WebTorrent version: 0.91.0
  • Node.js version: 5.8
  • Browser name/version (if using WebTorrent in the browser): Chrome/49.0.2623.112 (64-bit)

While testing my app, I am running from http://localhost:3000 . To test, I added http://releases.ubuntu.com/16.04/ubuntu-16.04-desktop-amd64.iso.torrent as the torrent url with no extra options. After it's added, I get an error saying the torrent http://releases.ubuntu.com:3000/16.04/ubuntu-16.04-desktop-amd64.iso.torrent couldn't be added. Why is port 3000 being added?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 24, 2016

Can you share a complete code example?

@mrozbarry

This comment has been minimized.

Copy link
Author

@mrozbarry mrozbarry commented Apr 25, 2016

I'm using webpack-dev-server, which is serving my files on port 3000. For my webpack config, I added
target: 'web', node: { fs: 'empty' } as part of my configuration

import WebTorrent from 'webtorrent'

const client = new WebTorrent()
client.on('torrent', function (torrent) {
  console.log('A new torrent has been added:', torrent)
})
client.add('http://releases.ubuntu.com/16.04/ubuntu-16.04-desktop-amd64.iso.torrent')
@mrozbarry

This comment has been minimized.

Copy link
Author

@mrozbarry mrozbarry commented Apr 27, 2016

@feross I made a much more comprehensive example here

@mrozbarry

This comment has been minimized.

Copy link
Author

@mrozbarry mrozbarry commented Apr 27, 2016

@feross your issue is here. The try/catch isn't doing what you expect it to. Looks like parseTorrent doesn't throw, even though it looks like it should. Never mind, but it appears that maybe simple-get might be the culprit, but I don't see it assigning a port. Maybe webpack is intercepting it in some way, but I so far can't find anything detailing how/when that would happen.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented May 5, 2016

This is a bug in http-browserify which webpack is using. Browserify doesn't have this issue because it's using the superior stream-http package.

webpack should switch to use stream-http. Issue here: webpack/node-libs-browser#38

@feross feross closed this May 5, 2016
@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.