@fails-components/webtransport 1.0.10 → 1.0.11

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.
Files changed (47) hide show
  1. package/dist/lib/http2/browser/browser.d.ts.map +1 -1
  2. package/dist/lib/http2/browser/browserparser.d.ts +4 -3
  3. package/dist/lib/http2/browser/browserparser.d.ts.map +1 -1
  4. package/dist/lib/http2/node/capsuleparser.d.ts +3 -2
  5. package/dist/lib/http2/node/capsuleparser.d.ts.map +1 -1
  6. package/dist/lib/http2/node/client.d.ts.map +1 -1
  7. package/dist/lib/http2/node/server.d.ts.map +1 -1
  8. package/dist/lib/http2/node/websocketparser.d.ts +7 -6
  9. package/dist/lib/http2/node/websocketparser.d.ts.map +1 -1
  10. package/dist/lib/http2/parserbase.d.ts +16 -4
  11. package/dist/lib/http2/parserbase.d.ts.map +1 -1
  12. package/dist/lib/http2/parserbasehttp2.d.ts +9 -1
  13. package/dist/lib/http2/parserbasehttp2.d.ts.map +1 -1
  14. package/dist/lib/http2/session.d.ts.map +1 -1
  15. package/dist/lib/index.node.d.ts +1 -1
  16. package/dist/lib/index.node.d.ts.map +1 -1
  17. package/dist/lib/index.types.d.ts +1 -1
  18. package/dist/lib/index.types.d.ts.map +1 -1
  19. package/dist/lib/types.d.ts +9 -2
  20. package/dist/lib/types.d.ts.map +1 -1
  21. package/dist/lib/webtransport.node.d.ts +1 -0
  22. package/dist/lib/webtransport.node.d.ts.map +1 -1
  23. package/lib/http2/browser/browser.js +2 -1
  24. package/lib/http2/browser/browserparser.js +43 -7
  25. package/lib/http2/node/capsuleparser.js +41 -10
  26. package/lib/http2/node/client.js +23 -5
  27. package/lib/http2/node/server.js +53 -16
  28. package/lib/http2/node/websocketparser.js +42 -20
  29. package/lib/http2/parserbase.js +44 -7
  30. package/lib/http2/parserbasehttp2.js +15 -2
  31. package/lib/http2/session.js +1 -5
  32. package/lib/index.node.js +1 -1
  33. package/lib/index.types.js +1 -1
  34. package/lib/types.ts +10 -2
  35. package/lib/webtransport.node.js +10 -1
  36. package/lib/webtransportbase.js +1 -1
  37. package/old_test/test.js +13 -1
  38. package/package.json +3 -2
  39. package/readme.md +4 -1
  40. package/test/bidirectional-streams.spec.js +31 -0
  41. package/test/datagrams.spec.js +12 -0
  42. package/test/fixtures/quiche.browser.js +2 -0
  43. package/test/fixtures/quiche.js +1 -0
  44. package/test/fixtures/server.js +24 -0
  45. package/test/session.spec.js +13 -3
  46. package/test/stream-limits.spec.js +12 -0
  47. package/test/unidirectional-streams.spec.js +12 -0
@@ -5,6 +5,7 @@ import { expect } from './fixtures/chai.js'
5
5
  import { readStream } from './fixtures/read-stream.js'
6
6
  import { readCertHash } from './fixtures/read-cert-hash.js'
7
7
  import { pTimeout } from './fixtures/p-timeout.js'
8
+ import { quicheLoaded } from './fixtures/quiche.js'
8
9
 
