quic 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE-DEPENDENCIES.txt +2 -2
- data/README.md +1 -1
- data/ext/quic/connection_common.c +12 -4
- data/ext/quic/connection_common.h +8 -0
- data/ext/quic/ext_api.c +7 -5
- data/ext/quic/extconf.rb +5 -5
- data/ext/quic/include/quic/ext.h +22 -1
- data/lib/quic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd02d782aebbc1128a0fca8bda34bc2651b5d677e682d126ab0575b332b4f556
|
|
4
|
+
data.tar.gz: 9a5155a1b4f75a342d7476895641e5b2e06a6f7d5e99b4bd6f1830c90e747cda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f94809c98904f20281edbc702f57db0c0014e53243fb2d478e02c1c54870fb205bad185aadf3ab319d4f2294484aca46cf58b72f4d5a486138584426cd513808
|
|
7
|
+
data.tar.gz: d1f7925f594bc307201a295aed815084000da0e0c2a057dc6ad403d587888b42ae4a478a5d4949603a5d5d70f3c51b9cc2fa1224d1783956c9b2330743e2e467
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [0.0.6] - 2026-11-03
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
- `quic/ext.h` is ABI 1.1: a stream handler's new `recv_stop_sending` is called as soon as the peer's STOP_SENDING arrives, instead of the handler learning of it when the stream closes. Handlers built for ABI 1.0 keep working. ([#23](https://github.com/unasuke/quic-ruby/pull/23))
|
|
5
|
+
|
|
6
|
+
### Changed
|
|
7
|
+
- ngtcp2 is now built from 1.26.0 (was 1.25.0), and picotls from `a2d95de`, the revision ngtcp2 1.26.0 is tested against. ([#24](https://github.com/unasuke/quic-ruby/pull/24))
|
|
8
|
+
|
|
1
9
|
## [0.0.5] - 2026-10-24
|
|
2
10
|
|
|
3
11
|
### Fixed
|
data/LICENSE-DEPENDENCIES.txt
CHANGED
|
@@ -9,7 +9,7 @@ bundled nor redistributed. The quic gem itself is MIT licensed; see
|
|
|
9
9
|
LICENSE.txt.
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
ngtcp2 1.
|
|
12
|
+
ngtcp2 1.26.0 -- https://github.com/ngtcp2/ngtcp2
|
|
13
13
|
-------------------------------------------------
|
|
14
14
|
|
|
15
15
|
The MIT License
|
|
@@ -53,7 +53,7 @@ the statically linked libngtcp2 and are covered by their own terms:
|
|
|
53
53
|
COPYING text above.
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
picotls
|
|
56
|
+
picotls a2d95de -- https://github.com/h2o/picotls
|
|
57
57
|
-------------------------------------------------
|
|
58
58
|
|
|
59
59
|
picotls has no top-level license file; the terms are stated in the header of
|
data/README.md
CHANGED
|
@@ -147,7 +147,7 @@ It applies to clients, `Connection::Server.accept` and every connection of an En
|
|
|
147
147
|
|
|
148
148
|
### From other native extensions
|
|
149
149
|
|
|
150
|
-
Another native extension can drive a connection's streams from C instead of through `QUIC::Stream`, as the [http3](https://github.com/unasuke/http3-ruby) gem does. `quic/ext.h` declares the function table (ABI 1.0), and `QUIC::EXT_INCLUDE_DIR` tells an `extconf.rb` where it is:
|
|
150
|
+
Another native extension can drive a connection's streams from C instead of through `QUIC::Stream`, as the [http3](https://github.com/unasuke/http3-ruby) gem does. `quic/ext.h` declares the function table (ABI 1.1; a stream handler built against ABI 1.0 keeps working), and `QUIC::EXT_INCLUDE_DIR` tells an `extconf.rb` where it is:
|
|
151
151
|
|
|
152
152
|
```ruby
|
|
153
153
|
require "mkmf"
|
|
@@ -653,16 +653,24 @@ static VALUE quic_recv_stop_sending_body(VALUE arg) {
|
|
|
653
653
|
}
|
|
654
654
|
|
|
655
655
|
/* The peer sent STOP_SENDING. ngtcp2 shuts the send side and sends
|
|
656
|
-
RESET_STREAM itself once this returns. A stream handler
|
|
657
|
-
|
|
656
|
+
RESET_STREAM itself once this returns. A stream handler hears of it here
|
|
657
|
+
(recv_stop_sending). One built against ABI 1.0 lacks that member, and
|
|
658
|
+
learns of it only when #write_pkt finds the send side shut
|
|
659
|
+
(stream_shut_write) or the stream closes. */
|
|
658
660
|
static int quic_recv_stop_sending_cb(ngtcp2_conn *conn, int64_t stream_id,
|
|
659
661
|
uint64_t app_error_code, void *user_data,
|
|
660
662
|
void *stream_user_data) {
|
|
661
663
|
(void)conn;
|
|
662
664
|
(void)stream_user_data;
|
|
663
665
|
quic_conn_t *c = (quic_conn_t *)user_data;
|
|
664
|
-
if (c->handler)
|
|
665
|
-
|
|
666
|
+
if (c->handler) {
|
|
667
|
+
if (!QUIC_EXT_HANDLER_HAS(c->handler, recv_stop_sending))
|
|
668
|
+
return 0;
|
|
669
|
+
return c->handler->recv_stop_sending(c->handler_ud, stream_id,
|
|
670
|
+
app_error_code) < 0
|
|
671
|
+
? NGTCP2_ERR_CALLBACK_FAILURE
|
|
672
|
+
: 0;
|
|
673
|
+
}
|
|
666
674
|
struct quic_stream_cb_args a = {
|
|
667
675
|
.c = c, .stream_id = stream_id, .app_error_code = app_error_code};
|
|
668
676
|
return quic_conn_protect(c, quic_recv_stop_sending_body, &a);
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
minimum destlen ngtcp2 accepts. Revisit when PMTUD is enabled (Phase 4+). */
|
|
15
15
|
#define QUIC_WRITE_PKT_BUFLEN NGTCP2_MAX_UDP_PAYLOAD_SIZE
|
|
16
16
|
|
|
17
|
+
/* Whether the stream handler h has member, judged by the size it was built
|
|
18
|
+
with: a handler built against an older quic/ext.h is shorter, and its
|
|
19
|
+
memory ends before the members added since. Compared with the end of the
|
|
20
|
+
member, not the start of the next one, so trailing padding does not
|
|
21
|
+
count. */
|
|
22
|
+
#define QUIC_EXT_HANDLER_HAS(h, member) \
|
|
23
|
+
((h)->size >= offsetof(quic_ext_stream_handler, member) + sizeof((h)->member))
|
|
24
|
+
|
|
17
25
|
/* A QUIC::Endpoint (endpoint.c). */
|
|
18
26
|
typedef struct quic_endpoint quic_endpoint_t;
|
|
19
27
|
|
data/ext/quic/ext_api.c
CHANGED
|
@@ -15,14 +15,16 @@ static quic_ext_conn *quic_ext_conn_get(VALUE conn) {
|
|
|
15
15
|
|
|
16
16
|
/* Hand every stream of the connection to h. Allowed once, and only before
|
|
17
17
|
the connection has a QUIC::Stream: the two modes cannot share streams.
|
|
18
|
-
Every member of the ABI 1.0 handler is called, so h must
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
Every member of the ABI 1.0 handler is called, so h must hold them all
|
|
19
|
+
(handshake_completed is the last). A handler built against an older
|
|
20
|
+
quic/ext.h than this one is shorter than sizeof(quic_ext_stream_handler),
|
|
21
|
+
and is called only for the members its size covers. @stream_handler marks
|
|
22
|
+
the connection for the Ruby side, which then refuses #accept_stream. */
|
|
21
23
|
static int quic_ext_set_stream_handler(quic_ext_conn *ec,
|
|
22
24
|
const quic_ext_stream_handler *h,
|
|
23
25
|
void *ud, VALUE owner) {
|
|
24
26
|
quic_conn_t *c = quic_ext_conn_struct(ec);
|
|
25
|
-
if (h == NULL || h
|
|
27
|
+
if (h == NULL || !QUIC_EXT_HANDLER_HAS(h, handshake_completed))
|
|
26
28
|
return QUIC_EXT_ERR_OTHER;
|
|
27
29
|
if (c->handler != NULL)
|
|
28
30
|
return QUIC_EXT_ERR_INVALID_STATE;
|
|
@@ -93,7 +95,7 @@ static int quic_ext_set_application_error(quic_ext_conn *ec,
|
|
|
93
95
|
|
|
94
96
|
const quic_ext_api quic_ext_api_table = {
|
|
95
97
|
.abi_major = QUIC_EXT_ABI_MAJOR,
|
|
96
|
-
.abi_minor =
|
|
98
|
+
.abi_minor = QUIC_EXT_ABI_MINOR,
|
|
97
99
|
.size = sizeof(quic_ext_api),
|
|
98
100
|
.conn_get = quic_ext_conn_get,
|
|
99
101
|
.set_stream_handler = quic_ext_set_stream_handler,
|
data/ext/quic/extconf.rb
CHANGED
|
@@ -5,11 +5,11 @@ require "mini_portile2"
|
|
|
5
5
|
require "shellwords"
|
|
6
6
|
require "fileutils"
|
|
7
7
|
|
|
8
|
-
NGTCP2_VERSION = "1.
|
|
9
|
-
NGTCP2_SHA256 = "
|
|
10
|
-
# The picotls revision that ngtcp2 1.
|
|
11
|
-
PICOTLS_COMMIT = "
|
|
12
|
-
PICOTLS_SHA256 = "
|
|
8
|
+
NGTCP2_VERSION = "1.26.0"
|
|
9
|
+
NGTCP2_SHA256 = "85174d674e7f8fd911a827c6e483fd417b21b1f54d7853dac464cee446c8d35f"
|
|
10
|
+
# The picotls revision that ngtcp2 1.26.0 is tested against (see ngtcp2's README).
|
|
11
|
+
PICOTLS_COMMIT = "a2d95de4c875d6dcb27658e476e3b624f4381bf0"
|
|
12
|
+
PICOTLS_SHA256 = "d54263601c4652ef28451533bb2e2fae3f5f44aff54338cf5110b9c12c4bab3a"
|
|
13
13
|
# Bump when ext/quic/patches/picotls/ or PicotlsRecipe::SOURCES changes;
|
|
14
14
|
# installed? only checks for the archive.
|
|
15
15
|
PICOTLS_PATCH_LEVEL = "p2"
|
data/ext/quic/include/quic/ext.h
CHANGED
|
@@ -14,7 +14,13 @@
|
|
|
14
14
|
* the table's. The structs below grow only by appending, which bumps
|
|
15
15
|
* abi_minor; reordering, removing or retyping a member bumps abi_major.
|
|
16
16
|
* Check `size` before calling a member added after the version you were
|
|
17
|
-
* built against. The handler struct follows the same rules
|
|
17
|
+
* built against. The handler struct follows the same rules:
|
|
18
|
+
* set_stream_handler takes any handler at least as large as the ABI 1.0
|
|
19
|
+
* one, and quic.so calls a member added later only when the handler's
|
|
20
|
+
* `size` covers it. Every member `size` covers must be non-NULL.
|
|
21
|
+
* A member added after ABI 1.0 is marked with the minor that brought it
|
|
22
|
+
* (abi_minor N), and quic.so calls a handler member only when the table's
|
|
23
|
+
* abi_minor is at least that N: an older quic.so leaves it uncalled.
|
|
18
24
|
* - Exceptions: no function in the table and no handler function raises a
|
|
19
25
|
* Ruby exception; they return 0 or a negative error code. The one
|
|
20
26
|
* exception is conn_get, which raises TypeError for a wrong object and is
|
|
@@ -37,6 +43,8 @@
|
|
|
37
43
|
#include <stdint.h>
|
|
38
44
|
|
|
39
45
|
#define QUIC_EXT_ABI_MAJOR 1
|
|
46
|
+
/* The abi_minor of the structs as this header declares them. */
|
|
47
|
+
#define QUIC_EXT_ABI_MINOR 1
|
|
40
48
|
|
|
41
49
|
#define QUIC_EXT_ERR_INVALID_STATE (-1)
|
|
42
50
|
#define QUIC_EXT_ERR_STREAM_ID_BLOCKED (-2)
|
|
@@ -67,6 +75,19 @@ typedef struct {
|
|
|
67
75
|
int (*stream_close)(void *ud, int64_t id, int has_code,
|
|
68
76
|
uint64_t app_error_code);
|
|
69
77
|
int (*handshake_completed)(void *ud);
|
|
78
|
+
/* abi_minor 1 */
|
|
79
|
+
/* The peer sent STOP_SENDING on stream id, which this endpoint sends on
|
|
80
|
+
(stream_stop_sending is the other way: this endpoint stopped reading).
|
|
81
|
+
Called once per stream. Once it returns 0, ngtcp2 shuts the send side
|
|
82
|
+
and sends RESET_STREAM carrying app_error_code, unless all that was
|
|
83
|
+
sent, FIN included, has been acknowledged. next_stream_data should no
|
|
84
|
+
longer offer the stream; if it does, stream_shut_write follows. It can
|
|
85
|
+
come before any recv_stream_data, for a stream the peer has just
|
|
86
|
+
opened, and also comes for a unidirectional stream this endpoint
|
|
87
|
+
opened. stream_close may follow within the same #read_pkt. Calling
|
|
88
|
+
shutdown_stream_write here sends RESET_STREAM with that code instead,
|
|
89
|
+
but stream_close still reports app_error_code. */
|
|
90
|
+
int (*recv_stop_sending)(void *ud, int64_t id, uint64_t app_error_code);
|
|
70
91
|
} quic_ext_stream_handler;
|
|
71
92
|
|
|
72
93
|
typedef struct {
|
data/lib/quic/version.rb
CHANGED