mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-02-21 20:59:02 +00:00
Don't add insecure trackers on a https site
https://github.com/feross/webtorrent/issues/67#issuecomment-189853184
This commit is contained in:
parent
7daf7ec297
commit
3d84d44abc
10
client.js
10
client.js
@ -86,7 +86,15 @@ function Client (peerId, port, torrent, opts) {
|
||||
return new HTTPTracker(self, announceUrl)
|
||||
} else if (protocol === 'udp:' && typeof UDPTracker === 'function') {
|
||||
return new UDPTracker(self, announceUrl)
|
||||
} else if ((protocol === 'ws:' || protocol === 'wss:') && webrtcSupport) {
|
||||
} else if (((protocol === 'ws:') || protocol === 'wss:') && webrtcSupport) {
|
||||
// Don't try to add http tracker on an https website
|
||||
if (protocol === 'ws:' && location && location.protocol && location.protocol === 'https:') {
|
||||
process.nextTick(function () {
|
||||
var err = new Error('unsupported http tracker on https: ' + announceUrl)
|
||||
self.emit('warning', err)
|
||||
})
|
||||
return null
|
||||
}
|
||||
return new WebSocketTracker(self, announceUrl)
|
||||
} else {
|
||||
process.nextTick(function () {
|
||||
|
Loading…
Reference in New Issue
Block a user