9
10
  /**
10
11
  * @template T
@@ -32,6 +33,17 @@ describe('datagrams', function () {
32
33
  // @ts-ignore
33
34
  delete wtOptions.serverCertificateHashes
34
35
 
36
+ // @ts-ignore
37
+ beforeEach(async () => {
38
+ if (
39
+ process.env.USE_HTTP2 !== 'true' &&
40
+ process.env.USE_PONYFILL !== 'true' &&
41
+ process.env.USE_POLYFILL !== 'true'
42
+ ) {
43
+ await quicheLoaded
44
+ }
45
+ })
46
+
35
47
  // @ts-ignore
36
48
  afterEach(async () => {
37
49
  if (client != null) {
@@ -0,0 +1,2 @@
1
+ const quicheLoaded = Promise.resolve()
2
+ export { quicheLoaded }
@@ -0,0 +1 @@
1
+ export { quicheLoaded } from '../../lib/index.node.js'
@@ -110,6 +110,30 @@ export async function createServer() {
110
110
  }
111
111
  },
112
112
 
113
+ // echo server, initiated by local
114
+ async () => {
115
+ for await (const session of getReaderStream(
116
+ server.sessionStream('/bidirectional_server_fin_send')
117
+ )) {
118
+ try {
119
+ // adapted from issue of achingbrain
120
+ const stream = await session.createBidirectionalStream()
121
+
122
+ const writer = stream.writable.getWriter()
123
+
124
+ await writer.ready
125
+
126
+ writer.write(Uint8Array.from([0, 1, 2, 3])).catch((err) => {
127
+ console.info('error writing to stream', err)
128
+ })
129
+
130
+ await writer.close()
131
+ } catch {
132
+ // in some tests the client closes the stream
133
+ }
134
+ }
135
+ },
136
+
113
137
  // echo datagrams, initiated by remote
114
138
  async () => {
115
139
  for await (const session of getReaderStream(
@@ -3,6 +3,7 @@
3
3
  import { readCertHash } from './fixtures/read-cert-hash.js'
4
4
  import WebTransport from './fixtures/webtransport.js'
5
5
  import { expect } from './fixtures/chai.js'
6
+ import { quicheLoaded } from './fixtures/quiche.js'
6
7
 
7
8
  /**
8
9
  * @template T
@@ -38,6 +39,17 @@ describe('session', function () {
38
39
  // @ts-ignore
39
40
  delete wtOptions.serverCertificateHashes
40
41
 
42
+ // @ts-ignore
43
+ beforeEach(async () => {
44
+ if (
45
+ process.env.USE_HTTP2 !== 'true' &&
46
+ process.env.USE_PONYFILL !== 'true' &&
47
+ process.env.USE_POLYFILL !== 'true'
48
+ ) {
49
+ await quicheLoaded
50
+ }
51
+ })
52
+
41
53
  // @ts-ignore
42
54
  afterEach(async () => {
43
55
  if (client != null) {
@@ -68,9 +80,7 @@ describe('session', function () {
68
80
 
69
81
  const result = await client.closed
70
82
  expect(result).to.have.property('closeCode', 7)
71
- if (process.env.USE_HTTP2 !== 'true')
72
- // unsupported for http2
73
- expect(result).to.have.property('reason', 'this is the reason')
83
+ expect(result).to.have.property('reason', 'this is the reason')
74
84
  })
75
85
  if (browser === 'firefox') this.timeout(31000) // really firefox?
76
86
  it('should error when connecting to a server that does not exist', async () => {
@@ -3,6 +3,7 @@
3
3
  import { readCertHash } from './fixtures/read-cert-hash.js'
4
4
  import WebTransport from './fixtures/webtransport.js'
5
5
  import { expect } from './fixtures/chai.js'
6
+ import { quicheLoaded } from './fixtures/quiche.js'
6
7
 
7
8
  /**
8
9
  * @template T
@@ -44,6 +45,17 @@ describe('streamlimits', function () {
44
45
  // @ts-ignore
45
46
  delete wtOptions.serverCertificateHashes
46
47
 
48
+ // @ts-ignore
49
+ beforeEach(async () => {
50
+ if (
51
+ process.env.USE_HTTP2 !== 'true' &&
52
+ process.env.USE_PONYFILL !== 'true' &&
53
+ process.env.USE_POLYFILL !== 'true'
54
+ ) {
55
+ await quicheLoaded
56
+ }
57
+ })
58
+
47
59
  // @ts-ignore
48
60
  afterEach(async () => {
49
61
  if (client != null) {
@@ -8,6 +8,7 @@ import { writeStream } from './fixtures/write-stream.js'
8
8
  import { readCertHash } from './fixtures/read-cert-hash.js'
9
9
  import * as ui8 from 'uint8arrays'
10
10
  import { KNOWN_BYTES, KNOWN_BYTES_LENGTH } from './fixtures/known-bytes.js'
11
+ import { quicheLoaded } from './fixtures/quiche.js'
11
12
 
12
13
  describe('unidirectional streams', function () {
13
14
  /** @type {import('../lib/dom').WebTransport | undefined} */
@@ -29,6 +30,17 @@ describe('unidirectional streams', function () {
29
30
  // @ts-ignore
30
31
  delete wtOptions.serverCertificateHashes
31
32
 
33
+ // @ts-ignore
34
+ beforeEach(async () => {
35
+ if (
36
+ process.env.USE_HTTP2 !== 'true' &&
37
+ process.env.USE_PONYFILL !== 'true' &&
38
+ process.env.USE_POLYFILL !== 'true'
39
+ ) {
40
+ await quicheLoaded
41
+ }
42
+ })
43
+
32
44
  // @ts-ignore
33
45
  afterEach(async () => {
34
46
  if (client != null) {