@fails-components/webtransport 0.3.1 → 1.0.1
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/lib/client.js +81 -40
- package/lib/dom.ts +7 -5
- package/lib/http2/browser/browser.js +168 -0
- package/lib/http2/browser/browserparser.js +248 -0
- package/lib/http2/flowcontroller.js +371 -0
- package/lib/http2/node/capsuleparser.js +291 -0
- package/lib/http2/node/client.js +239 -0
- package/lib/http2/node/index.js +2 -0
- package/lib/http2/node/server.js +499 -0
- package/lib/http2/node/websocketparser.js +829 -0
- package/lib/http2/parserbase.js +139 -0
- package/lib/http2/parserbasehttp2.js +128 -0
- package/lib/http2/session.js +225 -0
- package/lib/http2/stream.js +354 -0
- package/lib/http2/websocketcommon.js +1 -0
- package/lib/{index.js → index.browser.js} +6 -10
- package/lib/index.node.js +27 -0
- package/lib/server.js +252 -69
- package/lib/session.js +31 -68
- package/lib/stream.js +103 -179
- package/lib/types.ts +174 -87
- package/lib/utils.js +2 -1
- package/lib/webstreams.browser.js +6 -0
- package/lib/webstreams.js +7 -0
- package/lib/webtransport.browser.js +284 -0
- package/lib/webtransport.node.js +137 -0
- package/lib/{webtransport.js → webtransportbase.js} +47 -41
- package/old_test/test.js +31 -29
- package/old_test/testsuite.js +1 -1
- package/package.json +18 -17
- package/readme.md +94 -30
- package/test/bidirectional-streams.spec.js +51 -9
- package/test/datagrams.spec.js +8 -2
- package/test/fixtures/known-bytes.js +29 -0
- package/test/fixtures/read-stream.js +1 -1
- package/test/fixtures/reader-value.js +1 -1
- package/test/fixtures/server.js +24 -10
- package/test/fixtures/webtransport.browser.js +20 -2
- package/test/fixtures/webtransport.js +1 -1
- package/test/index.js +33 -6
- package/test/pw-no-https-errors.json +5 -0
- package/test/session.spec.js +71 -52
- package/test/unidirectional-streams.spec.js +20 -4
- package/CMakeLists.txt +0 -991
- package/LICENSE.chromium +0 -27
- package/LICENSE.envoy +0 -207
- package/build.js +0 -313
- package/dist/lib/client.d.ts +0 -78
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/dom.d.ts +0 -87
- package/dist/lib/dom.d.ts.map +0 -1
- package/dist/lib/error.d.ts +0 -8
- package/dist/lib/error.d.ts.map +0 -1
- package/dist/lib/event-loop.d.ts +0 -33
- package/dist/lib/event-loop.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -79
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/native.d.ts +0 -2
- package/dist/lib/native.d.ts.map +0 -1
- package/dist/lib/server.d.ts +0 -92
- package/dist/lib/server.d.ts.map +0 -1
- package/dist/lib/session.d.ts +0 -298
- package/dist/lib/session.d.ts.map +0 -1
- package/dist/lib/stream.d.ts +0 -135
- package/dist/lib/stream.d.ts.map +0 -1
- package/dist/lib/transport.d.ts +0 -34
- package/dist/lib/transport.d.ts.map +0 -1
- package/dist/lib/types.d.ts +0 -212
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -11
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/webtransport.d.ts +0 -47
- package/dist/lib/webtransport.d.ts.map +0 -1
- package/dist/test/bidirectional-streams.spec.d.ts +0 -5
- package/dist/test/bidirectional-streams.spec.d.ts.map +0 -1
- package/dist/test/datagrams.spec.d.ts +0 -5
- package/dist/test/datagrams.spec.d.ts.map +0 -1
- package/dist/test/event-loop.node.d.ts +0 -2
- package/dist/test/event-loop.node.d.ts.map +0 -1
- package/dist/test/fixtures/certificate.d.ts +0 -21
- package/dist/test/fixtures/certificate.d.ts.map +0 -1
- package/dist/test/fixtures/chai.d.ts +0 -2
- package/dist/test/fixtures/chai.d.ts.map +0 -1
- package/dist/test/fixtures/known-bytes.d.ts +0 -6
- package/dist/test/fixtures/known-bytes.d.ts.map +0 -1
- package/dist/test/fixtures/p-timeout.d.ts +0 -8
- package/dist/test/fixtures/p-timeout.d.ts.map +0 -1
- package/dist/test/fixtures/read-cert-hash.d.ts +0 -6
- package/dist/test/fixtures/read-cert-hash.d.ts.map +0 -1
- package/dist/test/fixtures/read-stream.d.ts +0 -19
- package/dist/test/fixtures/read-stream.d.ts.map +0 -1
- package/dist/test/fixtures/reader-value.d.ts +0 -22
- package/dist/test/fixtures/reader-value.d.ts.map +0 -1
- package/dist/test/fixtures/server.d.ts +0 -5
- package/dist/test/fixtures/server.d.ts.map +0 -1
- package/dist/test/fixtures/webtransport.browser.d.ts +0 -3
- package/dist/test/fixtures/webtransport.browser.d.ts.map +0 -1
- package/dist/test/fixtures/webtransport.d.ts +0 -3
- package/dist/test/fixtures/webtransport.d.ts.map +0 -1
- package/dist/test/fixtures/write-stream.d.ts +0 -10
- package/dist/test/fixtures/write-stream.d.ts.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/session.spec.d.ts +0 -5
- package/dist/test/session.spec.d.ts.map +0 -1
- package/dist/test/unidirectional-streams.spec.d.ts +0 -2
- package/dist/test/unidirectional-streams.spec.d.ts.map +0 -1
- package/failslogolicensereadme.txt +0 -4
- package/lib/event-loop.js +0 -88
- package/lib/native.js +0 -28
- package/lib/transport.js +0 -82
- package/platform/icufix/fakedata.cpp +0 -8
- package/platform/quiche/quic/core/io/socket_win.inc +0 -3
- package/platform/quiche_platform_impl/quiche_bug_tracker_impl.h +0 -7
- package/platform/quiche_platform_impl/quiche_client_stats_impl.h +0 -7
- package/platform/quiche_platform_impl/quiche_command_line_flags_impl.h +0 -7
- package/platform/quiche_platform_impl/quiche_containers_impl.h +0 -7
- package/platform/quiche_platform_impl/quiche_event_loop_impl.h +0 -7
- package/platform/quiche_platform_impl/quiche_export_impl.h +0 -6
- package/platform/quiche_platform_impl/quiche_flag_utils_impl.h +0 -11
- package/platform/quiche_platform_impl/quiche_flags_impl.h +0 -8
- package/platform/quiche_platform_impl/quiche_iovec_impl.h +0 -10
- package/platform/quiche_platform_impl/quiche_logging_impl.h +0 -21
- package/platform/quiche_platform_impl/quiche_mem_slice_impl.h +0 -2
- package/platform/quiche_platform_impl/quiche_mutex_impl.h +0 -8
- package/platform/quiche_platform_impl/quiche_prefetch_impl.h +0 -11
- package/platform/quiche_platform_impl/quiche_reference_counted_impl.h +0 -16
- package/platform/quiche_platform_impl/quiche_server_stats_impl.h +0 -7
- package/platform/quiche_platform_impl/quiche_stack_trace_impl.h +0 -12
- package/platform/quiche_platform_impl/quiche_stream_buffer_allocator_impl.h +0 -8
- package/platform/quiche_platform_impl/quiche_testvalue_impl.h +0 -1
- package/platform/quiche_platform_impl/quiche_thread_local_impl.h +0 -6
- package/platform/quiche_platform_impl/quiche_time_utils_impl.h +0 -13
- package/platform/quiche_platform_impl/quiche_udp_socket_platform_impl.h +0 -39
- package/src/http3backendresponse.cc +0 -36
- package/src/http3backendresponse.h +0 -109
- package/src/http3client.cc +0 -1529
- package/src/http3client.h +0 -557
- package/src/http3clientsession.cc +0 -65
- package/src/http3clientsession.h +0 -60
- package/src/http3clientstream.cc +0 -52
- package/src/http3clientstream.h +0 -42
- package/src/http3dispatcher.cc +0 -62
- package/src/http3dispatcher.h +0 -57
- package/src/http3eventloop.cc +0 -1107
- package/src/http3eventloop.h +0 -316
- package/src/http3server.cc +0 -514
- package/src/http3server.h +0 -151
- package/src/http3serverbackend.cc +0 -105
- package/src/http3serverbackend.h +0 -98
- package/src/http3serversession.cc +0 -123
- package/src/http3serversession.h +0 -95
- package/src/http3serverstream.cc +0 -463
- package/src/http3serverstream.h +0 -114
- package/src/http3sessioncache.cc +0 -85
- package/src/http3sessioncache.h +0 -59
- package/src/http3wtsessionvisitor.cc +0 -46
- package/src/http3wtsessionvisitor.h +0 -397
- package/src/http3wtstreamvisitor.cc +0 -155
- package/src/http3wtstreamvisitor.h +0 -404
- package/test/event-loop.node.js +0 -24
- package/tsconfig.json +0 -39
package/test/session.spec.js
CHANGED
|
@@ -10,9 +10,8 @@ import { expect } from './fixtures/chai.js'
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
describe('session', function () {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.timeout(30000)
|
|
13
|
+
let forceReliable = false
|
|
14
|
+
if (process.env.USE_HTTP2 === 'true') forceReliable = true
|
|
16
15
|
|
|
17
16
|
/** @type {import('../lib/dom').WebTransport | undefined} */
|
|
18
17
|
let client
|
|
@@ -32,7 +31,9 @@ describe('session', function () {
|
|
|
32
31
|
algorithm: 'sha-256',
|
|
33
32
|
value: readCertHash(process.env.CERT_HASH)
|
|
34
33
|
}
|
|
35
|
-
]
|
|
34
|
+
],
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
forceReliable
|
|
36
37
|
})
|
|
37
38
|
await client.ready
|
|
38
39
|
|
|
@@ -51,14 +52,18 @@ describe('session', function () {
|
|
|
51
52
|
algorithm: 'sha-256',
|
|
52
53
|
value: readCertHash(process.env.CERT_HASH)
|
|
53
54
|
}
|
|
54
|
-
]
|
|
55
|
+
],
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
forceReliable
|
|
55
58
|
}
|
|
56
59
|
)
|
|
57
60
|
await client.ready
|
|
58
61
|
|
|
59
62
|
const result = await client.closed
|
|
60
63
|
expect(result).to.have.property('closeCode', 7)
|
|
61
|
-
|
|
64
|
+
if (process.env.USE_HTTP2 !== 'true')
|
|
65
|
+
// unsupported for http2
|
|
66
|
+
expect(result).to.have.property('reason', 'this is the reason')
|
|
62
67
|
})
|
|
63
68
|
|
|
64
69
|
it('should error when connecting to a server that does not exist', async () => {
|
|
@@ -70,7 +75,9 @@ describe('session', function () {
|
|
|
70
75
|
}
|
|
71
76
|
],
|
|
72
77
|
quicConnectTimeout: 100,
|
|
73
|
-
webTransportConnectTimeout: 100
|
|
78
|
+
webTransportConnectTimeout: 100,
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
forceReliable
|
|
74
81
|
})
|
|
75
82
|
|
|
76
83
|
const [closedResult, readyResult] = await Promise.all([
|
|
@@ -93,7 +100,9 @@ describe('session', function () {
|
|
|
93
100
|
algorithm: 'sha-256',
|
|
94
101
|
value: readCertHash(process.env.CERT_HASH)
|
|
95
102
|
}
|
|
96
|
-
]
|
|
103
|
+
],
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
forceReliable
|
|
97
106
|
})
|
|
98
107
|
|
|
99
108
|
const [closedResult, readyResult] = await Promise.all([
|
|
@@ -109,51 +118,61 @@ describe('session', function () {
|
|
|
109
118
|
.with.property('message', 'Opening handshake failed.')
|
|
110
119
|
})
|
|
111
120
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
if (
|
|
122
|
+
process.env.USE_POLYFILL !== 'true' &&
|
|
123
|
+
process.env.USE_PONYFILL !== 'true'
|
|
124
|
+
) {
|
|
125
|
+
// deactivated in polyfill case, no test necessary
|
|
126
|
+
it('should error when connecting with a bad certificate', async () => {
|
|
127
|
+
client = new WebTransport(`${process.env.SERVER_URL}/session_close`, {
|
|
128
|
+
serverCertificateHashes: [
|
|
129
|
+
{
|
|
130
|
+
algorithm: 'sha-256',
|
|
131
|
+
value: readCertHash(process.env.CERT_HASH + ':DE:AD:BE:EF')
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
forceReliable
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const [closedResult, readyResult] = await Promise.all([
|
|
139
|
+
client.closed.catch((err) => err),
|
|
140
|
+
client.ready.catch((err) => err)
|
|
141
|
+
])
|
|
142
|
+
|
|
143
|
+
expect(closedResult)
|
|
144
|
+
.to.be.a('WebTransportError')
|
|
145
|
+
.with.property('message', 'Opening handshake failed.')
|
|
146
|
+
expect(readyResult)
|
|
147
|
+
.to.be.a('WebTransportError')
|
|
148
|
+
.with.property('message', 'Opening handshake failed.')
|
|
120
149
|
})
|
|
121
150
|
|
|
122
|
-
|
|
123
|
-
client.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
it('should error when connecting with the wrong certificate', async () => {
|
|
152
|
+
client = new WebTransport(`${process.env.SERVER_URL}/session_close`, {
|
|
153
|
+
serverCertificateHashes: [
|
|
154
|
+
{
|
|
155
|
+
algorithm: 'sha-256',
|
|
156
|
+
value: readCertHash(
|
|
157
|
+
'DE:AD:BE:EF:' + process.env.CERT_HASH?.substring(12)
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
forceReliable
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
const [closedResult, readyResult] = await Promise.all([
|
|
166
|
+
client.closed.catch((err) => err),
|
|
167
|
+
client.ready.catch((err) => err)
|
|
168
|
+
])
|
|
169
|
+
|
|
170
|
+
expect(closedResult)
|
|
171
|
+
.to.be.a('WebTransportError')
|
|
172
|
+
.with.property('message', 'Opening handshake failed.')
|
|
173
|
+
expect(readyResult)
|
|
174
|
+
.to.be.a('WebTransportError')
|
|
175
|
+
.with.property('message', 'Opening handshake failed.')
|
|
145
176
|
})
|
|
146
|
-
|
|
147
|
-
const [closedResult, readyResult] = await Promise.all([
|
|
148
|
-
client.closed.catch((err) => err),
|
|
149
|
-
client.ready.catch((err) => err)
|
|
150
|
-
])
|
|
151
|
-
|
|
152
|
-
expect(closedResult)
|
|
153
|
-
.to.be.a('WebTransportError')
|
|
154
|
-
.with.property('message', 'Opening handshake failed.')
|
|
155
|
-
expect(readyResult)
|
|
156
|
-
.to.be.a('WebTransportError')
|
|
157
|
-
.with.property('message', 'Opening handshake failed.')
|
|
158
|
-
})
|
|
177
|
+
}
|
|
159
178
|
})
|
|
@@ -12,6 +12,8 @@ import { KNOWN_BYTES, KNOWN_BYTES_LENGTH } from './fixtures/known-bytes.js'
|
|
|
12
12
|
describe('unidirectional streams', function () {
|
|
13
13
|
/** @type {import('../lib/dom').WebTransport | undefined} */
|
|
14
14
|
let client
|
|
15
|
+
let forceReliable = false
|
|
16
|
+
if (process.env.USE_HTTP2 === 'true') forceReliable = true
|
|
15
17
|
|
|
16
18
|
// @ts-ignore
|
|
17
19
|
afterEach(async () => {
|
|
@@ -32,7 +34,9 @@ describe('unidirectional streams', function () {
|
|
|
32
34
|
algorithm: 'sha-256',
|
|
33
35
|
value: readCertHash(process.env.CERT_HASH)
|
|
34
36
|
}
|
|
35
|
-
]
|
|
37
|
+
],
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
forceReliable
|
|
36
40
|
}
|
|
37
41
|
)
|
|
38
42
|
await client.ready
|
|
@@ -47,6 +51,7 @@ describe('unidirectional streams', function () {
|
|
|
47
51
|
|
|
48
52
|
// the remote will close the session
|
|
49
53
|
const result = await client.closed
|
|
54
|
+
client = undefined
|
|
50
55
|
|
|
51
56
|
// should receive the default close info
|
|
52
57
|
expect(result).to.have.property('reason', '')
|
|
@@ -63,7 +68,9 @@ describe('unidirectional streams', function () {
|
|
|
63
68
|
algorithm: 'sha-256',
|
|
64
69
|
value: readCertHash(process.env.CERT_HASH)
|
|
65
70
|
}
|
|
66
|
-
]
|
|
71
|
+
],
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
forceReliable
|
|
67
74
|
}
|
|
68
75
|
)
|
|
69
76
|
await client.ready
|
|
@@ -77,7 +84,13 @@ describe('unidirectional streams', function () {
|
|
|
77
84
|
})
|
|
78
85
|
|
|
79
86
|
it('handles fin when paused due to backpressure', async function () {
|
|
80
|
-
|
|
87
|
+
let addpolyfill = 0
|
|
88
|
+
if (
|
|
89
|
+
process.env.USE_POLYFILL === 'true' ||
|
|
90
|
+
process.env.USE_PONYFILL === 'true'
|
|
91
|
+
)
|
|
92
|
+
addpolyfill = 4000
|
|
93
|
+
this.timeout(6000 + addpolyfill)
|
|
81
94
|
client = new WebTransport(
|
|
82
95
|
`${process.env.SERVER_URL}/unidirectional_server_delay_before_read`,
|
|
83
96
|
{
|
|
@@ -86,7 +99,9 @@ describe('unidirectional streams', function () {
|
|
|
86
99
|
algorithm: 'sha-256',
|
|
87
100
|
value: readCertHash(process.env.CERT_HASH)
|
|
88
101
|
}
|
|
89
|
-
]
|
|
102
|
+
],
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
forceReliable
|
|
90
105
|
}
|
|
91
106
|
)
|
|
92
107
|
await client.ready
|
|
@@ -110,6 +125,7 @@ describe('unidirectional streams', function () {
|
|
|
110
125
|
|
|
111
126
|
// the remote will close the session cleanly if everything was ok
|
|
112
127
|
await client.closed
|
|
128
|
+
client = undefined
|
|
113
129
|
|
|
114
130
|
// should receive the default close info, not true on chromium
|
|
115
131
|
// expect(result).to.have.property('reason', '')
|