httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Mueller" <r...@fastmail.fm>
Subject Missing submit button if after a file field
Date Thu, 08 Apr 2004 21:25:07 GMT
I'm seeing an odd problem with libapreq 1.3 (mod_perl2 just isn't quite
mature enough yet...) and buttons on a form with file upload fields.
Basically it seems that a browser that submits the button field immediately
after a file upload field on a form, the button value disappears from the
params() result in libapreq. It's probably best to show what's going on with
an example:

I put this in my usual conf/perl.conf setup...

<Location /test>
  SetHandler perl-script
  PerlHandler main::test
<Perl>
package main;
use Apache::Request;
use Data::Dumper;
sub test {
  my $R = shift;

#  my $R = Apache::Request->new($R);
#  $Status = $R->parse;
#  my %Params = map { $_ => $R->param($_) } $R->param;
#  warn Dumper(\%Params);

   chomp($_ = <STDIN>);
   while ($_) { warn "$_\n"; chomp($_ = <STDIN>); }

  $R->content_type('text/html');
  $R->send_http_header;

  print <<'EOF';
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html> <head> <title>Test</title> </head> <body>
<form method="post" action="http://localhost:8080/test/"
enctype="multipart/form-data">
<input type="submit" name="somename" value="Click"><br>
<input type="file" name="FMC-UploadFile1" size="20"><br>
<input type="submit" name="somename" value="Click"><br>
</form> </body> </html>
EOF

  return Apache::OK;
}
</Perl>
</Location>


If I click the first button, in the log I see:

------------jZLJfj7sG9kLeKXzCBVikO7gXcwytA8ahRtMA1FQAxjmGHkSSF9AbEp
Content-Disposition: form-data; name="somename"

Click
------------jZLJfj7sG9kLeKXzCBVikO7gXcwytA8ahRtMA1FQAxjmGHkSSF9AbEp
Content-Disposition: form-data; name="FMC-UploadFile1"; filename=""

------------jZLJfj7sG9kLeKXzCBVikO7gXcwytA8ahRtMA1FQAxjmGHkSSF9AbEp--

No problem. If I click the second button, in the log I see:

------------bQaJLMV8JU2DxyhdPfNYApBF5BDgYSk7tIRCewKvOK6LInxiTKEb8Pq
Content-Disposition: form-data; name="FMC-UploadFile1"; filename=""

------------bQaJLMV8JU2DxyhdPfNYApBF5BDgYSk7tIRCewKvOK6LInxiTKEb8Pq
Content-Disposition: form-data; name="somename"

Click
------------bQaJLMV8JU2DxyhdPfNYApBF5BDgYSk7tIRCewKvOK6LInxiTKEb8Pq--

Also apparently no problem, the actual data is there. Ok, now if I change
the code so that it uses libapreq to parse the params instead for just
"warning" them out to the log (just uncomment the commented out lines above,
and comment out the 'while' line beneath them). If I click the first button,
I see:

$VAR1 = {
  'somename' => 'Click',
  'FMC-UploadFile1' => ''
};

Which is good. But if I click the second button I see:

$VAR1 = {
  'FMC-UploadFile1' => ''
};

Ah, the button has disappeared!

To be honest, I haven't dug through the spec to see if buttons are supposed
to come before other fields, but as far as I can tell, this problem only
happens if the button field is submitted by the browser immediately after a
file field, and at the moment the only browser I've seen do that is
Konquerer.

Anybody know what's broken here? Is it libapreq? Is it Konquerer?

Rob



Mime
View raw message