HTTP-XSHeaders
view release on metacpan or search on metacpan
lib/HTTP/XSHeaders.pm view on Meta::CPAN
($old) = $self->header($header, HTTP::Date::time2str($time));
} else {
($old) = $self->header($header);
}
$old =~ s/;.*// if defined($old);
HTTP::Date::str2time($old);
}
sub content_type {
my $self = shift;
my $ct = $self->header('content-type');
$self->header('content-type', shift) if @_;
$ct = $ct->[0] if ref($ct) eq 'ARRAY';
return '' unless defined($ct) && length($ct);
my @ct = split( /;\s*/, $ct, 2 );
for ( $ct[0] ) {
s/\s+//g;
$_ = lc($_);
}
wantarray ? @ct : $ct[0];
}
lib/HTTP/XSHeaders.pm view on Meta::CPAN
for my $arr (@res) {
for (my $i = @$arr - 2; $i >= 0; $i -= 2) {
$arr->[$i] = lc($arr->[$i]);
}
}
return @res;
}
sub content_type_charset {
my $self = shift;
my $h = $self->header('content-type');
$h = $h->[0] if ref($h);
$h = "" unless defined $h;
my @v = _split_header_words($h);
if (@v) {
my($ct, undef, %ct_param) = @{$v[0]};
my $charset = $ct_param{charset};
if ($ct) {
$ct = lc($ct);
$ct =~ s/\s+//;
}
( run in 2.926 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )