| 1 | 1 | ▶ | use v5.40; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use experimental 'signatures'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use PAGI::Nano; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | # Ports PAGI's 08-tls-introspection to PAGI::Nano. | ||||||||||
| 6 | # A handler can read connection metadata the server puts on the scope: the | ||||||||||
| 7 | # scheme, client address, and — when the server terminates TLS — the TLS | ||||||||||
| 8 | # extension info (protocol version, cipher, client cert). No TLS -> tls is null. | ||||||||||
| 9 | # | ||||||||||
| 10 | # pagi-server app.pl | ||||||||||
| 11 | # curl http://127.0.0.1:5000/conninfo | ||||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | my $app = app { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
| |||||||||||
| 14 | 1 | ▶ | get '/conninfo' => sub ($c) { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 15 | 1 | my $tls = $c->scope->{extensions}{tls}; | |||||||||
| 16 | { | ||||||||||
| 17 | scheme => $c->scheme, | ||||||||||
| 18 | client => $c->client, | ||||||||||
| 19 | tls => $tls | ||||||||||
| 20 | ? { version => $tls->{version}, cipher => $tls->{cipher} } | ||||||||||
| 21 | : undef, | ||||||||||
| 22 | 1 | ▶ | }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 1 | }; | |||||||||
| 24 | 1 | }; | |||||||||
| 25 | |||||||||||
| 26 | 1 | $app; | |||||||||