Skip to content

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

Open
keatumal wants to merge 2 commits into
raku-community-modules:mainfrom
keatumal:add-alpn-and-version-info
Open

Add ALPN, SNI, and negotiated protocol version support#113
keatumal wants to merge 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

- 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
@lizmat lizmat requested review from MasterDuke17, sergot and ugexe April 22, 2026 15:09
- add reusable test helpers for finding programs and probing curl output
- add online integration tests for negotiated TLS version and ALPN
@keatumal
Copy link
Copy Markdown
Author

keatumal commented May 2, 2026

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

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.

1 participant