mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 10:31:36 +00:00
Merge pull request #128 from DiegoRBaquero/patch-2
Don't add non-secure trackers on a https site
This commit is contained in:
commit
b2ff218e93
@ -87,6 +87,14 @@ function Client (peerId, port, torrent, opts) {
|
|||||||
} else if (protocol === 'udp:' && typeof UDPTracker === 'function') {
|
} else if (protocol === 'udp:' && typeof UDPTracker === 'function') {
|
||||||
return new UDPTracker(self, announceUrl)
|
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)
|
return new WebSocketTracker(self, announceUrl)
|
||||||
} else {
|
} else {
|
||||||
process.nextTick(function () {
|
process.nextTick(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user