quicsilver 0.5.0-x86_64-linux

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 (107) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +49 -0
  3. data/.github/workflows/cibuildgem.yaml +117 -0
  4. data/.gitignore +21 -0
  5. data/.gitmodules +3 -0
  6. data/.ruby-version +1 -0
  7. data/CHANGELOG.md +175 -0
  8. data/Gemfile +6 -0
  9. data/Gemfile.lock +67 -0
  10. data/LICENSE +21 -0
  11. data/README.md +261 -0
  12. data/Rakefile +130 -0
  13. data/benchmarks/baseline.rb +175 -0
  14. data/benchmarks/compare.rb +398 -0
  15. data/benchmarks/components.rb +191 -0
  16. data/benchmarks/helpers.rb +162 -0
  17. data/benchmarks/latency.rb +128 -0
  18. data/benchmarks/loss.rb +193 -0
  19. data/benchmarks/mobile.rb +125 -0
  20. data/bin/console +14 -0
  21. data/bin/setup +8 -0
  22. data/docs/connection_identity.md +141 -0
  23. data/examples/README.md +58 -0
  24. data/examples/benchmark.rb +191 -0
  25. data/examples/connection_pool_demo.rb +47 -0
  26. data/examples/example_helper.rb +69 -0
  27. data/examples/falcon_middleware.rb +44 -0
  28. data/examples/feature_demo.rb +125 -0
  29. data/examples/grpc_style.rb +97 -0
  30. data/examples/latency_aware_routing.rb +382 -0
  31. data/examples/lifecycle_drain.rb +264 -0
  32. data/examples/minimal_http3_server.rb +14 -0
  33. data/examples/priorities.rb +60 -0
  34. data/examples/protocol_http_server.rb +31 -0
  35. data/examples/rack_http3_server.rb +42 -0
  36. data/examples/rails_feature_test.rb +280 -0
  37. data/examples/server_stats.rb +117 -0
  38. data/examples/simple_client_test.rb +26 -0
  39. data/examples/streaming_sse.rb +33 -0
  40. data/examples/trailers.rb +69 -0
  41. data/examples/webtransport_smoke.rb +546 -0
  42. data/examples/worker_load_balancing.rb +425 -0
  43. data/ext/quicsilver/extconf.rb +124 -0
  44. data/ext/quicsilver/include/msquic.h +2226 -0
  45. data/ext/quicsilver/include/msquic_posix.h +696 -0
  46. data/ext/quicsilver/include/quic_sal_stub.h +314 -0
  47. data/ext/quicsilver/msquic_patch.rb +68 -0
  48. data/ext/quicsilver/patches/reliable-reset.patch +723 -0
  49. data/ext/quicsilver/patches/stream-final-size.patch +47 -0
  50. data/ext/quicsilver/quicsilver.c +2741 -0
  51. data/lib/quicsilver/3.4/quicsilver.so +0 -0
  52. data/lib/quicsilver/4.0/quicsilver.so +0 -0
  53. data/lib/quicsilver/client/client.rb +708 -0
  54. data/lib/quicsilver/client/connection_pool.rb +202 -0
  55. data/lib/quicsilver/client/request.rb +190 -0
  56. data/lib/quicsilver/errors.rb +39 -0
  57. data/lib/quicsilver/libmsquic.so.2 +0 -0
  58. data/lib/quicsilver/protocol/adapter.rb +196 -0
  59. data/lib/quicsilver/protocol/capsule.rb +38 -0
  60. data/lib/quicsilver/protocol/connect_stream_decoder.rb +75 -0
  61. data/lib/quicsilver/protocol/control_stream_parser.rb +117 -0
  62. data/lib/quicsilver/protocol/datagram.rb +40 -0
  63. data/lib/quicsilver/protocol/frame_parser.rb +141 -0
  64. data/lib/quicsilver/protocol/frame_reader.rb +84 -0
  65. data/lib/quicsilver/protocol/frames.rb +454 -0
  66. data/lib/quicsilver/protocol/priority.rb +65 -0
  67. data/lib/quicsilver/protocol/qpack/decoder.rb +127 -0
  68. data/lib/quicsilver/protocol/qpack/encoder.rb +217 -0
  69. data/lib/quicsilver/protocol/qpack/header_block_decoder.rb +140 -0
  70. data/lib/quicsilver/protocol/qpack/huffman.rb +459 -0
  71. data/lib/quicsilver/protocol/request_encoder.rb +50 -0
  72. data/lib/quicsilver/protocol/request_parser.rb +289 -0
  73. data/lib/quicsilver/protocol/response_encoder.rb +107 -0
  74. data/lib/quicsilver/protocol/response_parser.rb +147 -0
  75. data/lib/quicsilver/protocol/stream_input.rb +98 -0
  76. data/lib/quicsilver/protocol/stream_output.rb +59 -0
  77. data/lib/quicsilver/protocol/unidirectional_stream.rb +12 -0
  78. data/lib/quicsilver/protocol/web_transport.rb +214 -0
  79. data/lib/quicsilver/rack/context.rb +33 -0
  80. data/lib/quicsilver/response.rb +40 -0
  81. data/lib/quicsilver/server/listener_data.rb +14 -0
  82. data/lib/quicsilver/server/rack_adapter.rb +77 -0
  83. data/lib/quicsilver/server/receive_queue.rb +106 -0
  84. data/lib/quicsilver/server/request_handler.rb +149 -0
  85. data/lib/quicsilver/server/request_registry.rb +63 -0
  86. data/lib/quicsilver/server/scheduler.rb +50 -0
  87. data/lib/quicsilver/server/schedulers/fiber_scheduler.rb +79 -0
  88. data/lib/quicsilver/server/schedulers/thread_scheduler.rb +76 -0
  89. data/lib/quicsilver/server/server.rb +1080 -0
  90. data/lib/quicsilver/server/web_transport_flow_control.rb +270 -0
  91. data/lib/quicsilver/server/web_transport_manager.rb +281 -0
  92. data/lib/quicsilver/server/web_transport_registry.rb +40 -0
  93. data/lib/quicsilver/server/web_transport_session.rb +812 -0
  94. data/lib/quicsilver/server/web_transport_stream.rb +326 -0
  95. data/lib/quicsilver/transport/configuration.rb +234 -0
  96. data/lib/quicsilver/transport/connection.rb +594 -0
  97. data/lib/quicsilver/transport/connection_stats.rb +53 -0
  98. data/lib/quicsilver/transport/event_loop.rb +74 -0
  99. data/lib/quicsilver/transport/inbound_stream.rb +53 -0
  100. data/lib/quicsilver/transport/stream.rb +43 -0
  101. data/lib/quicsilver/transport/stream_event.rb +49 -0
  102. data/lib/quicsilver/transport/stream_id.rb +26 -0
  103. data/lib/quicsilver/version.rb +3 -0
  104. data/lib/quicsilver.rb +96 -0
  105. data/lib/rackup/handler/quicsilver.rb +96 -0
  106. data/quicsilver.gemspec +66 -0
  107. metadata +362 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: acabdad46d9bdc4237db0eed1ee9e7317c8cbcc1b37cb40a0005c8b7a9972a6b
