| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/home/SERVERWEB/webmin-2.105/vendor_perl/Protocol/WebSocket/Cookie/ |
Upload File : |
package Protocol::WebSocket::Cookie::Request;
use strict;
use warnings;
use base 'Protocol::WebSocket::Cookie';
sub parse {
my $self = shift;
$self->SUPER::parse(@_);
my $cookies = [];
my $version = 1;
if ($self->pairs->[0] eq '$Version') {
my $pair = shift @{$self->pairs};
$version = $pair->[1];
}
my $cookie;
foreach my $pair (@{$self->pairs}) {
next unless defined $pair->[0];
if ($pair->[0] =~ m/^[^\$]/) {
push @$cookies, $cookie if defined $cookie;
$cookie = $self->_build_cookie(
name => $pair->[0],
value => $pair->[1],
version => $version
);
}
elsif ($pair->[0] eq '$Path') {
$cookie->path($pair->[1]);
}
elsif ($pair->[0] eq '$Domain') {
$cookie->domain($pair->[1]);
}
}
push @$cookies, $cookie if defined $cookie;
return $cookies;
}
sub name { @_ > 1 ? $_[0]->{name} = $_[1] : $_[0]->{name} }
sub value { @_ > 1 ? $_[0]->{value} = $_[1] : $_[0]->{value} }
sub version { @_ > 1 ? $_[0]->{version} = $_[1] : $_[0]->{version} }
sub path { @_ > 1 ? $_[0]->{path} = $_[1] : $_[0]->{path} }
sub domain { @_ > 1 ? $_[0]->{domain} = $_[1] : $_[0]->{domain} }
sub _build_cookie { shift; Protocol::WebSocket::Cookie::Request->new(@_) }
1;
__END__
=head1 NAME
Protocol::WebSocket::Cookie::Request - WebSocket Cookie Request
=head1 SYNOPSIS
# Constructor
# Parser
my $cookie = Protocol::WebSocket::Cookie::Request->new;
$cookies = $cookie->parse(
'$Version=1; foo="bar"; $Path=/; bar=baz; $Domain=.example.com');
=head1 DESCRIPTION
Construct or parse a WebSocket request cookie.
=head1 ATTRIBUTES
=head2 C<name>
=head2 C<value>
=head2 C<version>
=head2 C<path>
=head2 C<domain>
=head1 METHODS
=head2 C<parse>
Parse a WebSocket request cookie.
=head2 C<to_string>
Construct a WebSocket request cookie.
=cut