Skip to content

Commit b2031d1

Browse files
committed
Add test for % encoding in hostname
1 parent 4ad0966 commit b2031d1

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Revision history for HTTP-Daemon
22

33
{{$NEXT}}
4+
- An IPv6 zone separator must be URI-quoted (GH#47) (Petr Pisar and Olaf
5+
Alders)
46

57
6.10 2020-05-26 16:20:36Z
68
- No changes since TRIAL release 6.09

t/encoding.t

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
6+
use HTTP::Daemon ();
7+
use Socket qw( AF_INET6 );
8+
9+
{
10+
no warnings 'redefine';
11+
local *IO::Socket::sockdomain = sub { return Socket::AF_INET6 };
12+
local *IO::Socket::IP::sockhost
13+
= sub { return q{fe80::250:54ff:fe00:f01%ens3} };
14+
15+
my $d = HTTP::Daemon->new;
16+
is($d->sockhost, q{fe80::250:54ff:fe00:f01%ens3}, 'we overrode sockhost');
17+
is($d->sockdomain, Socket::AF_INET6, 'we overrode sockdomain');
18+
19+
like(
20+
$d->url,
21+
qr{\Q[fe80::250:54ff:fe00:f01%25ens3]\E},
22+
'% is encoded in host'
23+
);
24+
25+
}
26+
27+
done_testing;

0 commit comments

Comments
 (0)