@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.
Files changed (162) hide show
  1. package/lib/client.js +81 -40
  2. package/lib/dom.ts +7 -5
  3. package/lib/http2/browser/browser.js +168 -0
  4. package/lib/http2/browser/browserparser.js +248 -0
  5. package/lib/http2/flowcontroller.js +371 -0
  6. package/lib/http2/node/capsuleparser.js +291 -0
  7. package/lib/http2/node/client.js +239 -0
  8. package/lib/http2/node/index.js +2 -0
  9. package/lib/http2/node/server.js +499 -0
  10. package/lib/http2/node/websocketparser.js +829 -0
  11. package/lib/http2/parserbase.js +139 -0
  12. package/lib/http2/parserbasehttp2.js +128 -0
  13. package/lib/http2/session.js +225 -0
  14. package/lib/http2/stream.js +354 -0
  15. package/lib/http2/websocketcommon.js +1 -0
  16. package/lib/{index.js → index.browser.js} +6 -10
  17. package/lib/index.node.js +27 -0
  18. package/lib/server.js +252 -69
  19. package/lib/session.js +31 -68
  20. package/lib/stream.js +103 -179
  21. package/lib/types.ts +174 -87
  22. package/lib/utils.js +2 -1
  23. package/lib/webstreams.browser.js +6 -0
  24. package/lib/webstreams.js +7 -0
  25. package/lib/webtransport.browser.js +284 -0
  26. package/lib/webtransport.node.js +137 -0
  27. package/lib/{webtransport.js → webtransportbase.js} +47 -41
  28. package/old_test/test.js +31 -29
  29. package/old_test/testsuite.js +1 -1
  30. package/package.json +18 -17
  31. package/readme.md +94 -30
  32. package/test/bidirectional-streams.spec.js +51 -9
  33. package/test/datagrams.spec.js +8 -2
  34. package/test/fixtures/known-bytes.js +29 -0
  35. package/test/fixtures/read-stream.js +1 -1
  36. package/test/fixtures/reader-value.js +1 -1
  37. package/test/fixtures/server.js +24 -10
  38. package/test/fixtures/webtransport.browser.js +20 -2
  39. package/test/fixtures/webtransport.js +1 -1
  40. package/test/index.js +33 -6
  41. package/test/pw-no-https-errors.json +5 -0
  42. package/test/session.spec.js +71 -52
  43. package/test/unidirectional-streams.spec.js +20 -4
  44. package/CMakeLists.txt +0 -991
  45. package/LICENSE.chromium +0 -27
  46. package/LICENSE.envoy +0 -207
  47. package/build.js +0 -313
  48. package/dist/lib/client.d.ts +0 -78
  49. package/dist/lib/client.d.ts.map +0 -1
  50. package/dist/lib/dom.d.ts +0 -87
  51. package/dist/lib/dom.d.ts.map +0 -1
  52. package/dist/lib/error.d.ts +0 -8
  53. package/dist/lib/error.d.ts.map +0 -1
  54. package/dist/lib/event-loop.d.ts +0 -33
  55. package/dist/lib/event-loop.d.ts.map +0 -1
  56. package/dist/lib/index.d.ts +0 -79
  57. package/dist/lib/index.d.ts.map +0 -1
  58. package/dist/lib/native.d.ts +0 -2
  59. package/dist/lib/native.d.ts.map +0 -1
  60. package/dist/lib/server.d.ts +0 -92
  61. package/dist/lib/server.d.ts.map +0 -1
  62. package/dist/lib/session.d.ts +0 -298
  63. package/dist/lib/session.d.ts.map +0 -1
  64. package/dist/lib/stream.d.ts +0 -135
  65. package/dist/lib/stream.d.ts.map +0 -1
  66. package/dist/lib/transport.d.ts +0 -34
  67. package/dist/lib/transport.d.ts.map +0 -1
  68. package/dist/lib/types.d.ts +0 -212
  69. package/dist/lib/types.d.ts.map +0 -1
  70. package/dist/lib/utils.d.ts +0 -11
  71. package/dist/lib/utils.d.ts.map +0 -1
  72. package/dist/lib/webtransport.d.ts +0 -47
  73. package/dist/lib/webtransport.d.ts.map +0 -1
  74. package/dist/test/bidirectional-streams.spec.d.ts +0 -5
  75. package/dist/test/bidirectional-streams.spec.d.ts.map +0 -1
  76. package/dist/test/datagrams.spec.d.ts +0 -5
  77. package/dist/test/datagrams.spec.d.ts.map +0 -1
  78. package/dist/test/event-loop.node.d.ts +0 -2
  79. package/dist/test/event-loop.node.d.ts.map +0 -1
  80. package/dist/test/fixtures/certificate.d.ts +0 -21
  81. package/dist/test/fixtures/certificate.d.ts.map +0 -1
  82. package/dist/test/fixtures/chai.d.ts +0 -2
  83. package/dist/test/fixtures/chai.d.ts.map +0 -1
  84. package/dist/test/fixtures/known-bytes.d.ts +0 -6
  85. package/dist/test/fixtures/known-bytes.d.ts.map +0 -1
  86. package/dist/test/fixtures/p-timeout.d.ts +0 -8
  87. package/dist/test/fixtures/p-timeout.d.ts.map +0 -1
  88. package/dist/test/fixtures/read-cert-hash.d.ts +0 -6
  89. package/dist/test/fixtures/read-cert-hash.d.ts.map +0 -1
  90. package/dist/test/fixtures/read-stream.d.ts +0 -19
  91. package/dist/test/fixtures/read-stream.d.ts.map +0 -1
  92. package/dist/test/fixtures/reader-value.d.ts +0 -22
  93. package/dist/test/fixtures/reader-value.d.ts.map +0 -1
  94. package/dist/test/fixtures/server.d.ts +0 -5
  95. package/dist/test/fixtures/server.d.ts.map +0 -1
  96. package/dist/test/fixtures/webtransport.browser.d.ts +0 -3
  97. package/dist/test/fixtures/webtransport.browser.d.ts.map +0 -1
  98. package/dist/test/fixtures/webtransport.d.ts +0 -3
  99. package/dist/test/fixtures/webtransport.d.ts.map +0 -1
  100. package/dist/test/fixtures/write-stream.d.ts +0 -10
  101. package/dist/test/fixtures/write-stream.d.ts.map +0 -1
  102. package/dist/test/index.d.ts +0 -2
  103. package/dist/test/index.d.ts.map +0 -1
  104. package/dist/test/session.spec.d.ts +0 -5
  105. package/dist/test/session.spec.d.ts.map +0 -1
  106. package/dist/test/unidirectional-streams.spec.d.ts +0 -2
  107. package/dist/test/unidirectional-streams.spec.d.ts.map +0 -1
  108. package/failslogolicensereadme.txt +0 -4
  109. package/lib/event-loop.js +0 -88
  110. package/lib/native.js +0 -28
  111. package/lib/transport.js +0 -82
  112. package/platform/icufix/fakedata.cpp +0 -8
  113. package/platform/quiche/quic/core/io/socket_win.inc +0 -3
  114. package/platform/quiche_platform_impl/quiche_bug_tracker_impl.h +0 -7
  115. package/platform/quiche_platform_impl/quiche_client_stats_impl.h +0 -7
  116. package/platform/quiche_platform_impl/quiche_command_line_flags_impl.h +0 -7
  117. package/platform/quiche_platform_impl/quiche_containers_impl.h +0 -7
  118. package/platform/quiche_platform_impl/quiche_event_loop_impl.h +0 -7
  119. package/platform/quiche_platform_impl/quiche_export_impl.h +0 -6
  120. package/platform/quiche_platform_impl/quiche_flag_utils_impl.h +0 -11
  121. package/platform/quiche_platform_impl/quiche_flags_impl.h +0 -8
  122. package/platform/quiche_platform_impl/quiche_iovec_impl.h +0 -10
  123. package/platform/quiche_platform_impl/quiche_logging_impl.h +0 -21
  124. package/platform/quiche_platform_impl/quiche_mem_slice_impl.h +0 -2
  125. package/platform/quiche_platform_impl/quiche_mutex_impl.h +0 -8
  126. package/platform/quiche_platform_impl/quiche_prefetch_impl.h +0 -11
  127. package/platform/quiche_platform_impl/quiche_reference_counted_impl.h +0 -16
  128. package/platform/quiche_platform_impl/quiche_server_stats_impl.h +0 -7
  129. package/platform/quiche_platform_impl/quiche_stack_trace_impl.h +0 -12
  130. package/platform/quiche_platform_impl/quiche_stream_buffer_allocator_impl.h +0 -8
  131. package/platform/quiche_platform_impl/quiche_testvalue_impl.h +0 -1
  132. package/platform/quiche_platform_impl/quiche_thread_local_impl.h +0 -6
  133. package/platform/quiche_platform_impl/quiche_time_utils_impl.h +0 -13
  134. package/platform/quiche_platform_impl/quiche_udp_socket_platform_impl.h +0 -39
  135. package/src/http3backendresponse.cc +0 -36
  136. package/src/http3backendresponse.h +0 -109
  137. package/src/http3client.cc +0 -1529
  138. package/src/http3client.h +0 -557
  139. package/src/http3clientsession.cc +0 -65
  140. package/src/http3clientsession.h +0 -60
  141. package/src/http3clientstream.cc +0 -52
  142. package/src/http3clientstream.h +0 -42
  143. package/src/http3dispatcher.cc +0 -62
  144. package/src/http3dispatcher.h +0 -57
  145. package/src/http3eventloop.cc +0 -1107
  146. package/src/http3eventloop.h +0 -316
  147. package/src/http3server.cc +0 -514
  148. package/src/http3server.h +0 -151
  149. package/src/http3serverbackend.cc +0 -105
  150. package/src/http3serverbackend.h +0 -98
  151. package/src/http3serversession.cc +0 -123
  152. package/src/http3serversession.h +0 -95
  153. package/src/http3serverstream.cc +0 -463
  154. package/src/http3serverstream.h +0 -114
  155. package/src/http3sessioncache.cc +0 -85
  156. package/src/http3sessioncache.h +0 -59
  157. package/src/http3wtsessionvisitor.cc +0 -46
  158. package/src/http3wtsessionvisitor.h +0 -397
  159. package/src/http3wtstreamvisitor.cc +0 -155
  160. package/src/http3wtstreamvisitor.h +0 -404
  161. package/test/event-loop.node.js +0 -24
  162. package/tsconfig.json +0 -39
