server: add rustls_server_config_builder_set_send_tls13_tickets#653
Merged
Conversation
djc
reviewed
Jul 13, 2026
cpu
reviewed
Jul 13, 2026
cpu
left a comment
Member
There was a problem hiding this comment.
Can you squash your commits as well? Thanks
mattrobenolt
force-pushed
the
set-num-tickets
branch
from
July 13, 2026 15:07
68a2afb to
e0a4c3d
Compare
Contributor
Author
|
Thanks @djc @cpu. Pushed an update addressing all the feedback:
|
mattrobenolt
force-pushed
the
set-num-tickets
branch
from
July 13, 2026 15:12
e0a4c3d to
c0a324a
Compare
djc
approved these changes
Jul 13, 2026
cpu
reviewed
Jul 13, 2026
mattrobenolt
force-pushed
the
set-num-tickets
branch
from
July 13, 2026 18:00
c0a324a to
4d2de3c
Compare
Expose ServerConfig::send_tls13_tickets via the C API so callers can control how many TLS 1.3 NewSessionTicket messages the server sends after a full handshake (rustls default is 2). Setting 0 disables ticket issuance. This lets benchmark harnesses driving rustls through the FFI measure a clean full handshake without NewSessionTicket issuance cost, making the handshake row equivalent to OpenSSL/rustls-Rust-API peers. rustls upstream established the ticket-issuance cost is a measurable benchmarking hazard (PR #2187: ~2% of a full handshake server-side at the default of 2), and both OpenSSL and the rustls Rust API expose a knob to suppress it — rustls-ffi was the one path that couldn't. Closes rustls#652
mattrobenolt
force-pushed
the
set-num-tickets
branch
from
July 13, 2026 18:00
4d2de3c to
831186e
Compare
Contributor
Author
|
Pushed another update (831186e) addressing the latest feedback:
Also renamed the test function to match and confirmed the header still regenerates cleanly with cbindgen. |
cpu
enabled auto-merge (rebase)
July 13, 2026 18:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #652.
Note
This PR was AI generated using GLM 5.2.
What
Adds
rustls_server_config_builder_set_num_tickets(builder, n)to exposeServerConfig::send_tls13_ticketsthrough the C API. Mirrors the existingrustls_server_config_builder_set_ignore_client_orderpattern: a newOption<usize>field onServerConfigBuilder, a setter, and application atbuild()time. Defaults toNone(rustls's own default of 2 applies), so this is a strictly additive, no-behavior-change-by-default feature.Why
For TLS-library performance comparison benchmarks, NewSessionTicket issuance after a full handshake is a measurable distortion. rustls upstream established this in PR #2187 ("server: default send_tls13_tickets 4 -> 2"):
Both peer libraries expose a knob to suppress this:
SSL_CTX_set_num_tickets(ctx, 0)server.send_tls13_tickets = 0rustls-ffi was the one path that couldn't, so a C/Zig/Python benchmark driving rustls through the FFI could not get a handshake measurement equivalent to its peers — the rustls-ffi handshake row measured "handshake + 2 NewSessionTicket issuance" while peers measured "handshake only." The workaround of building a fresh config per connection prevents resumption (client offering PSK) but not ticket issuance (server still generates and sends the tickets).
Changes
librustls/src/server.rs:send_tls13_tickets: Option<usize>field onServerConfigBuilder(initNonein both_newand_new_custom),rustls_server_config_builder_set_num_ticketssetter, applied inrustls_server_config_builder_build. Testtest_server_config_builder_set_num_ticketscovering both0and a non-zero value.librustls/src/rustls.h: vendored header declaration.Verification
cargo test --no-default-features --features ring --locked— 35 passed (incl. new test)cargo fmt --check— cleancargo clippy --no-default-features --features ring --all-targets -- -D warnings -A unknown-lints— no warnings in changed code(No
cargo-c/capi build run locally; the C examples need cmake which isn't in my env. The header change is a straightforward declaration mirroringset_ignore_client_order.)Notes
send_tls13_ticketsis TLS 1.3 only in rustls).set_num_ticketsmirrors OpenSSL'sSSL_CTX_set_num_ticketsfor discoverability.