diff --git a/dist.ini b/dist.ini index 89ce8bc..5780ab6 100644 --- a/dist.ini +++ b/dist.ini @@ -142,6 +142,7 @@ stopword = Miyagawa stopword = OIDs stopword = OpenLDAP stopword = Punycode +stopword = WebSocket stopword = relativize stopword = Tatsuhiko stopword = TCP diff --git a/lib/URI.pm b/lib/URI.pm index 0c76701..840b7fc 100644 --- a/lib/URI.pm +++ b/lib/URI.pm @@ -1223,6 +1223,18 @@ separated by dots. A C object belonging to this namespace has an additional method called $uri->oid that can be used to get/set the oid value. In a list context, oid numbers are returned as separate elements. +=item B: + +The URI scheme is specified in L. +The C Protocol enables two-way communication between a client +running untrusted code in a controlled environment to a remote host +that has opted-in to communications from that code. + +=item B: + +The I URI scheme is specified in L as well. +The scheme is used to reference C servers through SSL connections. + =back =head1 CONFIGURATION VARIABLES diff --git a/lib/URI/ws.pm b/lib/URI/ws.pm new file mode 100644 index 0000000..b1af91f --- /dev/null +++ b/lib/URI/ws.pm @@ -0,0 +1,71 @@ +package URI::ws; + +use strict; +use warnings; + +our $VERSION = '5.33'; + +use parent 'URI::http'; + +1; +__END__ + +=head1 NAME + +URI::ws - URI scheme for WebSocket Identifiers + +=head1 VERSION + +Version 5.20 + +=head1 SYNOPSIS + + use URI::ws; + + my $uri = URI->new('ws://example.com/'); + +=head1 DESCRIPTION + +This module implements the C URI scheme defined in L. + +=head1 SUBROUTINES/METHODS + +This module inherits the behaviour of L. + +=head1 DIAGNOSTICS + +See L + +=head1 CONFIGURATION AND ENVIRONMENT + +See L and L + +=head1 DEPENDENCIES + +None + +=head1 INCOMPATIBILITIES + +None reported + +=head1 BUGS AND LIMITATIONS + +See L + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +David Dick, C<< >> + +=head1 LICENSE AND COPYRIGHT + +Copyright 2016 David Dick. + +This program is free software; you can redistribute it and/or modify it +under the terms of either: the GNU General Public License as published +by the Free Software Foundation; or the Artistic License. + +See L for more information. diff --git a/lib/URI/wss.pm b/lib/URI/wss.pm new file mode 100644 index 0000000..7e2d228 --- /dev/null +++ b/lib/URI/wss.pm @@ -0,0 +1,71 @@ +package URI::wss; + +use strict; +use warnings; + +our $VERSION = '5.33'; + +use parent 'URI::https'; + +1; +__END__ + +=head1 NAME + +URI::wss - URI scheme for WebSocket Identifiers + +=head1 VERSION + +Version 5.20 + +=head1 SYNOPSIS + + use URI::wss; + + my $uri = URI->new('wss://example.com/'); + +=head1 DESCRIPTION + +This module implements the C URI scheme defined in L. + +=head1 SUBROUTINES/METHODS + +This module inherits the behaviour of L. + +=head1 DIAGNOSTICS + +See L + +=head1 CONFIGURATION AND ENVIRONMENT + +See L and L + +=head1 DEPENDENCIES + +None + +=head1 INCOMPATIBILITIES + +None reported + +=head1 BUGS AND LIMITATIONS + +See L + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +David Dick, C<< >> + +=head1 LICENSE AND COPYRIGHT + +Copyright 2016 David Dick. + +This program is free software; you can redistribute it and/or modify it +under the terms of either: the GNU General Public License as published +by the Free Software Foundation; or the Artistic License. + +See L for more information. diff --git a/t/ws.t b/t/ws.t new file mode 100644 index 0000000..e111953 --- /dev/null +++ b/t/ws.t @@ -0,0 +1,50 @@ +use strict; +use warnings; + +use Test::More tests => 16; + +use URI (); + +my $u = URI->new(""); + +#print "$u\n"; +is($u, "ws://www.example.com/path?q=f%F4o"); + +is($u->port, 80); + +# play with port +my $old = $u->port(8080); +ok($old == 80 && $u eq "ws://www.example.com:8080/path?q=f%F4o"); + +$u->port(80); +is($u, "ws://www.example.com:80/path?q=f%F4o"); + +$u->port(""); +ok($u eq "ws://www.example.com:/path?q=f%F4o" && $u->port == 80); + +$u->port(undef); +is($u, "ws://www.example.com/path?q=f%F4o"); + +my @q = $u->query_form; +is_deeply(\@q, ["q", "fôo"]); + +$u->query_form(foo => "bar", bar => "baz"); +is($u->query, "foo=bar&bar=baz"); + +is($u->host, "www.example.com"); + +is($u->path, "/path"); + +ok(!$u->secure); + +$u->scheme("wss"); +is($u->port, 443); + +is($u, "wss://www.example.com/path?foo=bar&bar=baz"); + +ok($u->secure); + +$u = URI->new("ws://%65%78%61%6d%70%6c%65%2e%63%6f%6d/%70%75%62/%61/%32%30%30%31/%30%38/%32%37/%62%6a%6f%72%6e%73%74%61%64%2e%68%74%6d%6c"); +is($u->canonical, "ws://example.com/pub/a/2001/08/27/bjornstad.html"); + +ok($u->has_recognized_scheme);