Hi all,

I'm trying to get file uploads working again in my modperl2 application (previously a modper1 application that worked like a charm).

Using Apache 2.0.49, Modperl 1.99_10, perl 5.8.1

I'm using the CVS version of libapreq2 (Apache::Request), because earlier versions (2.02 etc) gave a segmentation fault trying to access the Apache::Request->upload functions..

This is my handler:

#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
package ui::html::ToolHandler;


use strict;

use Apache2;
use Apache::Const qw(:common REDIRECT);
use Apache::RequestRec;


use Apache::Request;
use Apache::Cookie;


sub handler {
my $r = shift;
my $q = Apache::Request->new($r, TEMP_DIR => '/tmp');
my %cookies = Apache::Cookie->fetch($r);
my $sessionid = exists $cookies{'AGSESSIONID'} ? $cookies{'AGSESSIONID'}->value():"";


return OK if $r->header_only;


$r->content_type('text/html');
print(<<XXX);
<HTML>
<H1>Testing</H1>
<HR>
XXX
my %params = ();
foreach my $key (keys %{$q->param}) {
my @val = $q->param( $key );
print "param $key value ".join(',',@val)."<br>\n"; }


print "<HR>\n";


my @uploads = $q->upload;
print "uploaded fields '".join(',',@uploads)."'<br>\n";
my $upload = $q->upload('f_field_backupRestore');
if( $upload ) {
print("upload ".$upload->filename."\n");
}


       print(<<XXX);
<HR>
<FORM method="POST" enctype="multipart/form-data">
Field1 <INPUT type='text' name='textfield1'><BR>
Field2 <INPUT type='text' name='textfield2'><BR>
File <INPUT type='file' name='filefield'><BR>
<INPUT type="submit" value="Save"><BR>
</FORM>
</HTML>
XXX
       return OK;
}

1;
#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx

Rather Basic code in my opinion.

Runs well in NON HTTPS server ; gives me correct file and parameter contents; however when the same code is run in an HTTPS server it doesn't work at all; most of the time the parameters are empty or non present.

I have run a similar program using CGI under modperl2 and there it works correctly using HTTP or HTTPS .

This is that program:

#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

package ui::html::ToolHandler;
use strict;


use Apache2;
use Apache::Response;
use CGI;


sub handler
{
my $q = new CGI;


print $q->header,
$q->start_html('Upload test'),
$q->h1('Testing'),
$q->hr(),
$q->Dump();
print
$q->hr(),$q->start_pre();


if( my $fh = $q->upload('filefield')) {
while( <$fh> ) {
print ;
}
}


print
$q->end_pre(),$q->start_multipart_form(),
$q->textfield('field1'),$q->br(), $q->textfield('field2'),$q->br(),
$q->filefield('filefield'),$q->br(),
$q->submit('save','save'),$q->br(),
$q->end_html;
}


1;

#XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Is this a bug in Apache::Request or am I doing something terribly wrong here ?

regards

Bart

--
aXs GUARD has completed security and anti-virus checks on this e-mail
(http://www.axsguard.com)

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to