4
+ data.tar.gz: 5e8748f77b4f12dbaaf25aaffcf15267f82587eefe1c6c1beb7a1b3905218278
5
+ SHA512:
6
+ metadata.gz: b512cc4d0dc587a1cc990d42c3a42b90af94a6b42cac4cdd0c21a5f63780fc0bd0fc4236d36525377fec6691df106db2d1bb06db7a0c711d5d12b9be575bbfd2
7
+ data.tar.gz: e6d7942b7866ed5d84b2ba76198d8a9d624e1c2f287ea00f64d407385c18b67bec77cd416d4fafde0e9ca2128337d23fd6c5cf522fe644a638c175b0f91253a8
@@ -0,0 +1,49 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-24.04
23
+ continue-on-error: ${{ matrix.allow-failure }}
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ include:
28
+ - ruby-version: "3.4"
29
+ allow-failure: false
30
+ - ruby-version: "4.0"
31
+ allow-failure: false
32
+ - ruby-version: "head"
33
+ allow-failure: true
34
+
35
+ steps:
36
+ - uses: actions/checkout@v4
37
+ with:
38
+ submodules: recursive
39
+ - name: Set up Ruby
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: ${{ matrix.ruby-version }}
43
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44
+ - name: Build MSQUIC
45
+ run: bundle exec rake build_msquic
46
+ - name: Compile
47
+ run: bundle exec rake compile
48
+ - name: Run tests
49
+ run: bundle exec rake
@@ -0,0 +1,117 @@
1
+ name: "Package and release gems with precompiled binaries"
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ release:
6
+ description: "If the whole build passes on all platforms, release the gems on RubyGems.org"
7
+ required: false
8
+ type: boolean
9
+ default: false
10
+ env:
11
+ CIBUILDGEM: 1
12
+ RELEASE: "true"
13
+ jobs:
14
+ compile:
15
+ timeout-minutes: 20
16
+ name: "Cross compile the gem on different ruby versions"
17
+ strategy:
18
+ matrix:
19
+ os: ["macos-latest", "ubuntu-22.04"]
20
+ runs-on: "${{ matrix.os }}"
21
+ steps:
22
+ - name: "Checkout code"
23
+ uses: "actions/checkout@v5"
24
+ with:
25
+ submodules: recursive
26
+ - name: "Setup Ruby"
27
+ uses: "ruby/setup-ruby@v1"
28
+ with:
29
+ ruby-version: "3.4"
30
+ bundler-cache: true
31
+ - name: "Build MsQuic"
32
+ run: bundle exec rake build_msquic bundle_msquic
33
+ - name: "Verify bundled MsQuic"
34
+ run: |
35
+ ls -la lib/quicsilver
36
+ test -f lib/quicsilver/libmsquic.2.dylib || test -f lib/quicsilver/libmsquic.so.2
37
+ - name: "Verify package file list"
38
+ run: |
39
+ ruby -e 'puts "RELEASE=#{ENV["RELEASE"].inspect}"; spec = Gem::Specification.load("quicsilver.gemspec"); puts spec.files.grep(/libmsquic/)'
40
+ - name: "Run cibuildgem"
41
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
42
+ with:
43
+ step: "compile"
44
+ - name: "Upload staged artifacts with MsQuic"
45
+ uses: "actions/upload-artifact@v4"
46
+ with:
47
+ name: "stage-${{ runner.os }}-${{ runner.arch }}"
48
+ path: |
49
+ ./tmp/**/*.so
50
+ ./tmp/**/*.so.*
51
+ ./tmp/**/*.bundle
52
+ ./tmp/**/*.dylib
53
+ ./tmp/**/*.dylib.*
54
+ ./pkg/*.gem
55
+ if-no-files-found: error
56
+ retention-days: 1
57
+ overwrite: true
58
+ test:
59
+ timeout-minutes: 20
60
+ name: "Run the test suite"
61
+ needs: compile
62
+ strategy:
63
+ matrix:
64
+ os: ["macos-latest", "ubuntu-22.04"]
65
+ rubies: ["3.4", "4.0"]
66
+ type: ["cross"]
67
+ runs-on: "${{ matrix.os }}"
68
+ steps:
69
+ - name: "Checkout code"
70
+ uses: "actions/checkout@v5"
71
+ - name: "Setup Ruby"
72
+ uses: "ruby/setup-ruby@v1"
73
+ with:
74
+ ruby-version: "${{ matrix.rubies }}"
75
+ bundler-cache: true
76
+ - name: "Run cibuildgem"
77
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
78
+ with:
79
+ step: "test_${{ matrix.type }}"
80
+ install:
81
+ timeout-minutes: 5
82
+ name: "Verify the gem can be installed"
83
+ needs: test
84
+ strategy:
85
+ matrix:
86
+ os: ["macos-latest", "ubuntu-22.04"]
87
+ runs-on: "${{ matrix.os }}"
88
+ steps:
89
+ - name: "Setup Ruby"
90
+ uses: "ruby/setup-ruby@v1"
91
+ with:
92
+ ruby-version: "4.0.0"
93
+ - name: "Download platform gems"
94
+ uses: "actions/download-artifact@v5"
95
+ with:
96
+ name: "stage-${{ runner.os }}-${{ runner.arch }}"
97
+ - name: "Install platform gem"
98
+ run: ruby -e 'puts Dir["pkg/*-#{Gem::Platform.local}.gem"].fetch(0)' | xargs gem install
99
+ release:
100
+ environment: release
101
+ permissions:
102
+ id-token: write
103
+ contents: read
104
+ timeout-minutes: 5
105
+ if: ${{ inputs.release }}
106
+ name: "Release all gems with RubyGems"
107
+ needs: install
108
+ runs-on: "ubuntu-latest"
109
+ steps:
110
+ - name: "Setup Ruby"
111
+ uses: "ruby/setup-ruby@v1"
112
+ with:
113
+ ruby-version: "4.0.0"
114
+ - name: "Run cibuildgem"
115
+ uses: "shopify/cibuildgem/.github/actions/cibuildgem@main"
116
+ with:
117
+ step: "release"
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/*
10
+ /certs/*
11
+ /certificates/*
12
+ *.bundle
13
+ *.bundle.*
14
+ *.so
15
+ *.so.*
16
+ *.dylib
17
+ *.dylib.*
18
+ lib/quicsilver/quicsilver.bundle
19
+ *.gem
20
+ autoresearch.*
21
+ ext/quicsilver/Makefile
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "vendor/msquic"]
2
+ path = vendor/msquic
3
+ url = https://github.com/microsoft/msquic.git
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,175 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.5.0] - 2026-11-02
11
+
12
+ ### Added
13
+
14
+ - WebTransport session flow control (draft-ietf-webtrans-http3-16 §5): the `WT_MAX_DATA`, `WT_MAX_STREAMS`, `WT_DATA_BLOCKED` and `WT_STREAMS_BLOCKED` capsules, negotiation via `SETTINGS_WT_INITIAL_MAX_*`, enforcement of limits we advertise, spending of limits a peer grants, and proactive grants as the application consumes. `WebTransportStream#writable?` and `WebTransportSession#on_writable` report send credit. Prohibited per-stream capsules fail the session. §5.1 requires both endpoints to advertise a non-zero initial limit; browsers tested do not, so sessions with them run without it and remain limited to one per connection.
15
+
16
+ - `Transport::StreamEvent#final_size` reports how many bytes the peer sent on a stream the peer reset, from the RESET_STREAM frame (RFC 9000 §4.5); `nil` when the final size is not settled. WebTransport session flow control needs it to charge the bytes a reset discarded (draft-ietf-webtrans-http3-16 §5.4). MsQuic keeps the value but does not expose it, so it is read through a new vendored patch, `ext/quicsilver/patches/stream-final-size.patch`.
17
+ - Shared connection multiplexing — single QUIC connection serves all threads concurrently (5x faster: 16,000 req/s vs 3,175 req/s exclusive). Default pool mode.
18
+ - `TransportError` base class with MsQuic status code parsing — typed errors instead of string-matching RuntimeError from C extension
19
+ - `StreamFailedToOpenError` wraps `StreamOpen`/`StreamStart` failures with parsed hex status
20
+ - Stream flow control visibility — `QUIC_STREAM_START_FLAG_INDICATE_PEER_ACCEPT` dispatches `STREAM_START_COMPLETE` and `STREAM_PEER_ACCEPTED` events to Ruby
21
+ - H3 Datagram support (RFC 9221/9297) — `client.datagram_send`, `server.datagram_send`, `on_datagram` callbacks, `SETTINGS_H3_DATAGRAM` advertised
22
+ - Client priority support — send `priority` header with extensible priorities (RFC 9218)
23
+ - Client request body streaming — `build_request('POST', path, body: :stream)` with `Request#stream_body`
24
+ - Client response body streaming — `request.streaming_response` returns headers immediately, body arrives incrementally
25
+ - Per-request timeout support
26
+ - Connection pool blocks with timeout (ConditionVariable) instead of raising immediately when full
27
+ - Response unification — single response representation across buffered and streaming paths
28
+ - Multi-threaded benchmarks
29
+
30
+ ### Fixed
31
+
32
+ - Repeated response headers are sent as separate fields. They were flattened into a Hash keyed by name, which kept only the last value; a Rails response setting a session cookie alongside any other lost the session, so sign-in succeeded and the next request arrived unauthenticated. `set-cookie` MUST NOT be combined (RFC 9110 §5.3).
33
+ - WebTransport rejects the `WT_MAX_STREAM_DATA` and `WT_STREAM_DATA_BLOCKED` capsules. Per-stream data limits belong to the HTTP/2 binding; over HTTP/3 each WebTransport stream is a QUIC stream with its own limits, so receipt is a session error carrying `WT_FLOW_CONTROL_ERROR` (draft-ietf-webtrans-http3-16 §5.4). They were previously ignored as unknown capsule types. Unknown types are still ignored.
34
+ - WebTransport CLOSE and DRAIN capsules use HTTP/3 DATA frames. Session close sends FIN, validates peer close payloads, and terminates both directions on protocol errors.
35
+ - WT_STREAM (`0x41`) is rejected with the connection error `H3_FRAME_ERROR` when it appears anywhere other than the first bytes of a request stream, including on the control stream (draft-ietf-webtrans-http3-16 §4.3). It is only a signal value at the front of a WebTransport stream, never a frame elsewhere.
36
+ - WebTransport capsules sent optimistically on the CONNECT stream are no longer processed before the server responds. They are held unparsed, then processed once `accept!` sends the 2xx or discarded if the session is rejected (§3.2). The hold is bounded at 64 KiB; exceeding it fails the session with `H3_MESSAGE_ERROR`. Previously a CLOSE capsule arriving before the application responded would terminate the session and make it unacceptable.
37
+ - Release GVL during `wait_for_connection` — no longer blocks all Ruby threads during handshake
38
+ - Stream cleanup after response sent — `Connection#@streams` entries removed on completion, not just on connection close
39
+ - Error hierarchy — `FrameError`, `MessageError`, `StreamFailedToOpenError` all inherit from `Quicsilver::Error`
40
+ - Large response crash and concurrent connection race condition
41
+ - Rack adapter owns early hints and trailer wiring (removed from server)
42
+
43
+ ### Changed
44
+
45
+ - MsQuic callbacks no longer call into Ruby. The poll thread runs the whole MsQuic iteration with the GVL released and queues events; a dispatcher thread delivers them to `Server.handle_stream` in order. `Quicsilver.defer_stream_receive` and `Transport::Stream#defer_receive` are removed: delivery is asynchronous, so a receive cannot be handed back to MsQuic, and a method that always declined would be indistinguishable from one that declined this time. With `receive_backpressure: true`, the one WebTransport receive that can arrive before the first credit grant is delivered whole and may exceed `receive_buffer_bytes`; it is bounded by the initial QUIC stream window instead (RFC 9000 §4.1), and no credit is granted until the reader drains below the limit. Previously the excess was deferred. Credit bounds every receive after that as before. Each connection may have at most 128 datagrams queued ahead of the dispatcher (quic-go's figure); past that the oldest is dropped, as RFC 9221 §5.3 permits and as quiche and neqo do. `Server#stats["datagrams"]["dropped"]` counts drops across connections. `receive_buffer_bytes` was never a bound on what a single `read` returns.
46
+ - `Quicsilver.send_stream` no longer copies the body. The Ruby String is frozen and MsQuic sends from its bytes directly, with the String retained until the send completes. Callers that went on mutating a buffer after sending it must `dup` first; nothing in the library did. Large responses gain about 4% on server-side time; small ones are unchanged. The poll thread's idle spin before sleeping is now configurable via `QUICSILVER_POLL_IDLE_US` (default 0, the previous behaviour); it measured as having no effect under load and is exposed for low-concurrency latency-sensitive deployments to evaluate.
47
+ - WebTransport child streams have bounded receive queues, and a child that fills its buffer now pauses instead of losing its stream. `accept!` takes `receive_buffer_bytes` (default 1 MiB), `receive_buffer_chunks` (default 1024), `receive_overflow_code` and `receive_backpressure` (default `true`); delivery stops until the application reads. A reader that never drains leaves its stream paused indefinitely, and a paused stream holds connection credit, so it can stall its siblings. `receive_backpressure: false` restores the previous policy: an overflowing child is sent `STOP_SENDING` with `receive_overflow_code`, its queued input is discarded and its pending reads fail, while its write side stays open. Limits apply to each child's queued Ruby input, not to native buffers or the whole connection. `WebTransportStream#initialize` now requires these four options rather than defaulting them, so the defaults have a single home in `WebTransportSession::DEFAULT_RECEIVE_OPTIONS`.
48
+ - WebTransport stream resets are directional. `RESET_STREAM` closes only the read side and invokes the new `on_peer_reset`; `STOP_SENDING` closes only the write side and invokes the new `on_peer_stop_sending`. `on_close` fires once both directions are closed. Previously either signal tore down the whole stream and both reported through `on_reset`, which is removed — the `peer_` prefix distinguishes these inbound events from the outbound `reset` and `abort` methods.
49
+ - WebTransport CONNECT waits for peer SETTINGS before reaching Rack, including when headers arrive with FIN. The `webtransport-h3` token requires `WT_ENABLED=1` and `H3_DATAGRAM=1`; the legacy `webtransport` token requires `H3_DATAGRAM=1`. Waiting is limited to one CONNECT and 64 KiB of body data per connection, with cleanup on cancellation or connection closure.
50
+ - WebTransport permits one active session per QUIC connection until session flow control is implemented. Additional CONNECT requests are rejected with `H3_REQUEST_REJECTED`; closing a session allows another. SETTINGS no longer advertise session flow-control credit, and the legacy session limit is one.
51
+ - WebTransport `close(code:, reason:)` rejects invalid UTF-8 and codes outside the unsigned 32-bit range before changing session state. Valid UTF-8 binary strings remain supported; long valid reasons are truncated at a UTF-8 character boundary.
52
+ - Connection pool default mode is `:shared` (multiplexed) — `:exclusive` available as opt-in
53
+ - `open_stream` wraps C extension errors into typed `StreamFailedToOpenError` / `TransportError`
54
+ - MsQuic submodule updated from v2.5.0 to v2.5.7
55
+ - Uni stream default documented: 10 (3 required by HTTP/3, headroom for GREASE and extensions)
56
+ - Scheduler base class extracted for extensibility
57
+
58
+ ## [0.4.0] - 2026-04-25
59
+
60
+ ### Added
61
+ - Client connection pool with automatic reuse (`Quicsilver::Client.get/post` class-level API)
62
+ - GREASE support (RFC 9297) — settings, frames, and unidirectional streams
63
+ - GOAWAY validation (RFC 9114 §7.2.6) — monotonically decreasing IDs, stream ID validation
64
+ - Trailer support (RFC 9114 §4.1) — parse and send trailing HEADERS frames
65
+ - Extensible Priorities (RFC 9218) — parse `priority` header, PRIORITY_UPDATE frames on control stream, MsQuic stream priority mapping
66
+ - FrameParser base class — unified frame walking, ordering, body accumulation, size limits
67
+ - FrameReader module — shared byte-level frame extraction for request/response/control streams
68
+ - Trailer wiring in Adapter and StreamOutput for protocol-http integration
69
+ - Informational 1xx responses (§4.1) — 103 Early Hints with `rack.early_hints` support for Rails
70
+ - Two-phase GOAWAY shutdown (§5.2) — server sends decreasing GOAWAY IDs during graceful shutdown
71
+ - Client processes server SETTINGS (§7.2.4) — parses peer's SETTINGS including MAX_FIELD_SECTION_SIZE
72
+ - Client processes server GOAWAY (§5.2) — tracks peer_goaway_id, blocks new requests, connection pool evicts draining connections
73
+ - MIT license in gemspec
74
+
75
+ ### Fixed
76
+ - QPACK prefix decoding — decode Required Insert Count and Delta Base as varints instead of hardcoded `offset = 2`
77
+ - Default decoder rejects payloads referencing the dynamic table
78
+ - Response parser now enforces `max_frame_payload_size` (was missing)
79
+ - Duplicate `frames` method in FrameParser
80
+ - Consistent `@headers` and `@trailers` initialization (`{}` not `nil`)
81
+ - extconf.rb — force Apple clang on macOS (Homebrew clang produces broken MsQuic binaries)
82
+
83
+ ### Changed
84
+ - RequestParser and ResponseParser inherit from FrameParser (reduced ~230 lines of duplication)
85
+ - `store_header`, `body`, `DEFAULT_DECODER`, `EMPTY_BODY`, `parse!` moved to FrameParser base class
86
+ - `@body_io` renamed to `@body` in ResponseParser for consistency
87
+ - ResponseEncoder accepts optional `trailers:` hash
88
+ - StreamOutput accepts `send_fin:` parameter for trailer support
89
+
90
+ ## [0.3.0] - 2026-03-23
91
+
92
+ ### Added
93
+ - QPACK Huffman coding with 8-bit decode table and encode/decode caching
94
+ - 0-RTT replay protection for unsafe HTTP methods
95
+ - Bounded backpressure support
96
+ - Buffer size limits to prevent memory exhaustion (configurable `max_body_size`, `max_header_size`, `max_header_count`, `max_frame_payload_size`)
97
+ - Content-length validation
98
+ - Multi-value header support for duplicate header fields
99
+ - Headers validation: reject connection-specific headers, require `:authority` or `host` for http/https schemes
100
+ - Incremental unidirectional stream processing with critical stream protection
101
+ - QPACK encoder and decoder stream instruction validation
102
+ - Spec-correct error signaling with error codes on `FrameError` and `MessageError`
103
+ - Suppress response body for HEAD requests per RFC 9114 §4.1
104
+ - Allow `te: trailers` header in requests per RFC 9114 §4.2
105
+ - Custom ALPN support (no longer hardcoded to `h3`)
106
+ - `Stream` and `StreamEvent` abstractions to encapsulate C extension details
107
+ - Dual-stack (IPv4/IPv6) listener support — fixes TLS handshake failures on macOS
108
+ - Client `PUT` method
109
+ - Integration test suite for curl HTTP/3
110
+
111
+ ### Fixed
112
+ - Memory leaks: free `StreamContext` on `SHUTDOWN_COMPLETE`, free `ConnectionContext` on `CONNECTION_SHUTDOWN_COMPLETE`, close `EventQ`/`ExecContext`/`WakeFd` on shutdown
113
+ - Double-free and handle leaks in C extension
114
+ - `dispatch_to_ruby` safety with `rb_protect`; client use-after-free fix
115
+ - Infinite loop on truncated varint in request/response parsers
116
+ - Frame ordering: `DATA` before `HEADERS` now raises `FrameError`
117
+ - `STOP_SENDING` / `STREAM_RESET` compliance — server properly cancels streams and resets send side
118
+ - Control stream validation: reject duplicate settings, forbidden frame types, and reserved HTTP/2 types
119
+ - QPACK static table index 57/58 casing (`includeSubDomains`)
120
+ - Stale stream handle guard in cancel and C extension
121
+ - Replaced `Thread.kill` with `Thread.raise(DrainTimeoutError)` for clean drain
122
+ - Binary encoding for `buffer_data` and empty FIN handling
123
+ - Linux/GitHub CI: use epoll instead of kqueue on non-Darwin platforms
124
+ - Circular require warning
125
+
126
+ ### Changed
127
+ - Reorganized gem structure: `protocol/`, `server/`, `transport/` directories
128
+ - Server owns the 0-RTT policy
129
+ - QPACK encoder uses O(1) static table lookup with multi-level caching
130
+ - QPACK decoder uses string-based decoding with result caching
131
+ - HTTP/3 parsers optimized with parse-level caching and lazy allocation
132
+ - Varint encoding/decoding optimized with precomputed tables
133
+ - HTTP/3 encoders handle framing only; QPACK handles field encoding (cleaner separation)
134
+ - MsQuic custom execution mode with configurable worker pool and throughput settings
135
+
136
+ ### Limitations
137
+ - Client does not reuse connections
138
+
139
+ ## [0.2.0] - 2025-12-17
140
+
141
+ ### Added
142
+ - Graceful shutdown with GOAWAY frames (RFC 9114 compliant)
143
+ - Streaming response support for lazy/chunked bodies
144
+ - Flow control settings for backpressure management
145
+ - Client HTTP verb helpers: `get`, `post`, `patch`, `delete`, `head`
146
+ - Integration test suite
147
+ - Benchmarking examples for Rails
148
+
149
+ ### Fixed
150
+ - Memory leak: send buffers now freed on SEND_COMPLETE callback
151
+ - Segfault in event loop when client_obj was invalid
152
+ - Content-Type header handling for Rack compatibility
153
+ - String concatenation performance using StringIO
154
+
155
+ ### Changed
156
+ - `server.start` now blocks until shutdown (no separate `wait_for_connections` needed)
157
+ - Refactored to global event loop architecture
158
+ - Simplified server internals with Connection and QuicStream classes
159
+ - Replaced debug puts with proper logging
160
+
161
+ ### Limitations
162
+ - No server push or trailer support
163
+ - No dynamic QPACK table (static table only)
164
+ - Client does not reuse connections
165
+
166
+ ## [0.1.0] - 2025-10-28
167
+
168
+ ### Added
169
+ - Initial HTTP/3 server implementation using Microsoft MSQUIC
170
+ - HTTP/3 client for testing and development
171
+ - Rack support
172
+ - HTTP/3 frame encoding/decoding (DATA, HEADERS, SETTINGS)
173
+ - QPACK header compression (static table support)
174
+ - Bidirectional request/response streams
175
+ - Request body buffering for large payloads
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in quicsilver.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,67 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ quicsilver (0.5.0)
5
+ console
6
+ localhost (~> 1.6)
7
+ logger
8
+ protocol-http (~> 0.49)
9
+ protocol-rack (~> 0.22)
10
+ rack (~> 3.0)
11
+ rackup (~> 2.0)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ benchmark-ips (2.14.0)
17
+ cibuildgem (0.3.0)
18
+ prism
19
+ rake-compiler
20
+ thor
21
+ console (1.34.3)
22
+ fiber-annotation
23
+ fiber-local (~> 1.1)
24
+ json
25
+ fiber-annotation (0.2.0)
26
+ fiber-local (1.1.0)
27
+ fiber-storage
28
+ fiber-storage (1.0.1)
29
+ io-stream (0.11.1)
30
+ json (2.15.2)
31
+ localhost (1.6.0)
32
+ logger (1.7.0)
33
+ minitest (5.27.0)
34
+ minitest-focus (1.4.0)
35
+ minitest (>= 4, < 6)
36
+ prism (1.9.0)
37
+ protocol-http (0.60.0)
38
+ protocol-rack (0.22.1)
39
+ io-stream (>= 0.10)
40
+ protocol-http (~> 0.58)
41
+ rack (>= 1.0)
42
+ rack (3.2.4)
43
+ rackup (2.2.1)
44
+ rack (>= 3)
45
+ rake (13.4.2)
46
+ rake-compiler (1.3.0)
47
+ rake
48
+ rake-compiler-dock (1.9.1)
49
+ thor (1.5.0)
50
+
51
+ PLATFORMS
52
+ arm64-darwin-23
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ benchmark-ips (~> 2.12)
57
+ bundler (~> 2.0)
58
+ cibuildgem
59
+ minitest (~> 5.0)
60
+ minitest-focus (~> 1.3)
61
+ quicsilver!
62
+ rake (~> 13.0)
63
+ rake-compiler (~> 1.2)
64
+ rake-compiler-dock (~> 1.3)
65
+
66
+ BUNDLED WITH
67
+ 2.6.5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Haroon Ahmed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.