@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
|
@@ -1,105 +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/http3serverbackend.h"
|
|
12
|
-
#include "src/http3wtsessionvisitor.h"
|
|
13
|
-
#include "src/http3server.h"
|
|
14
|
-
#include "src/http3eventloop.h"
|
|
15
|
-
|
|
16
|
-
#include <utility>
|
|
17
|
-
|
|
18
|
-
#include "absl/strings/match.h"
|
|
19
|
-
#include "absl/strings/numbers.h"
|
|
20
|
-
#include "absl/strings/str_cat.h"
|
|
21
|
-
#include "absl/strings/string_view.h"
|
|
22
|
-
#include "quiche/quic/core/http/spdy_utils.h"
|
|
23
|
-
#include "quiche/quic/platform/api/quic_bug_tracker.h"
|
|
24
|
-
#include "quiche/quic/platform/api/quic_logging.h"
|
|
25
|
-
//#include "quic/tools/web_transport_test_visitors.h"
|
|
26
|
-
#include "quiche/common/platform/api/quiche_file_utils.h"
|
|
27
|
-
#include "quiche/common/quiche_text_utils.h"
|
|
28
|
-
|
|
29
|
-
using spdy::Http2HeaderBlock;
|
|
30
|
-
|
|
31
|
-
namespace quic
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
void QuicMemoryCacheBackend::GenerateDynamicResponses() {
|
|
36
|
-
QuicWriterMutexLock lock(&response_mutex_);
|
|
37
|
-
// Add a generate bytes response.
|
|
38
|
-
spdy::Http2HeaderBlock response_headers;
|
|
39
|
-
response_headers[":status"] = "200";
|
|
40
|
-
generate_bytes_response_ = std::make_unique<QuicBackendResponse>();
|
|
41
|
-
generate_bytes_response_->set_headers(std::move(response_headers));
|
|
42
|
-
generate_bytes_response_->set_response_type(
|
|
43
|
-
QuicBackendResponse::GENERATE_BYTES);
|
|
44
|
-
}
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
Http3ServerBackend::WebTransportRespPromisePtr
|
|
48
|
-
Http3ServerBackend::ProcessWebTransportRequest(
|
|
49
|
-
const spdy::Http2HeaderBlock &request_headers,
|
|
50
|
-
WebTransportSession *session)
|
|
51
|
-
{
|
|
52
|
-
WebTransportRespPromisePtr promise = std::make_shared<WebTransportRespPromise>();
|
|
53
|
-
if (!SupportsWebTransport())
|
|
54
|
-
{
|
|
55
|
-
std::unique_ptr<WebTransportResponse> response = std::make_unique<WebTransportResponse>();
|
|
56
|
-
response->response_headers[":status"] = "400";
|
|
57
|
-
promise->resolve(std::move(response));
|
|
58
|
-
return promise;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
auto path_it = request_headers.find(":path");
|
|
62
|
-
if (path_it == request_headers.end())
|
|
63
|
-
{
|
|
64
|
-
std::unique_ptr<WebTransportResponse> response = std::make_unique<WebTransportResponse>();
|
|
65
|
-
response->response_headers[":status"] = "400";
|
|
66
|
-
promise->resolve(std::move(response));
|
|
67
|
-
return promise;
|
|
68
|
-
}
|
|
69
|
-
std::string path(path_it->second);
|
|
70
|
-
|
|
71
|
-
if (paths_.find(path) != paths_.end())
|
|
72
|
-
{ // to do handle our web transport paths
|
|
73
|
-
std::unique_ptr<WebTransportResponse> response = std::make_unique<WebTransportResponse>();
|
|
74
|
-
Http3WTSession *wtsession = new Http3WTSession();
|
|
75
|
-
wtsession->init(session, eventloop_);
|
|
76
|
-
response->response_headers[":status"] = "200";
|
|
77
|
-
response->visitor =
|
|
78
|
-
std::make_unique<Http3WTSession::Visitor>(wtsession);
|
|
79
|
-
eventloop_->informAboutNewSession(server_, static_cast<Http3WTSession *>(wtsession), path, nullptr);
|
|
80
|
-
promise->resolve(std::move(response));
|
|
81
|
-
return promise;
|
|
82
|
-
}
|
|
83
|
-
else if (jshandlerequesthandler_)
|
|
84
|
-
{
|
|
85
|
-
// first step pass header block along, due to thread safety, we need to copy
|
|
86
|
-
spdy::Http2HeaderBlock *reqheadcopy = new Http2HeaderBlock(request_headers.Clone());
|
|
87
|
-
|
|
88
|
-
// second step inform the js side
|
|
89
|
-
eventloop_->informAboutNewSessionRequest(server_, session, reqheadcopy, promise);
|
|
90
|
-
return promise;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
std::unique_ptr<WebTransportResponse> response = std::make_unique<WebTransportResponse>();
|
|
94
|
-
response->response_headers[":status"] = "404";
|
|
95
|
-
promise->resolve(std::move(response));
|
|
96
|
-
return promise;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
Http3ServerBackend::~Http3ServerBackend()
|
|
100
|
-
{
|
|
101
|
-
{
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
} // namespace quic
|
package/src/http3serverbackend.h
DELETED
|
@@ -1,98 +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 QUICHE_QUIC_TOOLS_QUIC_SIMPLE_SERVER_BACKEND_H_
|
|
12
|
-
#define QUICHE_QUIC_TOOLS_QUIC_SIMPLE_SERVER_BACKEND_H_
|
|
13
|
-
|
|
14
|
-
#include <memory>
|
|
15
|
-
|
|
16
|
-
#include "quiche/quic/core/quic_types.h"
|
|
17
|
-
#include "quiche/quic/core/web_transport_interface.h"
|
|
18
|
-
#include "quiche/spdy/core/http2_header_block.h"
|
|
19
|
-
|
|
20
|
-
namespace quic
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
class Http3Server;
|
|
24
|
-
class Http3EventLoop;
|
|
25
|
-
|
|
26
|
-
template <typename T>
|
|
27
|
-
class JSlikePromise
|
|
28
|
-
{
|
|
29
|
-
public:
|
|
30
|
-
void finally(std::function<void(T *)> func)
|
|
31
|
-
{
|
|
32
|
-
T *res = result.get();
|
|
33
|
-
if (res != nullptr)
|
|
34
|
-
func(res);
|
|
35
|
-
else
|
|
36
|
-
finallys.push_back(func);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
void resolve(std::unique_ptr<T> res)
|
|
40
|
-
{
|
|
41
|
-
if (result.get() != nullptr)
|
|
42
|
-
return; // throw std::runtime_error("Promise already settled");
|
|
43
|
-
result = std::move(res);
|
|
44
|
-
for (auto finally : finallys)
|
|
45
|
-
{
|
|
46
|
-
finally(result.get());
|
|
47
|
-
}
|
|
48
|
-
finallys.clear();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
protected:
|
|
52
|
-
std::unique_ptr<T> result;
|
|
53
|
-
std::list<std::function<void(T *)>> finallys;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// This interface implements the functionality to fetch a response
|
|
57
|
-
// from the backend (such as cache, http-proxy etc) to serve
|
|
58
|
-
// requests received by a Quic Server
|
|
59
|
-
// no, here only webtransport stuff remained, I do not want to serve http3
|
|
60
|
-
class Http3ServerBackend
|
|
61
|
-
{
|
|
62
|
-
public:
|
|
63
|
-
struct WebTransportResponse
|
|
64
|
-
{
|
|
65
|
-
spdy::Http2HeaderBlock response_headers;
|
|
66
|
-
std::unique_ptr<WebTransportVisitor> visitor;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
using WebTransportRespPromise = JSlikePromise<WebTransportResponse>;
|
|
70
|
-
using WebTransportRespPromisePtr = std::shared_ptr<WebTransportRespPromise>;
|
|
71
|
-
|
|
72
|
-
Http3ServerBackend(Http3EventLoop *eventloop) : eventloop_(eventloop),
|
|
73
|
-
server_(nullptr), jshandlerequesthandler_(false) {}
|
|
74
|
-
|
|
75
|
-
~Http3ServerBackend();
|
|
76
|
-
|
|
77
|
-
void setServer(Http3Server *server) { server_ = server; }
|
|
78
|
-
void setJSHandler(bool on) { jshandlerequesthandler_ = on; }
|
|
79
|
-
|
|
80
|
-
WebTransportRespPromisePtr ProcessWebTransportRequest(
|
|
81
|
-
const spdy::Http2HeaderBlock & /*request_headers*/,
|
|
82
|
-
WebTransportSession * /*session*/);
|
|
83
|
-
bool SupportsWebTransport() { return true; }
|
|
84
|
-
bool UsesDatagramContexts() { return true; }
|
|
85
|
-
bool SupportsExtendedConnect() { return true; }
|
|
86
|
-
|
|
87
|
-
void addPath(std::string path) { paths_.insert(path); }
|
|
88
|
-
|
|
89
|
-
protected:
|
|
90
|
-
Http3Server *server_; // unowned
|
|
91
|
-
Http3EventLoop *eventloop_; // unowned
|
|
92
|
-
bool jshandlerequesthandler_;
|
|
93
|
-
std::set<std::string> paths_;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
} // namespace quic
|
|
97
|
-
|
|
98
|
-
#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_SERVER_BACKEND_H_
|
|
@@ -1,123 +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/http3serversession.h"
|
|
12
|
-
|
|
13
|
-
#include <utility>
|
|
14
|
-
|
|
15
|
-
#include "absl/memory/memory.h"
|
|
16
|
-
#include "quiche/quic/core/http/quic_server_initiated_spdy_stream.h"
|
|
17
|
-
#include "quiche/quic/core/http/quic_spdy_session.h"
|
|
18
|
-
#include "quiche/quic/core/quic_connection.h"
|
|
19
|
-
#include "quiche/quic/core/quic_types.h"
|
|
20
|
-
#include "quiche/quic/core/quic_utils.h"
|
|
21
|
-
#include "quiche/quic/platform/api/quic_flags.h"
|
|
22
|
-
#include "quiche/quic/platform/api/quic_logging.h"
|
|
23
|
-
#include "src/http3serverstream.h"
|
|
24
|
-
|
|
25
|
-
namespace quic
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
Http3ServerSession::Http3ServerSession(
|
|
29
|
-
const QuicConfig &config, const ParsedQuicVersionVector &supported_versions,
|
|
30
|
-
QuicConnection *connection, QuicSession::Visitor *visitor,
|
|
31
|
-
QuicCryptoServerStreamBase::Helper *helper,
|
|
32
|
-
const QuicCryptoServerConfig *crypto_config,
|
|
33
|
-
QuicCompressedCertsCache *compressed_certs_cache,
|
|
34
|
-
Http3ServerBackend *http3_server_backend)
|
|
35
|
-
: QuicServerSessionBase(config, supported_versions, connection, visitor,
|
|
36
|
-
helper, crypto_config, compressed_certs_cache),
|
|
37
|
-
http3_server_backend_(http3_server_backend)
|
|
38
|
-
{
|
|
39
|
-
QUICHE_DCHECK(http3_server_backend_);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Http3ServerSession::~Http3ServerSession() { DeleteConnection(); }
|
|
43
|
-
|
|
44
|
-
std::unique_ptr<QuicCryptoServerStreamBase>
|
|
45
|
-
Http3ServerSession::CreateQuicCryptoServerStream(
|
|
46
|
-
const QuicCryptoServerConfig *crypto_config,
|
|
47
|
-
QuicCompressedCertsCache *compressed_certs_cache)
|
|
48
|
-
{
|
|
49
|
-
return CreateCryptoServerStream(crypto_config, compressed_certs_cache, this,
|
|
50
|
-
stream_helper());
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
void Http3ServerSession::OnStreamFrame(const QuicStreamFrame &frame)
|
|
54
|
-
{
|
|
55
|
-
if (!IsIncomingStream(frame.stream_id) && !WillNegotiateWebTransport())
|
|
56
|
-
{
|
|
57
|
-
QUIC_LOG(WARNING) << "Client shouldn't send data on server push stream";
|
|
58
|
-
connection()->CloseConnection(
|
|
59
|
-
QUIC_INVALID_STREAM_ID, "Client sent data on server push stream",
|
|
60
|
-
ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
QuicSpdySession::OnStreamFrame(frame);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
QuicSpdyStream *Http3ServerSession::CreateIncomingStream(QuicStreamId id)
|
|
67
|
-
{
|
|
68
|
-
if (!ShouldCreateIncomingStream(id))
|
|
69
|
-
{
|
|
70
|
-
return nullptr;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
QuicSpdyStream *stream = new Http3ServerStream(
|
|
74
|
-
id, this, BIDIRECTIONAL, http3_server_backend_);
|
|
75
|
-
ActivateStream(absl::WrapUnique(stream));
|
|
76
|
-
return stream;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
QuicSpdyStream *Http3ServerSession::CreateIncomingStream(
|
|
80
|
-
PendingStream *pending)
|
|
81
|
-
{
|
|
82
|
-
QuicSpdyStream *stream =
|
|
83
|
-
new Http3ServerStream(pending, this, http3_server_backend_);
|
|
84
|
-
ActivateStream(absl::WrapUnique(stream));
|
|
85
|
-
return stream;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
QuicSpdyStream *Http3ServerSession::CreateOutgoingBidirectionalStream()
|
|
89
|
-
{
|
|
90
|
-
if (!WillNegotiateWebTransport())
|
|
91
|
-
{
|
|
92
|
-
QUIC_BUG(Http3ServerSession CreateOutgoingBidirectionalStream without
|
|
93
|
-
WebTransport support)
|
|
94
|
-
<< "Http3ServerSession::CreateOutgoingBidirectionalStream called "
|
|
95
|
-
"in a session without WebTransport support.";
|
|
96
|
-
return nullptr;
|
|
97
|
-
}
|
|
98
|
-
if (!ShouldCreateOutgoingBidirectionalStream())
|
|
99
|
-
{
|
|
100
|
-
return nullptr;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
QuicServerInitiatedSpdyStream *stream = new QuicServerInitiatedSpdyStream(
|
|
104
|
-
GetNextOutgoingBidirectionalStreamId(), this, BIDIRECTIONAL);
|
|
105
|
-
ActivateStream(absl::WrapUnique(stream));
|
|
106
|
-
return stream;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
Http3ServerStream *
|
|
110
|
-
Http3ServerSession::CreateOutgoingUnidirectionalStream()
|
|
111
|
-
{
|
|
112
|
-
if (!ShouldCreateOutgoingUnidirectionalStream())
|
|
113
|
-
{
|
|
114
|
-
return nullptr;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
Http3ServerStream *stream = new Http3ServerStream(
|
|
118
|
-
GetNextOutgoingUnidirectionalStreamId(), this, WRITE_UNIDIRECTIONAL,
|
|
119
|
-
http3_server_backend_);
|
|
120
|
-
ActivateStream(absl::WrapUnique(stream));
|
|
121
|
-
return stream;
|
|
122
|
-
}
|
|
123
|
-
} // namespace quic
|
package/src/http3serversession.h
DELETED
|
@@ -1,95 +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
|
-
// A toy server specific QuicSession subclass.
|
|
12
|
-
|
|
13
|
-
#ifndef HTTP3_SERVER_SESSION_H
|
|
14
|
-
#define HTTP3_SERVER_SESSION_H
|
|
15
|
-
|
|
16
|
-
#include <stdint.h>
|
|
17
|
-
|
|
18
|
-
#include <list>
|
|
19
|
-
#include <memory>
|
|
20
|
-
#include <set>
|
|
21
|
-
#include <string>
|
|
22
|
-
#include <utility>
|
|
23
|
-
#include <vector>
|
|
24
|
-
|
|
25
|
-
#include "quiche/quic/core/http/quic_server_session_base.h"
|
|
26
|
-
#include "quiche/quic/core/http/quic_spdy_session.h"
|
|
27
|
-
#include "quiche/quic/core/quic_crypto_server_stream_base.h"
|
|
28
|
-
#include "quiche/quic/core/quic_packets.h"
|
|
29
|
-
// #include "quic/tools/quic_backend_response.h"
|
|
30
|
-
#include "src/http3serverbackend.h"
|
|
31
|
-
#include "src/http3serverstream.h" // todo
|
|
32
|
-
|
|
33
|
-
namespace quic
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
class Http3ServerSession : public QuicServerSessionBase
|
|
37
|
-
{
|
|
38
|
-
public:
|
|
39
|
-
// Takes ownership of |connection|.
|
|
40
|
-
Http3ServerSession(const QuicConfig &config,
|
|
41
|
-
const ParsedQuicVersionVector &supported_versions,
|
|
42
|
-
QuicConnection *connection,
|
|
43
|
-
QuicSession::Visitor *visitor,
|
|
44
|
-
QuicCryptoServerStreamBase::Helper *helper,
|
|
45
|
-
const QuicCryptoServerConfig *crypto_config,
|
|
46
|
-
QuicCompressedCertsCache *compressed_certs_cache,
|
|
47
|
-
Http3ServerBackend *http3_server_backend);
|
|
48
|
-
Http3ServerSession(const Http3ServerSession &) = delete;
|
|
49
|
-
Http3ServerSession &operator=(const Http3ServerSession &) = delete;
|
|
50
|
-
|
|
51
|
-
~Http3ServerSession() override;
|
|
52
|
-
|
|
53
|
-
// Override base class to detact client sending data on server push stream.
|
|
54
|
-
void OnStreamFrame(const QuicStreamFrame &frame) override;
|
|
55
|
-
|
|
56
|
-
protected:
|
|
57
|
-
// QuicSession methods:
|
|
58
|
-
QuicSpdyStream *CreateIncomingStream(QuicStreamId id) override;
|
|
59
|
-
QuicSpdyStream *CreateIncomingStream(PendingStream *pending) override;
|
|
60
|
-
QuicSpdyStream *CreateOutgoingBidirectionalStream() override;
|
|
61
|
-
Http3ServerStream *CreateOutgoingUnidirectionalStream() override;
|
|
62
|
-
|
|
63
|
-
// QuicServerSessionBaseMethod:
|
|
64
|
-
std::unique_ptr<QuicCryptoServerStreamBase> CreateQuicCryptoServerStream(
|
|
65
|
-
const QuicCryptoServerConfig *crypto_config,
|
|
66
|
-
QuicCompressedCertsCache *compressed_certs_cache) override;
|
|
67
|
-
|
|
68
|
-
Http3ServerBackend *server_backend()
|
|
69
|
-
{
|
|
70
|
-
return http3_server_backend_;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
WebTransportHttp3VersionSet LocallySupportedWebTransportVersions()
|
|
74
|
-
const override
|
|
75
|
-
{
|
|
76
|
-
return http3_server_backend_->SupportsWebTransport()
|
|
77
|
-
? kDefaultSupportedWebTransportVersions
|
|
78
|
-
: WebTransportHttp3VersionSet();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
HttpDatagramSupport LocalHttpDatagramSupport() override
|
|
82
|
-
{
|
|
83
|
-
if (ShouldNegotiateWebTransport())
|
|
84
|
-
{
|
|
85
|
-
return HttpDatagramSupport::kRfcAndDraft04;
|
|
86
|
-
}
|
|
87
|
-
return QuicServerSessionBase::LocalHttpDatagramSupport();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
Http3ServerBackend *http3_server_backend_; // Not owned.
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
} // namespace quic
|
|
94
|
-
|
|
95
|
-
#endif // QUICHE_QUIC_TOOLS_QUIC_SIMPLE_SERVER_SESSION_H_
|