Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [3.0.16](https://github.com/webtorrent/webtorrent/compare/v3.0.15...v3.0.16) (2026-05-29)


### Bug Fixes

* **perf:** utp speed ([#3068](https://github.com/webtorrent/webtorrent/issues/3068)) ([668ccdd](https://github.com/webtorrent/webtorrent/commit/668ccdd5fc38065a84282103209380f7e9c743cf))

## [3.0.15](https://github.com/webtorrent/webtorrent/compare/v3.0.14...v3.0.15) (2026-05-29)


### Bug Fixes

* server path2 ([#3067](https://github.com/webtorrent/webtorrent/issues/3067)) ([6498e62](https://github.com/webtorrent/webtorrent/commit/6498e62d755e6c01ca48ae5f3296016a300d08b2))

## [3.0.14](https://github.com/webtorrent/webtorrent/compare/v3.0.13...v3.0.14) (2026-05-28)


Expand Down
2 changes: 1 addition & 1 deletion dist/webtorrent.chromeapp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/webtorrent.chromeapp.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/webtorrent.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/webtorrent.min.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lib/conn-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export default class ConnPool {
// Start uTP
debug('creating utpServer in port %s', this.tcpServer.address().port)
this.utpServer.listen(this.tcpServer.address().port)
this.utpServer.setSendBufferSize(1024 * 1024)
this.utpServer.setRecvBufferSize(1024 * 1024)
} else {
this._onListening()
}
Expand Down
2 changes: 1 addition & 1 deletion lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default class File extends EventEmitter {

get streamURL () {
if (!this._client._server) throw new Error('No server created')
return `${this._client._server.pathname}/${this._torrent.infoHash}/${this.path.split('/').map(encodeURIComponent).join('/')}`
return `${this._client._server.pathname}/${this._torrent.infoHash}/${this.path.split(/[/\\]/).map(encodeURIComponent).join('/')}`
}

streamTo (elem) {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webtorrent",
"description": "Streaming torrent client",
"version": "3.0.14",
"version": "3.0.16",
"author": {
"name": "WebTorrent LLC",
"email": "feross@webtorrent.io",
Expand Down Expand Up @@ -110,10 +110,10 @@
"tap-parser": "^18.3.4",
"tap-spec": "^5.0.0",
"tape": "^5.9.0",
"terser-webpack-plugin": "^5.6.0",
"terser-webpack-plugin": "^5.6.1",
"timers-browserify": "^2.0.12",
"webpack": "^5.107.1",
"webpack-cli": "^7.0.2",
"webpack": "^5.107.2",
"webpack-cli": "^7.0.3",
"webtorrent-fixtures": "1.7.5"
},
"optionalDependencies": {
Expand Down
57 changes: 57 additions & 0 deletions test/node/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import fs from 'fs'
import fixtures from 'webtorrent-fixtures'
import createTorrent from 'create-torrent'
import get from 'simple-get'
import { Readable } from 'streamx'
import test from 'tape'
import WebTorrent from '../../index.js'

Expand Down Expand Up @@ -64,3 +66,58 @@ test('client.createServer: programmatic http server', t => {
})
})
})

test('client.createServer: files with special characters in name', t => {
t.plan(11)

const buf1 = Buffer.from('file one content')
buf1.name = '[test?] file.txt'

const buf2 = Buffer.from('file two content')
buf2.name = 'normal.txt'

createTorrent([buf1, buf2], { name: 'test-torrent' }, (err, torrentBuf) => {
t.error(err, 'created torrent')

const client = new WebTorrent({ tracker: false, dht: false, lsd: false })

client.on('error', err => { t.fail(err) })
client.on('warning', err => { t.fail(err) })

client.add(torrentBuf, torrent => {
t.pass('got "torrent" event')
const server = client.createServer()

server.listen(0, () => {
const port = server.address().port
t.pass(`server is listening on ${port}`)

const host = `http://localhost:${port}`
const path = `webtorrent/${torrent.infoHash}`

torrent.load(Readable.from([buf1, buf2]), err => {
t.error(err, 'loaded seed content')

get.concat(`${host}/${path}/`, (err, res, data) => {
t.error(err, 'got torrent page')
data = data.toString()
t.ok(data.includes('%5Btest%3F%5D%20file.txt'), 'torrent page href has encoded path')
t.ok(data.includes('[test?] file.txt'), 'torrent page shows display name')

get.concat(host + torrent.files[0].streamURL, (err, res, data) => {
t.error(err, `got file via streamURL: ${torrent.files[0].streamURL}`)
t.deepEqual(data, buf1, 'file content matches')

server.close(() => {
t.pass('server closed')
client.destroy(err => {
t.error(err, 'client destroyed')
})
})
})
})
})
})
})
})
})
Loading