APR-HTTP-Headers-Compat
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/APR/HTTP/Headers/Compat.pm view on Meta::CPAN
This will remove all the header fields used to describe the content of a
message. All header field names prefixed with Content- falls into this
category, as well as Allow, Expires and Last-Modified. RFC 2616 denote
these fields as Entity Header Fields.
The return value is a new C<HTTP::Headers> object that contains the
removed headers only. Note that the returned object is I<not> an
C<APR::HTTP::Headers::Compat>.
=cut
sub remove_content_headers {
my $self = shift;
return $self->SUPER::remove_content_headers( @_ )
unless defined wantarray;
# This gets nasty. We downbless ourself to be an HTTP::Headers so that
# when HTTP::Headers->remove_content_headers does
#
# my $c = ref( $self )->new
#
# it creates a new HTTP::Headers instead of attempting to create a
# new APR::HTTP::Headers::Compat.
my $class = ref $self;
bless $self, 'HTTP::Headers';
# Calls SUPER::remove_content_headers due to rebless
my $other = $self->remove_content_headers( @_ );
bless $self, $class;
# Return a non-magic HTTP::Headers
return $other;
}
1;
__END__
=head1 CAVEATS
Because the underlying storage for the headers is an C<APR::Table>
attempts to store an object (such as a L<URI> instance) in the table
will not behave as expected.
I haven't benchmarked but it's certain that this implementation will be
substantially slower than C<HTTP::Headers>.
=head1 DEPENDENCIES
L<APR::Pool>, L<APR::Table>, L<HTTP::Headers>, L<Storable>, L<Test::More>
=head1 SEE ALSO
L<FirePHP::Dispatcher>
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
Please report any bugs or feature requests to
C<bug-apr-http-headers-compat@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Andy Armstrong C<< <andy@hexten.net> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2009, Andy Armstrong C<< <andy@hexten.net> >>.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.406 second using v1.00-cache-2.02-grep-82fe00e-cpan-dad7e4baca0 )