@@ -1,10 +0,0 @@
1
- /**
2
- * Write contents to a stream and close it
3
- *
4
- * @template T
5
- * @param {WritableStream<T>} writable
6
- * @param {T[]} input
7
- * @returns
8
- */
9
- export function writeStream<T>(writable: WritableStream<T>, input: T[]): Promise<void>;
10
- //# sourceMappingURL=write-stream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-stream.d.ts","sourceRoot":"","sources":["../../../test/fixtures/write-stream.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,uFAeC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../test/index.js"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- /**
2
- * <T>
3
- */
4
- export type Deferred<T> = import('../lib/types').Deferred<T>;
5
- //# sourceMappingURL=session.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.spec.d.ts","sourceRoot":"","sources":["../../test/session.spec.js"],"names":[],"mappings":";;;0BAQa,OAAO,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=unidirectional-streams.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unidirectional-streams.spec.d.ts","sourceRoot":"","sources":["../../test/unidirectional-streams.spec.js"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- The FAILS logo was designed by chadkills, ordered by Marten Richter on the fiverr platform.
2
-
3
- The logo is not coverred by AGPL as the other parts of FAILS or the FreeBSD style license.
4
- You can use it for a standard install, but for a fork of the package, please get your own logo.
package/lib/event-loop.js DELETED
@@ -1,88 +0,0 @@
1
- import { Http3WebTransport } from './transport.js'
2
- import { Http3WTStream } from './stream.js'
3
- import { Http3WTSession } from './session.js'
4
- import { wtrouter } from './native.js'
5
- import { logger } from './utils.js'
6
-
7
- const log = logger(`webtransport:event-loop(${process.pid})`)
8
-
9
- export class Http3EventLoop {
10
- /** @type {Http3EventLoop | null} */
11
- static globalLoop = null
12
-
13
- /**
14
- * @param {{ quicheLogVerbose: any; } | undefined} [args]
15
- */
16
- constructor(args) {
17
- this.eventloopInt = new wtrouter.Http3EventLoop({
18
- transportCallback: Http3WebTransport.transportCallback,
19
- streamCallback: Http3WTStream.callback,
20
- sessionCallback: Http3WTSession.callback,
21
- eventloopCallback: Http3EventLoop.callback,
22
- quicheLogVerbose: args?.quicheLogVerbose
23
- })
24
- this.eventloopInt.jsobj = this
25
-
26
- this.refObjects = new Set()
27
- this.loopGuardian = this.loopGuardian.bind(this)
28
- }
29
-
30
- /**
31
- * @param {*} [args]
32
- */
33
- startEventLoop(args) {
34
- log('start GlobalEventLoop')
35
- this.eventloopInt.startEventLoop(args)
36
- this.loopGuardianTimer = setInterval(this.loopGuardian, 5000)
37
- }
38
-
39
- shutdownEventLoop() {
40
- log('shutdown GlobalEventLoop')
41
- Http3EventLoop.globalLoop = null
42
- clearInterval(this.loopGuardianTimer)
43
- this.eventloopInt.shutDownEventLoop()
44
- }
45
-
46
- loopGuardian() {
47
- for (const item of this.refObjects) {
48
- if (typeof item.deref() === 'undefined' || item.deref()?.stopped)
49
- this.refObjects.delete(item)
50
- }
51
- if (this.refObjects.size === 0) {
52
- const now = Date.now()
53
- if (!this.refObjectsEmptyTime) this.refObjectsEmptyTime = now
54
- else if (now - this.refObjectsEmptyTime > 20 * 1000)
55
- this.shutdownEventLoop()
56
- } else if (this.refObjectsEmptyTime) delete this.refObjectsEmptyTime
57
- }
58
-
59
- static callback() {
60
- log('final eventloop callback called')
61
- }
62
-
63
- /**
64
- * @param {any} [args]
65
- * @returns {Http3EventLoop}
66
- */
67
- static createGlobalEventLoop(args) {
68
- if (!Http3EventLoop.globalLoop) {
69
- Http3EventLoop.globalLoop = new Http3EventLoop()
70
- Http3EventLoop.globalLoop.startEventLoop(args)
71
- log('createGlobalEventLoop')
72
- }
73
- return Http3EventLoop.globalLoop
74
- }
75
-
76
- /**
77
- * @param {any} object
78
- * @param {any} args
79
- * @returns {Http3EventLoop}
80
- */
81
- static getGlobalEventLoop(object, args) {
82
- if (!object) throw new Error('getGlobalEventLoop without reference object')
83
- const loop =
84
- Http3EventLoop.globalLoop ?? Http3EventLoop.createGlobalEventLoop(args)
85
- loop.refObjects.add(new WeakRef(object))
86
- return loop
87
- }
88
- }
package/lib/native.js DELETED
@@ -1,28 +0,0 @@
1
- import { existsSync } from 'fs'
2
- import { createRequire } from 'module'
3
- import * as path from 'path'
4
- import * as url from 'url'
5
- import { arch, platform } from 'node:process'
6
- import { logger } from './utils.js'
7
-
8
- const log = logger(`webtransport:native(${process.pid})`)
9
-
10
- const binplatform = platform + '_' + arch
11
- const require = createRequire(import.meta.url)
12
- const dirname = url.fileURLToPath(new URL('.', import.meta.url))
13
- let buildpath = '../build_' + binplatform
14
-
15
- if (!existsSync(path.join(dirname, buildpath))) buildpath = '../build' // use precompiled only if own compilation does not exist
16
-
17
- let wtpath = buildpath + '/Release/webtransport.node'
18
-
19
- if (
20
- process.env.NODE_ENV !== 'production' &&
21
- existsSync(path.join(dirname, buildpath + '/Debug/webtransport.node'))
22
- ) {
23
- wtpath = buildpath + '/Debug/webtransport.node'
24
- }
25
-
26
- log('load webtransport binary:', wtpath)
27
-
28
- export const wtrouter = require(wtpath)
package/lib/transport.js DELETED
@@ -1,82 +0,0 @@
1
- import { Http3EventLoop } from './event-loop.js'
2
- import { wtrouter } from './native.js'
3
- import { WebTransportError } from './error.js'
4
- import { logger } from './utils.js'
5
-
6
- const log = logger(`webtransport:http3webtransport(${process.pid})`)
7
-
8
- /**
9
- * @typedef {import('./types').Http3WebTransportInit} Http3WebTransportInit
10
- */
11
-
12
- export class Http3WebTransport {
13
- /**
14
- * @param {Http3WebTransportInit} args
15
- * @param {'server' | 'client'} purpose
16
- */
17
- constructor(args, purpose) {
18
- /** @type {Http3WebTransportInit | undefined} */
19
- this.args = args
20
- /** @type {'server' | 'client' | undefined} */
21
- this.purpose = purpose
22
- this.sessions = {}
23
- }
24
-
25
- createTransportInt() {
26
- if (this.transportInt != null) {
27
- return
28
- }
29
- const eventloop = Http3EventLoop.getGlobalEventLoop(this, {
30
- quicheLogVerbose: this.args?.quicheLogVerbose
31
- ? this.args.quicheLogVerbose
32
- : -1
33
- }).eventloopInt
34
-
35
- try {
36
- if (this.purpose === 'server') {
37
- this.transportInt = new wtrouter.Http3WebTransportServer(
38
- this.args,
39
- eventloop
40
- )
41
- } else if (this.purpose === 'client') {
42
- this.transportInt = new wtrouter.Http3WebTransportClient(
43
- this.args,
44
- eventloop
45
- )
46
- } else {
47
- throw new Error('unknown purpose')
48
- }
49
- } catch (/** @type {any} */ err) {
50
- const error = new WebTransportError('Opening handshake failed.')
51
- error.stack = err.stack
52
-
53
- throw error
54
- }
55
-
56
- delete this.purpose
57
- delete this.args
58
- this.transportInt.jsobj = this
59
- }
60
-
61
- /**
62
- * @typedef {object} TransportCallbackEvent
63
- * @property {{ jsobj: { customCallback: (args: any) => void }}} object
64
- * @property {string} purpose
65
- *
66
- * @param {TransportCallbackEvent} args
67
- */
68
- static transportCallback(args) {
69
- log('callback', args?.purpose)
70
- log.trace(args)
71
- if (!args || !args.object || !args.object.jsobj)
72
- throw new Error('Transport callback without jsobj')
73
- const visitor = args.object.jsobj
74
- if (args.purpose) {
75
- if (visitor.customCallback) {
76
- visitor.customCallback(args)
77
- } else {
78
- throw new Error('unknown purpose')
79
- }
80
- }
81
- }
82
- }
@@ -1,8 +0,0 @@
1
- #include "unicode/putil.h"
2
- #include "unicode/udata.h"
3
- #include "unicode/uversion.h"
4
- #include "ucmndata.h"
5
-
6
- extern "C" const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
7
-
8
- const DataHeader U_ICUDATA_ENTRY_POINT = { {0,0,0}, {0,0,0,0,0,0,0,0,0}};
@@ -1,3 +0,0 @@
1
- #include "absl/strings/ascii.h"
2
- #warning "Fake socketwin included"
3
- #include "third_party/quiche/quiche/quic/core/io/socket_win.inc"
@@ -1,7 +0,0 @@
1
- // use default impl
2
- #ifndef QUICHE_BUG_TRACKER
3
- #define QUICHE_BUG_TRACKER
4
-
5
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_bug_tracker_impl.h"
6
-
7
- #endif
@@ -1,7 +0,0 @@
1
- // use default impl
2
- #ifndef QUICHE_CLIENT_STATS_IMPL
3
- #define QUICHE_CLIENT_STATS_IMPL
4
-
5
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_client_stats_impl.h"
6
-
7
- #endif
@@ -1,7 +0,0 @@
1
- // use default impl
2
- #ifndef QUICHE_COMMAND_LINE_FLAGS_IMPL
3
- #define QUICHE_COMMAND_LINE_FLAGS_IMPL
4
-
5
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_command_line_flags_impl.h"
6
-
7
- #endif
@@ -1,7 +0,0 @@
1
- // use default impl
2
- #ifndef QUICHE_CONTAINER_IMPL
3
- #define QUICHE_CONTAINER_IMPL
4
-
5
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_containers_impl.h"
6
-
7
- #endif
@@ -1,7 +0,0 @@
1
- // use default impl
2
- #ifndef QUICHE_EVENT_LOOP_IMPL
3
- #define QUICHE_EVENT_LOOP_IMPL
4
-
5
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_event_loop_impl.h"
6
-
7
- #endif
@@ -1,6 +0,0 @@
1
- #ifndef QUICHE_EXPORT_IMPL_HEADER
2
- #define QUICHE_EXPORT_IMPL_HEADER
3
-
4
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_export_impl.h"
5
-
6
- #endif
@@ -1,11 +0,0 @@
1
- // Copyright 2020 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- #ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_UTILS_IMPL_H_
6
- #define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_UTILS_IMPL_H_
7
-
8
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flag_utils_impl.h"
9
-
10
-
11
- #endif // NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_UTILS_IMPL_H_
@@ -1,8 +0,0 @@
1
- // only for redirects
2
-
3
- #ifndef NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_IMPL_H_
4
- #define NET_QUICHE_COMMON_PLATFORM_IMPL_QUICHE_FLAG_IMPL_H_
5
-
6
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.h"
7
-
8
- #endif
@@ -1,10 +0,0 @@
1
- // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- #ifndef NET_QUICHE_PLATFORM_IMPL_QUIC_IOVEC_IMPL_H_
6
- #define NET_QUICHE_PLATFORM_IMPL_QUIC_IOVEC_IMPL_H_
7
-
8
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_iovec_impl.h"
9
-
10
- #endif // NET_QUIC_PLATFORM_IMPL_QUIC_IOVEC_IMPL_H_
@@ -1,21 +0,0 @@
1
- // modified for fails webtransport by Marten Richter
2
-
3
- //original Copyright by
4
-
5
- // Copyright 2021 The Chromium Authors. All rights reserved.
6
- // Use of this source code is governed by a BSD-style license that can be
7
- // found in the LICENSE file.
8
-
9
- // This file does not actually implement logging, it merely provides enough of
10
- // logging code for QUICHE to compile. QUICHE embedders are encouraged to
11
- // override this file with their own logic. If at some point logging becomes a
12
- // part of Abseil, this file will likely start using that instead.
13
-
14
-
15
-
16
- #ifndef QUICHE_COMMON_PLATFORM_NODE_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
17
- #define QUICHE_COMMON_PLATFORM_NODE_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
18
-
19
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.h"
20
-
21
- #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
@@ -1,2 +0,0 @@
1
- // use the default
2
- #include "quiche/common/platform/default/quiche_platform_impl/quiche_mem_slice_impl.h"
@@ -1,8 +0,0 @@
1
- // from envoy so LICENSE.envoy applies
2
- // use default impl
3
- #ifndef QUICHE_MUTEX_IMPL
4
- #define QUICHE_MUTEX_IMPL
5
-
6
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_mutex_impl.h"
7
-
8
- #endif
@@ -1,11 +0,0 @@
1
- // Copyright 2017 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- #ifndef QUICHE_PREFETCH_IMPL_H_
6
- #define QUICHE_PREFETCH_IMPL_H_
7
-
8
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_prefetch_impl.h"
9
-
10
-
11
- #endif
@@ -1,16 +0,0 @@
1
- // from envoy so LICENSE.envoy applies
2
- #ifndef NET_QUIC_PLATFORM_IMPL_QUIC_REFERENCE_COUNTED_IMPL_H_
3
- #define NET_QUIC_PLATFORM_IMPL_QUIC_REFERENCE_COUNTED_IMPL_H_
4
-
5
- // NOLINT(namespace-envoy)
6
-
7
- // This file is part of the QUICHE platform implementation, and is not to be
8
- // consumed or referenced directly by other Envoy code. It serves purely as a
9
- // porting layer for QUICHE.
10
-
11
-
12
-
13
- #include "quiche/common/platform/default/quiche_platform_impl/quiche_reference_counted_impl.h"
14
-
15
-
16
- #endif // NET_QUIC_PLATFORM_IMPL_QUIC_REFERENCE_COUNTED_IMPL_H_
@@ -1,7 +0,0 @@
1
- // from envoy so LICENSE.envoy applies
2
- #ifndef QUICHE_SERVER_STATS_IMPL
3
- #define QUICHE_SERVER_STATS_IMPL
4
-
5
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_server_stats_impl.h"
6
-
7
- #endif
@@ -1,12 +0,0 @@
1
- // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- #ifndef NET_QUICHE_PLATFORM_IMPL_QUICHE_STACK_TRACE_IMPL_H_
6
- #define NET_QUICHE_PLATFORM_IMPL_QUICHE_STACK_TRACE_IMPL_H_
7
-
8
- #include <string>
9
-
10
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_stack_trace_impl.h"
11
-
12
- #endif // NET_QUIC_PLATFORM_IMPL_QUIC_STACK_TRACE_IMPL_H_
@@ -1,8 +0,0 @@
1
-
2
- // Copyright (c) 2019 The Chromium Authors. All rights reserved.
3
- // Use of this source code is governed by a BSD-style license that can be
4
- // found in the LICENSE file.
5
- #ifndef NET_QUIC_PLATFORM_IMPL_QUIC_STREAM_BUFFER_ALLOCATOR_IMPL_H_
6
- #define NET_QUIC_PLATFORM_IMPL_QUIC_STREAM_BUFFER_ALLOCATOR_IMPL_H_
7
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_stream_buffer_allocator_impl.h"
8
- #endif // NET_QUIC_PLATFORM_IMPL_QUIC_STREAM_BUFFER_ALLOCATOR_IMPL_H_
@@ -1 +0,0 @@
1
- #include "quiche/common/platform/default/quiche_platform_impl/quiche_testvalue_impl.h"
@@ -1,6 +0,0 @@
1
- #ifndef QUICHE_THREAD_LOCAL_IMPL
2
- #define QUICHE_THREAD_LOCAL_IMPL
3
-
4
- #include "quiche/common/platform/default/quiche_platform_impl/quiche_thread_local_impl.h"
5
-
6
- #endif
@@ -1,13 +0,0 @@
1
- // from envoy so LICENSE.envoy applies
2
- // NOLINT(namespace-envoy)
3
-
4
- // This file is part of the QUICHE platform implementation, and is not to be
5
- // consumed or referenced directly by other Envoy code. It serves purely as a
6
- // porting layer for QUICHE.
7
-
8
- #ifndef QUICHE_TIME_UTILS_IMPL
9
- #define QUICHE_TIME_UTILS_IMPL
10
-
11
- #include "third_party/quiche/quiche/common/platform/default/quiche_platform_impl/quiche_time_utils_impl.h"
12
-
13
- #endif
@@ -1,39 +0,0 @@
1
- // Copyright 2020 The Chromium Authors. All rights reserved.
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- #ifndef NET_QUICHE_PLATFORM_IMPL_QUICHE_UDP_SOCKET_PLATFORM_IMPL_H_
6
- #define NET_QUICHE_PLATFORM_IMPL_QUICHE_UDP_SOCKET_PLATFORM_IMPL_H_
7
-
8
- #ifndef WIN32
9
- #include <sys/socket.h>
10
- #endif
11
-
12
- #include <cstddef>
13
- #include <cstdint>
14
-
15
- namespace quiche {
16
-
17
- const size_t kCmsgSpaceForGooglePacketHeaderImpl = 0;
18
-
19
- inline bool GetGooglePacketHeadersFromControlMessageImpl(
20
- struct ::cmsghdr* cmsg,
21
- char** packet_headers,
22
- size_t* packet_headers_len) {
23
- return false;
24
- }
25
-
26
- inline void SetGoogleSocketOptionsImpl(int fd) {}
27
-
28
- inline int GetEcnCmsgArgsPreserveDscpImpl(const int /*fd*/,
29
- const int /*address_family*/,
30
- uint8_t /*ecn_codepoint*/,
31
- int& /*type*/, void* /*value*/,
32
- socklen_t& /*value_len*/) {
33
- // TODO(b/273081493): implement this.
34
- return 0;
35
- }
36
-
37
- } // namespace quic
38
-
39
- #endif // NET_QUIC_PLATFORM_IMPL_QUIC_UDP_SOCKET_PLATFORM_IMPL_H_
@@ -1,36 +0,0 @@
1
- // modifications
2
- // Copyright (c) 2022 Marten Richter or other contributers (see commit). All rights reserved.
3
- // Use of this source code is governed by a BSD-style license that can be
4
- // found in the LICENSE file.
5
-
6
- // original copyright, see LICENSE.chromium
7
- // Copyright (c) 2012 The Chromium Authors. All rights reserved.
8
- // Use of this source code is governed by a BSD-style license that can be
9
- // found in the LICENSE file.
10
-
11
- #include "src/http3backendresponse.h"
12
-
13
- namespace quic
14
- {
15
-
16
- Http3BackendResponse::ServerPushInfo::ServerPushInfo(
17
- std::string request_url,
18
- spdy::Http2HeaderBlock headers,
19
- spdy::SpdyPriority priority,
20
- std::string body)
21
- : request_url(request_url),
22
- headers(std::move(headers)),
23
- priority(priority),
24
- body(body) {}
25
-
26
- Http3BackendResponse::ServerPushInfo::ServerPushInfo(const ServerPushInfo &other)
27
- : request_url(other.request_url),
28
- headers(other.headers.Clone()),
29
- priority(other.priority),
30
- body(other.body) {}
31
-
32
- Http3BackendResponse::Http3BackendResponse() : response_type_(REGULAR_RESPONSE) {}
33
-
34
- Http3BackendResponse::~Http3BackendResponse() = default;
35
-
36
- } // namespace quic
@@ -1,109 +0,0 @@
1
- // modifications
2
- // Copyright (c) 2022 Marten Richter or other contributers (see commit). All rights reserved.
3
- // Use of this source code is governed by a BSD-style license that can be
4
- // found in the LICENSE file.
5
-
6
- // original copyright, see LICENSE.chromium
7
- // Copyright 2017 The Chromium Authors. All rights reserved.
8
- // Use of this source code is governed by a BSD-style license that can be
9
- // found in the LICENSE file.
10
-
11
- #ifndef HTTPS_BACKEND_RESPONSE_H_
12
- #define HTTPS_BACKEND_RESPONSE_H_
13
-
14
- #include <memory>
15
-
16
- #include "absl/strings/string_view.h"
17
- #include "quiche/spdy/core/spdy_protocol.h"
18
-
19
- namespace quic
20
- {
21
-
22
- // Container for HTTP response header/body pairs
23
- // fetched by the QuicSimpleServerBackend
24
- class Http3BackendResponse
25
- {
26
- public:
27
- // A ServerPushInfo contains path of the push request and everything needed in
28
- // comprising a response for the push request.
29
- // TODO(b/171463363): Remove.
30
- struct ServerPushInfo
31
- {
32
- ServerPushInfo(std::string request_url,
33
- spdy::Http2HeaderBlock headers,
34
- spdy::SpdyPriority priority,
35
- std::string body);
36
- ServerPushInfo(const ServerPushInfo &other);
37
-
38
- std::string request_url;
39
- spdy::Http2HeaderBlock headers;
40
- spdy::SpdyPriority priority;
41
- std::string body;
42
- };
43
-
44
- enum SpecialResponseType
45
- {
46
- REGULAR_RESPONSE, // Send the headers and body like a server should.
47
- CLOSE_CONNECTION, // Close the connection (sending the close packet).
48
- IGNORE_REQUEST, // Do nothing, expect the client to time out.
49
- BACKEND_ERR_RESPONSE, // There was an error fetching the response from
50
- // the backend, for example as a TCP connection
51
- // error.
52
- INCOMPLETE_RESPONSE, // The server will act as if there is a non-empty
53
- // trailer but it will not be sent, as a result, FIN
54
- // will not be sent too.
55
- GENERATE_BYTES // Sends a response with a length equal to the number
56
- // of bytes in the URL path.
57
- };
58
- Http3BackendResponse();
59
-
60
- Http3BackendResponse(const Http3BackendResponse &other) = delete;
61
- Http3BackendResponse &operator=(const Http3BackendResponse &other) = delete;
62
-
63
- ~Http3BackendResponse();
64
-
65
- const std::vector<spdy::Http2HeaderBlock> &early_hints() const
66
- {
67
- return early_hints_;
68
- }
69
- SpecialResponseType response_type() const { return response_type_; }
70
- const spdy::Http2HeaderBlock &headers() const { return headers_; }
71
- const spdy::Http2HeaderBlock &trailers() const { return trailers_; }
72
- const absl::string_view body() const { return absl::string_view(body_); }
73
-
74
- void AddEarlyHints(const spdy::Http2HeaderBlock &headers)
75
- {
76
- spdy::Http2HeaderBlock hints = headers.Clone();
77
- hints[":status"] = "103";
78
- early_hints_.push_back(std::move(hints));
79
- }
80
-
81
- void set_response_type(SpecialResponseType response_type)
82
- {
83
- response_type_ = response_type;
84
- }
85
-
86
- void set_headers(spdy::Http2HeaderBlock headers)
87
- {
88
- headers_ = std::move(headers);
89
- }
90
- void set_trailers(spdy::Http2HeaderBlock trailers)
91
- {
92
- trailers_ = std::move(trailers);
93
- }
94
- void set_body(absl::string_view body)
95
- {
96
- body_.assign(body.data(), body.size());
97
- }
98
-
99
- private:
100
- std::vector<spdy::Http2HeaderBlock> early_hints_;
101
- SpecialResponseType response_type_;
102
- spdy::Http2HeaderBlock headers_;
103
- spdy::Http2HeaderBlock trailers_;
104
- std::string body_;
105
- };
106
-
107
- } // namespace quic
108
-
109
- #endif // QUICHE_QUIC_TOOLS_QUIC_BACKEND_RESPONSE_H_