examples/connection-introspection/app.pl

filter: Statementstmt 100% 13 / 13 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 95.0% 19 / 20 CC 2 SCAR 3.0
CC
2
Cov
93%
__ANON__
2.1
__ANON__
1.0
BEGIN
1.0
CRAP 1.4
« examples/streaming-response/app.pl ↑ Summary examples/sse-broadcaster/app.pl »
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
BranchTrueFalseTotal
$tls ? : 0 1 1
23 1 };
24 1 };
25  
26 1 $app;
« examples/streaming-response/app.pl ↑ Summary examples/sse-broadcaster/app.pl »