Skip to content

Add ALPN, SNI, and negotiated protocol version support - #113

Merged
timo merged 2 commits into
raku-community-modules:mainfrom
keatumal:add-alpn-and-version-info
Aug 1, 2026
Merged

Add ALPN, SNI, and negotiated protocol version support#113
timo merged 2 commits into
raku-community-modules:mainfrom
keatumal:add-alpn-and-version-info

Conversation

@keatumal

Copy link
Copy Markdown

This PR:

  • adds ALPN support
  • adds methods for retrieving the negotiated protocol version
  • adds SNI host name support
  • includes small documentation updates

I used the following snippet for manual testing:

use OpenSSL;

my @hosts = <raku.org apple.com>;

for @hosts -> $host {
    say "--> $host";
    my $conn = IO::Socket::INET.new: :$host, :port(443);
    my $openssl = OpenSSL.new: :client;
    $openssl.set-fd: $conn.native-descriptor;
    $openssl.set-sni-host-name: $host;
    $openssl.set-alpn-protocols('h2', 'http/1.1');
    $openssl.connect;
    say '  version-code: ' ~ sprintf('0x%X', $openssl.version-code);
    say '  version-name: ' ~ $openssl.version-name;
    say '  protocol-version: ' ~ $openssl.protocol-version;
    say '  selected-alpn: ' ~ $openssl.selected-alpn;
    $conn.close;
}

On my Linux machine this prints:

--> raku.org
  version-code: 0x304
  version-name: TLSv1.3
  protocol-version: 1.3
  selected-alpn: h2
--> apple.com
  version-code: 0x304
  version-name: TLSv1.3
  protocol-version: 1.3
  selected-alpn: http/1.1

@lizmat
lizmat requested review from MasterDuke17, sergot and ugexe April 22, 2026 15:09
@keatumal

keatumal commented May 2, 2026

Copy link
Copy Markdown
Author

I added online integration tests in xt/ and a small helper module for them.
The tests compare negotiated TLS version and ALPN with curl.

@timo timo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Flin added 2 commits August 1, 2026 18:12
- add methods for setting SNI and ALPN on client connections
- add methods for retrieving negotiated protocol version info
- update ProtocolVersion to include 1.3
- refresh documentation and client usage examples
- add reusable test helpers for finding programs and probing curl output
- add online integration tests for negotiated TLS version and ALPN
@timo
timo force-pushed the add-alpn-and-version-info branch from f334b54 to b1f8bc4 Compare August 1, 2026 16:12
@timo
timo merged commit f912c1b into raku-community-modules:main Aug 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants