@fails-components/webtransport 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/lib/client.d.ts +95 -0
- package/dist/main/lib/client.d.ts.map +1 -0
- package/dist/main/lib/dom.d.ts +88 -0
- package/dist/main/lib/dom.d.ts.map +1 -0
- package/dist/main/lib/error.d.ts +8 -0
- package/dist/main/lib/error.d.ts.map +1 -0
- package/dist/main/lib/http2/browser/browser.d.ts +30 -0
- package/dist/main/lib/http2/browser/browser.d.ts.map +1 -0
- package/dist/main/lib/http2/browser/browserparser.d.ts +41 -0
- package/dist/main/lib/http2/browser/browserparser.d.ts.map +1 -0
- package/dist/main/lib/http2/flowcontroller.d.ts +70 -0
- package/dist/main/lib/http2/flowcontroller.d.ts.map +1 -0
- package/dist/main/lib/http2/node/capsuleparser.d.ts +24 -0
- package/dist/main/lib/http2/node/capsuleparser.d.ts.map +1 -0
- package/dist/main/lib/http2/node/client.d.ts +29 -0
- package/dist/main/lib/http2/node/client.d.ts.map +1 -0
- package/dist/main/lib/http2/node/index.d.ts +3 -0
- package/dist/main/lib/http2/node/index.d.ts.map +1 -0
- package/dist/main/lib/http2/node/server.d.ts +57 -0
- package/dist/main/lib/http2/node/server.d.ts.map +1 -0
- package/dist/main/lib/http2/node/websocketparser.d.ts +86 -0
- package/dist/main/lib/http2/node/websocketparser.d.ts.map +1 -0
- package/dist/main/lib/http2/parserbase.d.ts +84 -0
- package/dist/main/lib/http2/parserbase.d.ts.map +1 -0
- package/dist/main/lib/http2/parserbasehttp2.d.ts +31 -0
- package/dist/main/lib/http2/parserbasehttp2.d.ts.map +1 -0
- package/dist/main/lib/http2/session.d.ts +71 -0
- package/dist/main/lib/http2/session.d.ts.map +1 -0
- package/dist/main/lib/http2/stream.d.ts +112 -0
- package/dist/main/lib/http2/stream.d.ts.map +1 -0
- package/dist/main/lib/http2/websocketcommon.d.ts +2 -0
- package/dist/main/lib/http2/websocketcommon.d.ts.map +1 -0
- package/dist/main/lib/index.browser.d.ts +58 -0
- package/dist/main/lib/index.browser.d.ts.map +1 -0
- package/dist/main/lib/index.node.d.ts +59 -0
- package/dist/main/lib/index.node.d.ts.map +1 -0
- package/dist/main/lib/server.d.ts +102 -0
- package/dist/main/lib/server.d.ts.map +1 -0
- package/dist/main/lib/session.d.ts +296 -0
- package/dist/main/lib/session.d.ts.map +1 -0
- package/dist/main/lib/stream.d.ts +132 -0
- package/dist/main/lib/stream.d.ts.map +1 -0
- package/dist/main/lib/types.d.ts +277 -0
- package/dist/main/lib/types.d.ts.map +1 -0
- package/dist/main/lib/utils.d.ts +11 -0
- package/dist/main/lib/utils.d.ts.map +1 -0
- package/dist/main/lib/webstreams.browser.d.ts +5 -0
- package/dist/main/lib/webstreams.browser.d.ts.map +1 -0
- package/dist/main/lib/webstreams.d.ts +10 -0
- package/dist/main/lib/webstreams.d.ts.map +1 -0
- package/dist/main/lib/webtransport.browser.d.ts +60 -0
- package/dist/main/lib/webtransport.browser.d.ts.map +1 -0
- package/dist/main/lib/webtransport.node.d.ts +26 -0
- package/dist/main/lib/webtransport.node.d.ts.map +1 -0
- package/dist/main/lib/webtransportbase.d.ts +70 -0
- package/dist/main/lib/webtransportbase.d.ts.map +1 -0
- package/dist/main/test/bidirectional-streams.spec.d.ts +5 -0
- package/dist/main/test/bidirectional-streams.spec.d.ts.map +1 -0
- package/dist/main/test/datagrams.spec.d.ts +5 -0
- package/dist/main/test/datagrams.spec.d.ts.map +1 -0
- package/dist/main/test/fixtures/certificate.d.ts +21 -0
- package/dist/main/test/fixtures/certificate.d.ts.map +1 -0
- package/dist/main/test/fixtures/chai.d.ts +2 -0
- package/dist/main/test/fixtures/chai.d.ts.map +1 -0
- package/dist/main/test/fixtures/known-bytes.d.ts +8 -0
- package/dist/main/test/fixtures/known-bytes.d.ts.map +1 -0
- package/dist/main/test/fixtures/p-timeout.d.ts +8 -0
- package/dist/main/test/fixtures/p-timeout.d.ts.map +1 -0
- package/dist/main/test/fixtures/read-cert-hash.d.ts +6 -0
- package/dist/main/test/fixtures/read-cert-hash.d.ts.map +1 -0
- package/dist/main/test/fixtures/read-stream.d.ts +18 -0
- package/dist/main/test/fixtures/read-stream.d.ts.map +1 -0
- package/dist/main/test/fixtures/reader-value.d.ts +21 -0
- package/dist/main/test/fixtures/reader-value.d.ts.map +1 -0
- package/dist/main/test/fixtures/server.d.ts +5 -0
- package/dist/main/test/fixtures/server.d.ts.map +1 -0
- package/dist/main/test/fixtures/webtransport.browser.d.ts +4 -0
- package/dist/main/test/fixtures/webtransport.browser.d.ts.map +1 -0
- package/dist/main/test/fixtures/webtransport.d.ts +3 -0
- package/dist/main/test/fixtures/webtransport.d.ts.map +1 -0
- package/dist/main/test/fixtures/write-stream.d.ts +10 -0
- package/dist/main/test/fixtures/write-stream.d.ts.map +1 -0
- package/dist/main/test/index.d.ts +2 -0
- package/dist/main/test/index.d.ts.map +1 -0
- package/dist/main/test/session.spec.d.ts +5 -0
- package/dist/main/test/session.spec.d.ts.map +1 -0
- package/dist/main/test/unidirectional-streams.spec.d.ts +2 -0
- package/dist/main/test/unidirectional-streams.spec.d.ts.map +1 -0
- package/dist/main/tsconfig.tsbuildinfo +1 -0
- package/dist/transports/http3-quiche/lib/clientsocket.d.ts +19 -0
- package/dist/transports/http3-quiche/lib/clientsocket.d.ts.map +1 -0
- package/dist/transports/http3-quiche/lib/index.d.ts +11 -0
- package/dist/transports/http3-quiche/lib/index.d.ts.map +1 -0
- package/dist/transports/http3-quiche/lib/serversocket.d.ts +12 -0
- package/dist/transports/http3-quiche/lib/serversocket.d.ts.map +1 -0
- package/dist/transports/http3-quiche/lib/socket.d.ts +19 -0
- package/dist/transports/http3-quiche/lib/socket.d.ts.map +1 -0
- package/dist/transports/http3-quiche/lib/types.d.ts +21 -0
- package/dist/transports/http3-quiche/lib/types.d.ts.map +1 -0
- package/dist/transports/http3-quiche/lib/utils.d.ts +6 -0
- package/dist/transports/http3-quiche/lib/utils.d.ts.map +1 -0
- package/lib/http2/browser/browser.js +52 -0
- package/lib/http2/node/capsuleparser.js +8 -0
- package/lib/http2/node/server.js +10 -4
- package/lib/http2/node/websocketparser.js +17 -3
- package/lib/http2/parserbase.js +7 -0
- package/lib/http2/session.js +1 -5
- package/lib/webtransport.browser.js +8 -2
- package/package.json +5 -3
- package/test/bidirectional-streams.spec.js +17 -31
- package/test/datagrams.spec.js +17 -20
- package/test/index.js +13 -4
- package/test/session.spec.js +43 -48
- package/test/unidirectional-streams.spec.js +17 -30
- package/tsconfig.json +15 -0
|
@@ -18,13 +18,26 @@ import {
|
|
|
18
18
|
* @template T
|
|
19
19
|
* @typedef {import('../lib/types').Deferred<T>} Deferred<T>
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
21
|
describe('bidirectional streams', function () {
|
|
23
22
|
let forceReliable = false
|
|
24
23
|
if (process.env.USE_HTTP2 === 'true') forceReliable = true
|
|
25
24
|
/** @type {import('../lib/dom').WebTransport | undefined} */
|
|
26
25
|
let client
|
|
27
26
|
|
|
27
|
+
const wtOptions = {
|
|
28
|
+
serverCertificateHashes: [
|
|
29
|
+
{
|
|
30
|
+
algorithm: 'sha-256',
|
|
31
|
+
value: readCertHash(process.env.CERT_HASH)
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
forceReliable
|
|
36
|
+
}
|
|
37
|
+
if (process.env.NO_CERT_HASHES === 'true')
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
delete wtOptions.serverCertificateHashes
|
|
40
|
+
|
|
28
41
|
// @ts-ignore
|
|
29
42
|
afterEach(async () => {
|
|
30
43
|
if (client != null) {
|
|
@@ -37,16 +50,7 @@ describe('bidirectional streams', function () {
|
|
|
37
50
|
// client context - connects to the server, opens a bidi stream, sends some data and reads the response
|
|
38
51
|
client = new WebTransport(
|
|
39
52
|
`${process.env.SERVER_URL}/bidirectional_client_initiated_echo`,
|
|
40
|
-
|
|
41
|
-
serverCertificateHashes: [
|
|
42
|
-
{
|
|
43
|
-
algorithm: 'sha-256',
|
|
44
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
forceReliable
|
|
49
|
-
}
|
|
53
|
+
wtOptions
|
|
50
54
|
)
|
|
51
55
|
await client.ready
|
|
52
56
|
|
|
@@ -64,16 +68,7 @@ describe('bidirectional streams', function () {
|
|
|
64
68
|
// client context - connects to the server, opens a bidi stream, sends some data and reads the response
|
|
65
69
|
client = new WebTransport(
|
|
66
70
|
`${process.env.SERVER_URL}/bidirectional_client_initiated_echo`,
|
|
67
|
-
|
|
68
|
-
serverCertificateHashes: [
|
|
69
|
-
{
|
|
70
|
-
algorithm: 'sha-256',
|
|
71
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
forceReliable
|
|
76
|
-
}
|
|
71
|
+
wtOptions
|
|
77
72
|
)
|
|
78
73
|
await client.ready
|
|
79
74
|
|
|
@@ -101,16 +96,7 @@ describe('bidirectional streams', function () {
|
|
|
101
96
|
// client context - waits for the server to open a bidi stream then pipes it back to them
|
|
102
97
|
client = new WebTransport(
|
|
103
98
|
`${process.env.SERVER_URL}/bidirectional_server_initiated_echo`,
|
|
104
|
-
|
|
105
|
-
serverCertificateHashes: [
|
|
106
|
-
{
|
|
107
|
-
algorithm: 'sha-256',
|
|
108
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
forceReliable
|
|
113
|
-
}
|
|
99
|
+
wtOptions
|
|
114
100
|
)
|
|
115
101
|
await client.ready
|
|
116
102
|
|
package/test/datagrams.spec.js
CHANGED
|
@@ -17,6 +17,21 @@ describe('datagrams', function () {
|
|
|
17
17
|
let forceReliable = false
|
|
18
18
|
if (process.env.USE_HTTP2 === 'true') forceReliable = true
|
|
19
19
|
|
|
20
|
+
const wtOptions = {
|
|
21
|
+
serverCertificateHashes: [
|
|
22
|
+
{
|
|
23
|
+
algorithm: 'sha-256',
|
|
24
|
+
value: readCertHash(process.env.CERT_HASH)
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
forceReliable
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (process.env.NO_CERT_HASHES === 'true')
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
delete wtOptions.serverCertificateHashes
|
|
34
|
+
|
|
20
35
|
// @ts-ignore
|
|
21
36
|
afterEach(async () => {
|
|
22
37
|
if (client != null) {
|
|
@@ -28,16 +43,7 @@ describe('datagrams', function () {
|
|
|
28
43
|
// client context - connects to the server, sends some datagrams and reads the response
|
|
29
44
|
client = new WebTransport(
|
|
30
45
|
`${process.env.SERVER_URL}/datagrams_client_send`,
|
|
31
|
-
|
|
32
|
-
serverCertificateHashes: [
|
|
33
|
-
{
|
|
34
|
-
algorithm: 'sha-256',
|
|
35
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
forceReliable
|
|
40
|
-
}
|
|
46
|
+
wtOptions
|
|
41
47
|
)
|
|
42
48
|
await client.ready
|
|
43
49
|
|
|
@@ -71,16 +77,7 @@ describe('datagrams', function () {
|
|
|
71
77
|
// client context - pipes the server's datagrams back to them
|
|
72
78
|
client = new WebTransport(
|
|
73
79
|
`${process.env.SERVER_URL}/datagrams_server_send`,
|
|
74
|
-
|
|
75
|
-
serverCertificateHashes: [
|
|
76
|
-
{
|
|
77
|
-
algorithm: 'sha-256',
|
|
78
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
forceReliable
|
|
83
|
-
}
|
|
80
|
+
wtOptions
|
|
84
81
|
)
|
|
85
82
|
await client.ready
|
|
86
83
|
|
package/test/index.js
CHANGED
|
@@ -70,12 +70,18 @@ async function runTests(certificate, serverAddress) {
|
|
|
70
70
|
})
|
|
71
71
|
|
|
72
72
|
await tests
|
|
73
|
-
} else if (env === 'chromium') {
|
|
73
|
+
} else if (env === 'chromium' || env === 'firefox') {
|
|
74
74
|
command = 'playwright-test'
|
|
75
75
|
const otheropts = []
|
|
76
|
-
if (polyfill || ponyfill)
|
|
76
|
+
if (polyfill || ponyfill || env === 'firefox')
|
|
77
77
|
otheropts.push('--config', './test/pw-no-https-errors.json')
|
|
78
|
-
args = [
|
|
78
|
+
args = [
|
|
79
|
+
'./test/*.spec.js',
|
|
80
|
+
'-b',
|
|
81
|
+
env /* the browser */,
|
|
82
|
+
...otheropts,
|
|
83
|
+
...process.argv.slice(slice)
|
|
84
|
+
]
|
|
79
85
|
const tests = execa(command, args, {
|
|
80
86
|
env: {
|
|
81
87
|
DEBUG_COLORS: process.env.CI ? '' : 'true',
|
|
@@ -83,7 +89,10 @@ async function runTests(certificate, serverAddress) {
|
|
|
83
89
|
SERVER_URL: serverAddress,
|
|
84
90
|
USE_HTTP2: http2 ? 'true' : 'false',
|
|
85
91
|
USE_POLYFILL: polyfill ? 'true' : 'false',
|
|
86
|
-
USE_PONYFILL: ponyfill ? 'true' : 'false'
|
|
92
|
+
USE_PONYFILL: ponyfill ? 'true' : 'false',
|
|
93
|
+
NO_CERT_HASHES:
|
|
94
|
+
env === 'firefox' && !ponyfill && !polyfill ? 'true' : 'false',
|
|
95
|
+
BROWSER: env
|
|
87
96
|
},
|
|
88
97
|
stdio: ['inherit', 'inherit', 'inherit']
|
|
89
98
|
})
|
package/test/session.spec.js
CHANGED
|
@@ -12,10 +12,32 @@ import { expect } from './fixtures/chai.js'
|
|
|
12
12
|
describe('session', function () {
|
|
13
13
|
let forceReliable = false
|
|
14
14
|
if (process.env.USE_HTTP2 === 'true') forceReliable = true
|
|
15
|
+
const browser = process.env.BROWSER
|
|
16
|
+
const handshakemess =
|
|
17
|
+
browser !== 'firefox' ||
|
|
18
|
+
process.env.USE_POLYFILL === 'true' ||
|
|
19
|
+
process.env.USE_PONYFILL === 'true'
|
|
20
|
+
? 'Opening handshake failed.'
|
|
21
|
+
: 'WebTransport connection rejected'
|
|
15
22
|
|
|
16
23
|
/** @type {import('../lib/dom').WebTransport | undefined} */
|
|
17
24
|
let client
|
|
18
25
|
|
|
26
|
+
const wtOptions = {
|
|
27
|
+
serverCertificateHashes: [
|
|
28
|
+
{
|
|
29
|
+
algorithm: 'sha-256',
|
|
30
|
+
value: readCertHash(process.env.CERT_HASH)
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
forceReliable
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (process.env.NO_CERT_HASHES === 'true')
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
delete wtOptions.serverCertificateHashes
|
|
40
|
+
|
|
19
41
|
// @ts-ignore
|
|
20
42
|
afterEach(async () => {
|
|
21
43
|
if (client != null) {
|
|
@@ -25,16 +47,10 @@ describe('session', function () {
|
|
|
25
47
|
})
|
|
26
48
|
|
|
27
49
|
it('should detect session closure', async () => {
|
|
28
|
-
client = new WebTransport(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
forceReliable
|
|
37
|
-
})
|
|
50
|
+
client = new WebTransport(
|
|
51
|
+
`${process.env.SERVER_URL}/session_close`,
|
|
52
|
+
wtOptions
|
|
53
|
+
)
|
|
38
54
|
await client.ready
|
|
39
55
|
|
|
40
56
|
const result = await client.closed
|
|
@@ -46,16 +62,7 @@ describe('session', function () {
|
|
|
46
62
|
// client context - connects to the server, sends some datagrams and reads the response
|
|
47
63
|
client = new WebTransport(
|
|
48
64
|
`${process.env.SERVER_URL}/session_close_with_reason`,
|
|
49
|
-
|
|
50
|
-
serverCertificateHashes: [
|
|
51
|
-
{
|
|
52
|
-
algorithm: 'sha-256',
|
|
53
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
forceReliable
|
|
58
|
-
}
|
|
65
|
+
wtOptions
|
|
59
66
|
)
|
|
60
67
|
await client.ready
|
|
61
68
|
|
|
@@ -65,19 +72,12 @@ describe('session', function () {
|
|
|
65
72
|
// unsupported for http2
|
|
66
73
|
expect(result).to.have.property('reason', 'this is the reason')
|
|
67
74
|
})
|
|
68
|
-
|
|
75
|
+
if (browser === 'firefox') this.timeout(31000) // really firefox?
|
|
69
76
|
it('should error when connecting to a server that does not exist', async () => {
|
|
70
77
|
client = new WebTransport(`https://127.0.0.1:39821`, {
|
|
71
|
-
serverCertificateHashes: [
|
|
72
|
-
{
|
|
73
|
-
algorithm: 'sha-256',
|
|
74
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
75
|
-
}
|
|
76
|
-
],
|
|
77
78
|
quicConnectTimeout: 100,
|
|
78
79
|
webTransportConnectTimeout: 100,
|
|
79
|
-
|
|
80
|
-
forceReliable
|
|
80
|
+
...wtOptions
|
|
81
81
|
})
|
|
82
82
|
|
|
83
83
|
const [closedResult, readyResult] = await Promise.all([
|
|
@@ -87,23 +87,17 @@ describe('session', function () {
|
|
|
87
87
|
|
|
88
88
|
expect(closedResult)
|
|
89
89
|
.to.be.a('WebTransportError')
|
|
90
|
-
.with.property('message',
|
|
90
|
+
.with.property('message', handshakemess)
|
|
91
91
|
expect(readyResult)
|
|
92
92
|
.to.be.a('WebTransportError')
|
|
93
|
-
.with.property('message',
|
|
93
|
+
.with.property('message', handshakemess)
|
|
94
94
|
})
|
|
95
95
|
|
|
96
96
|
it('should error when connecting to a path that does not exist', async () => {
|
|
97
|
-
client = new WebTransport(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
forceReliable
|
|
106
|
-
})
|
|
97
|
+
client = new WebTransport(
|
|
98
|
+
`${process.env.SERVER_URL}/non_existant`,
|
|
99
|
+
wtOptions
|
|
100
|
+
)
|
|
107
101
|
|
|
108
102
|
const [closedResult, readyResult] = await Promise.all([
|
|
109
103
|
client.closed.catch((err) => err),
|
|
@@ -112,15 +106,16 @@ describe('session', function () {
|
|
|
112
106
|
|
|
113
107
|
expect(closedResult)
|
|
114
108
|
.to.be.a('WebTransportError')
|
|
115
|
-
.with.property('message',
|
|
109
|
+
.with.property('message', handshakemess)
|
|
116
110
|
expect(readyResult)
|
|
117
111
|
.to.be.a('WebTransportError')
|
|
118
|
-
.with.property('message',
|
|
112
|
+
.with.property('message', handshakemess)
|
|
119
113
|
})
|
|
120
114
|
|
|
121
115
|
if (
|
|
122
116
|
process.env.USE_POLYFILL !== 'true' &&
|
|
123
|
-
process.env.USE_PONYFILL !== 'true'
|
|
117
|
+
process.env.USE_PONYFILL !== 'true' &&
|
|
118
|
+
wtOptions.serverCertificateHashes
|
|
124
119
|
) {
|
|
125
120
|
// deactivated in polyfill case, no test necessary
|
|
126
121
|
it('should error when connecting with a bad certificate', async () => {
|
|
@@ -142,10 +137,10 @@ describe('session', function () {
|
|
|
142
137
|
|
|
143
138
|
expect(closedResult)
|
|
144
139
|
.to.be.a('WebTransportError')
|
|
145
|
-
.with.property('message',
|
|
140
|
+
.with.property('message', handshakemess)
|
|
146
141
|
expect(readyResult)
|
|
147
142
|
.to.be.a('WebTransportError')
|
|
148
|
-
.with.property('message',
|
|
143
|
+
.with.property('message', handshakemess)
|
|
149
144
|
})
|
|
150
145
|
|
|
151
146
|
it('should error when connecting with the wrong certificate', async () => {
|
|
@@ -169,10 +164,10 @@ describe('session', function () {
|
|
|
169
164
|
|
|
170
165
|
expect(closedResult)
|
|
171
166
|
.to.be.a('WebTransportError')
|
|
172
|
-
.with.property('message',
|
|
167
|
+
.with.property('message', handshakemess)
|
|
173
168
|
expect(readyResult)
|
|
174
169
|
.to.be.a('WebTransportError')
|
|
175
|
-
.with.property('message',
|
|
170
|
+
.with.property('message', handshakemess)
|
|
176
171
|
})
|
|
177
172
|
}
|
|
178
173
|
})
|
|
@@ -15,6 +15,20 @@ describe('unidirectional streams', function () {
|
|
|
15
15
|
let forceReliable = false
|
|
16
16
|
if (process.env.USE_HTTP2 === 'true') forceReliable = true
|
|
17
17
|
|
|
18
|
+
const wtOptions = {
|
|
19
|
+
serverCertificateHashes: [
|
|
20
|
+
{
|
|
21
|
+
algorithm: 'sha-256',
|
|
22
|
+
value: readCertHash(process.env.CERT_HASH)
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
forceReliable
|
|
27
|
+
}
|
|
28
|
+
if (process.env.NO_CERT_HASHES === 'true')
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
delete wtOptions.serverCertificateHashes
|
|
31
|
+
|
|
18
32
|
// @ts-ignore
|
|
19
33
|
afterEach(async () => {
|
|
20
34
|
if (client != null) {
|
|
@@ -28,16 +42,7 @@ describe('unidirectional streams', function () {
|
|
|
28
42
|
try {
|
|
29
43
|
client = new WebTransport(
|
|
30
44
|
`${process.env.SERVER_URL}/unidirectional_client_send`,
|
|
31
|
-
|
|
32
|
-
serverCertificateHashes: [
|
|
33
|
-
{
|
|
34
|
-
algorithm: 'sha-256',
|
|
35
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
forceReliable
|
|
40
|
-
}
|
|
45
|
+
wtOptions
|
|
41
46
|
)
|
|
42
47
|
await client.ready
|
|
43
48
|
} catch (error) {
|
|
@@ -62,16 +67,7 @@ describe('unidirectional streams', function () {
|
|
|
62
67
|
// client context - waits for the server to open a bidi stream then pipes it back to them
|
|
63
68
|
client = new WebTransport(
|
|
64
69
|
`${process.env.SERVER_URL}/unidirectional_server_send`,
|
|
65
|
-
|
|
66
|
-
serverCertificateHashes: [
|
|
67
|
-
{
|
|
68
|
-
algorithm: 'sha-256',
|
|
69
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
forceReliable
|
|
74
|
-
}
|
|
70
|
+
wtOptions
|
|
75
71
|
)
|
|
76
72
|
await client.ready
|
|
77
73
|
|
|
@@ -93,16 +89,7 @@ describe('unidirectional streams', function () {
|
|
|
93
89
|
this.timeout(6000 + addpolyfill)
|
|
94
90
|
client = new WebTransport(
|
|
95
91
|
`${process.env.SERVER_URL}/unidirectional_server_delay_before_read`,
|
|
96
|
-
|
|
97
|
-
serverCertificateHashes: [
|
|
98
|
-
{
|
|
99
|
-
algorithm: 'sha-256',
|
|
100
|
-
value: readCertHash(process.env.CERT_HASH)
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
forceReliable
|
|
105
|
-
}
|
|
92
|
+
wtOptions
|
|
106
93
|
)
|
|
107
94
|
await client.ready
|
|
108
95
|
|
package/tsconfig.json
ADDED