/usr/share/perl5/HTTP/Body/UrlEncoded.pm is in libhttp-body-perl 1.22-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | package HTTP::Body::UrlEncoded;
$HTTP::Body::UrlEncoded::VERSION = '1.22';
use strict;
use base 'HTTP::Body';
use bytes;
our $DECODE = qr/%([0-9a-fA-F]{2})/;
our %hex_chr;
for my $num ( 0 .. 255 ) {
my $h = sprintf "%02X", $num;
$hex_chr{ lc $h } = $hex_chr{ uc $h } = chr $num;
}
=head1 NAME
HTTP::Body::UrlEncoded - HTTP Body UrlEncoded Parser
=head1 SYNOPSIS
use HTTP::Body::UrlEncoded;
=head1 DESCRIPTION
HTTP Body UrlEncoded Parser.
=head1 METHODS
=over 4
=item spin
=cut
sub spin {
my $self = shift;
return unless $self->length == $self->content_length;
# I tested parsing this using APR::Request, but perl is faster
# Pure-Perl 2560/s
# APR::Request 2305/s
# Note: s/// appears faster than tr///
$self->{buffer} =~ s/\+/ /g;
for my $pair ( split( /[&;](?:\s+)?/, $self->{buffer} ) ) {
my ( $name, $value ) = split( /=/, $pair , 2 );
next unless defined $name;
next unless defined $value;
$name =~ s/$DECODE/$hex_chr{$1}/gs;
$value =~ s/$DECODE/$hex_chr{$1}/gs;
$self->param( $name, $value );
}
$self->{buffer} = '';
$self->{state} = 'done';
}
=back
=head1 AUTHORS
Christian Hansen, C<ch@ngmedia.com>
Andy Grundman, C<andy@hybridized.org>
=head1 LICENSE
This library is free software . You can redistribute it and/or modify
it under the same terms as perl itself.
=cut
1;
|