X-Git-Url: http://git.shiar.nl/perl/plp/.git/blobdiff_plain/0f5e78a789961923b45cae1a881c655fff9e7283..972d413021a3b834599c46ea8a05ae4c0e023029:/PLP/Fields.pm?ds=sidebyside diff --git a/PLP/Fields.pm b/PLP/Fields.pm index 9945511..14d30b6 100644 --- a/PLP/Fields.pm +++ b/PLP/Fields.pm @@ -10,14 +10,18 @@ PLP::Script. Also generates %cookie immediately. PLP::Fields::doit(); +This module is part of the PLP internals. Don't use it yourself. + =cut sub doit { tie %PLP::Script::get, 'PLP::Tie::Delay', 'PLP::Script::get', sub { my %get; - if ($ENV{QUERY_STRING} ne ''){ - for (split /[&;]/, $ENV{QUERY_STRING}) { - my @keyval = split /=/; + my $get; + $get = $ENV{QUERY_STRING}; + if ($get ne ''){ + for (split /[&;]/, $get) { + my @keyval = split /=/, $_, 2; PLP::Functions::DecodeURI(@keyval); $get{$keyval[0]} = $keyval[1] unless $keyval[0] =~ /^\@/; push @{ $get{'@' . $keyval[0]} }, $keyval[1]; @@ -28,11 +32,16 @@ sub doit { tie %PLP::Script::post, 'PLP::Tie::Delay', 'PLP::Script::post', sub { my %post; - our $post = ; + my $post; + if ($ENV{MOD_PERL}) { + $post = Apache->request->content; + } else { + read(*STDIN, $post, $ENV{CONTENT_LENGTH}); + } if (defined($post) && $post ne '' && ($ENV{CONTENT_TYPE} eq '' || $ENV{CONTENT_TYPE} eq 'application/x-www-form-urlencoded')){ - for (split /[&;]/, $post) { - my @keyval = split /=/; + for (split /&/, $post) { + my @keyval = split /=/, $_, 2; PLP::Functions::DecodeURI(@keyval); $post{$keyval[0]} = $keyval[1] unless $keyval[0] =~ /^\@/; push @{ $post{'@' . $keyval[0]} }, $keyval[1]; @@ -50,7 +59,7 @@ sub doit { if (defined($ENV{HTTP_COOKIE}) && $ENV{HTTP_COOKIE} ne ''){ for (split /; ?/, $ENV{HTTP_COOKIE}) { - my @keyval = split /=/; + my @keyval = split /=/, $_, 2; $PLP::Script::cookie{$keyval[0]} ||= $keyval[1]; } }