@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,52 +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) 2018 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/http3clientstream.h"
12
- #include "quiche/common/platform/api/quiche_logging.h"
13
-
14
- namespace quic {
15
-
16
- void Http3ClientStream::OnBodyAvailable() {
17
- if (!drop_response_body_) {
18
- QuicSpdyClientStream::OnBodyAvailable();
19
- return;
20
- }
21
-
22
- while (HasBytesToRead()) {
23
- struct iovec iov;
24
- if (GetReadableRegions(&iov, 1) == 0) {
25
- break;
26
- }
27
- MarkConsumed(iov.iov_len);
28
- }
29
- if (sequencer()->IsClosed()) {
30
- OnFinRead();
31
- } else {
32
- sequencer()->SetUnblocked();
33
- }
34
- }
35
-
36
- bool Http3ClientStream::ParseAndValidateStatusCode() {
37
- const size_t num_previous_interim_headers = preliminary_headers().size();
38
- if (!QuicSpdyClientStream::ParseAndValidateStatusCode()) {
39
- return false;
40
- }
41
- // The base ParseAndValidateStatusCode() may have added a preliminary header.
42
- if (preliminary_headers().size() > num_previous_interim_headers) {
43
- QUICHE_DCHECK_EQ(preliminary_headers().size(),
44
- num_previous_interim_headers + 1);
45
- if (on_interim_headers_) {
46
- on_interim_headers_(preliminary_headers().back());
47
- }
48
- }
49
- return true;
50
- }
51
-
52
- } // namespace quic
@@ -1,42 +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) 2018 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 HTTP3_CLIENT_STREAM_H
12
- #define HTTP3_CLIENT_STREAM_H
13
-
14
- #include "quiche/quic/core/http/quic_spdy_client_stream.h"
15
-
16
- namespace quic {
17
-
18
- class Http3ClientStream : public QuicSpdyClientStream {
19
- public:
20
- Http3ClientStream(QuicStreamId id, QuicSpdyClientSession* session,
21
- StreamType type, bool drop_response_body)
22
- : QuicSpdyClientStream(id, session, type),
23
- drop_response_body_(drop_response_body) {}
24
- void OnBodyAvailable() override;
25
-
26
- void set_on_interim_headers(
27
- std::function<void(const spdy::Http2HeaderBlock&)> on_interim_headers) {
28
- on_interim_headers_ = std::move(on_interim_headers);
29
- }
30
-
31
- protected:
32
- bool ParseAndValidateStatusCode() override;
33
-
34
-
35
- private:
36
- std::function<void(const spdy::Http2HeaderBlock&)> on_interim_headers_;
37
- const bool drop_response_body_;
38
- };
39
-
40
- } // namespace quic
41
-
42
- #endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_CLIENT_STREAM_H_
@@ -1,62 +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/http3dispatcher.h"
12
- #include "src/http3serversession.h"
13
-
14
- #include "absl/strings/string_view.h"
15
-
16
- namespace quic {
17
-
18
- Http3Dispatcher::Http3Dispatcher(
19
- const QuicConfig* config,
20
- const QuicCryptoServerConfig* crypto_config,
21
- QuicVersionManager* version_manager,
22
- std::unique_ptr<QuicConnectionHelperInterface> helper,
23
- std::unique_ptr<QuicCryptoServerStreamBase::Helper> session_helper,
24
- std::unique_ptr<QuicAlarmFactory> alarm_factory,
25
- Http3ServerBackend* http3_server_backend,
26
- uint8_t expected_server_connection_id_length,
27
- ConnectionIdGeneratorInterface& generator)
28
- : QuicDispatcher(config,
29
- crypto_config,
30
- version_manager,
31
- std::move(helper),
32
- std::move(session_helper),
33
- std::move(alarm_factory),
34
- expected_server_connection_id_length,
35
- generator),
36
- http3_server_backend_(http3_server_backend) {}
37
-
38
- Http3Dispatcher::~Http3Dispatcher() = default;
39
-
40
-
41
-
42
- std::unique_ptr<QuicSession> Http3Dispatcher::CreateQuicSession(
43
- QuicConnectionId connection_id, const QuicSocketAddress& self_address,
44
- const QuicSocketAddress& peer_address, absl::string_view /*alpn*/,
45
- const ParsedQuicVersion& version,
46
- const ParsedClientHello& /*parsed_chlo*/,
47
- ConnectionIdGeneratorInterface& connection_id_generator) {
48
- // The QuicServerSessionBase takes ownership of |connection| below.
49
- QuicConnection* connection =
50
- new QuicConnection(connection_id, self_address, peer_address, helper(),
51
- alarm_factory(), writer(),
52
- /* owns_writer= */ false, Perspective::IS_SERVER,
53
- ParsedQuicVersionVector{version}, connection_id_generator);
54
-
55
- auto session = std::make_unique<Http3ServerSession>(
56
- config(), GetSupportedVersions(), connection, this, session_helper(),
57
- crypto_config(), compressed_certs_cache(), http3_server_backend_);
58
- session->Initialize();
59
- return session;
60
- }
61
-
62
- } // namespace quic
@@ -1,57 +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
- #ifndef HTTP3_DISPATCHER
12
- #define HTTP3_DISPATCHER
13
-
14
- #include "src/http3serverbackend.h"
15
- #include "absl/strings/string_view.h"
16
- #include "quiche/quic/core/http/quic_server_session_base.h"
17
- #include "quiche/quic/core/quic_dispatcher.h"
18
-
19
- namespace quic
20
- {
21
-
22
- class Http3Dispatcher : public QuicDispatcher
23
- {
24
- public:
25
- Http3Dispatcher(
26
- const QuicConfig *config,
27
- const QuicCryptoServerConfig *crypto_config,
28
- QuicVersionManager *version_manager,
29
- std::unique_ptr<QuicConnectionHelperInterface> helper,
30
- std::unique_ptr<QuicCryptoServerStreamBase::Helper> session_helper,
31
- std::unique_ptr<QuicAlarmFactory> alarm_factory,
32
- Http3ServerBackend *http3_server_backend,
33
- uint8_t expected_server_connection_id_length,
34
- ConnectionIdGeneratorInterface& generator);
35
-
36
- ~Http3Dispatcher() override;
37
-
38
- protected:
39
- std::unique_ptr<QuicSession> CreateQuicSession(
40
- QuicConnectionId connection_id, const QuicSocketAddress &self_address,
41
- const QuicSocketAddress &peer_address, absl::string_view alpn,
42
- const ParsedQuicVersion &version,
43
- const ParsedClientHello &parsed_chlo,
44
- ConnectionIdGeneratorInterface& connection_id_generator) override;
45
-
46
- Http3ServerBackend *server_backend()
47
- {
48
- return http3_server_backend_;
49
- }
50
-
51
- private:
52
- Http3ServerBackend *http3_server_backend_; // Unowned.
53
- };
54
-
55
- } // namespace quic
56
-
57
- #endif