Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

Apache2::Request appears to not capture the full POST:ed value

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


lund.linus at gmail

Oct 9, 2011, 1:31 PM

Post #1 of 3 (390 views)
Permalink
Apache2::Request appears to not capture the full POST:ed value

I have encountered a problem that I have been unable to solve using
documentation/google. I'm running mod_perl 2 / (strawberry) perl
5.10.1 / Apache 2.2.20 on a Windows XP machine where I need to collect
data POSTed from a hardware (the Box) that I have no control over. The
Box is suppose to POST a semi colon separated list of data using a
field called value. I'm using Apache2::Request to parse the POST, but
it only captures the first part of the field (up until the first semi
colon).

My perl script looks like this;
sub handler {
    my $r=shift;
    my $req = Apache2::Request->new($r);
    $input = $req->param('value');
    warn "INPUT is $input";
    return Apache2::Const::OK;
}

And this is what I see in my logs;
[Sun Oct 09 22:08:20 2011] [notice] mod_dumpio:  dumpio_in
(data-HEAP): value=f1;2011-10-09;21:25:40;14;0;;0;0;3;1
[....]
INPUT is f1 at [...]

My thoughts on the problem is that it relates to URL encoding, as when
I send a direct query to the script it only fetches the whole part
when I encode the semi-colons. I have however not found a way to e.g.
mod_rewrite the POST content.
Any thoughts that could aid me?
THanks


aw at ice-sa

Oct 10, 2011, 2:11 PM

Post #2 of 3 (368 views)
Permalink
Re: Apache2::Request appears to not capture the full POST:ed value [In reply to]

Linus Lund wrote:
> I have encountered a problem that I have been unable to solve using
> documentation/google. I'm running mod_perl 2 / (strawberry) perl
> 5.10.1 / Apache 2.2.20 on a Windows XP machine where I need to collect
> data POSTed from a hardware (the Box) that I have no control over. The
> Box is suppose to POST a semi colon separated list of data using a
> field called value. I'm using Apache2::Request to parse the POST, but
> it only captures the first part of the field (up until the first semi
> colon).
>
> My perl script looks like this;
> sub handler {
> my $r=shift;
> my $req = Apache2::Request->new($r);
> $input = $req->param('value');
> warn "INPUT is $input";
> return Apache2::Const::OK;
> }
>
> And this is what I see in my logs;
> [Sun Oct 09 22:08:20 2011] [notice] mod_dumpio: dumpio_in
> (data-HEAP): value=f1;2011-10-09;21:25:40;14;0;;0;0;3;1
> [....]
> INPUT is f1 at [...]
>
> My thoughts on the problem is that it relates to URL encoding, as when
> I send a direct query to the script it only fetches the whole part
> when I encode the semi-colons. I have however not found a way to e.g.
> mod_rewrite the POST content.
> Any thoughts that could aid me?
> THanks
>

I believe that at some point, a bare semi-colon was/is considered as an alternative to
"&", to separate post parameters.
So with the query string above, you probably have one parameter named "value" with a value
of "f1", then another parameter named "2011-10-09" with value null, then a parameter named
"21" with value null, etc...

There might be an option to Apache::Request to avoid this.


jmccarre at akamai

Oct 10, 2011, 3:43 PM

Post #3 of 3 (377 views)
Permalink
Re: Apache2::Request appears to not capture the full POST:ed value [In reply to]

Andre is correct. Semi-colon is a valid query string separator,
in addition to ampersand &.
HTTP 1.x being so widely deployed, it is very hard to change the spec.
So supporting semi-colon is a W3C recommendation.

C.f. http://en.wikipedia.org/wiki/Query_string

-- jeff

On 10/10/11 2:11 PM, "André Warnier" <aw [at] ice-sa> wrote:

>I believe that at some point, a bare semi-colon was/is considered as an
>alternative to
>"&", to separate post parameters.
>

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.