Hi,

I have a weird problem with a CGI file upload form. When I have no proxy set
I can upload files of any size with no problem but when I set my proxy I can
only upload files under 1 megabyte. This happens with both IE5.5 and
Netscape 4.77. In my proxy config I have these lines:

acl QUERY urlpath_regex cgi-bin \? .pl .asp
no_cache deny QUERY

Which should stop any issues with caching, and this is a pretty standard
config for squid. Here is what gets logged by the proxy when I upload a
file:

/var/log/squid/access.log
1011909823.494    202 192.168.69.201 NONE/413 1327 POST
http://192.168.69.202/cgi-bin/manuxfiles.pl - NONE/- -
1011909824.915   1156 192.168.69.201 TCP_MISS/500 748 POST
http://192.168.69.202/cgi-bin/manuxfiles.pl - DIRECT/192.168.69.202
text/html

/var/log/apache/access.log
192.168.69.2 - - [23/Jan/2002:22:44:20 +1300] "POST /cgi-bin/manuxfiles.pl
HTTP/1.0" 500 524

/var/log/apache/error.log
Malformed multipart POST
[Wed Jan 23 22:44:20 2002] [error] [client 192.168.69.2] Premature end of
script
 headers: /usr/lib/cgi-bin/manuxfiles.pl

and when I have no proxy configured:

/var/log/apache/access.log
192.168.69.201 - - [23/Jan/2002:22:48:59 +1300] "POST /cgi-bin/manuxfiles.pl
HTTP/1.1" 200 273

I see one difference between the Apache access log and that is the HTTP
protcol version, why would that be?

Here is my perl for the file upload (most of this is irrelevant):

if ($q->param('submit_upload')) {

        my $package = $q->param('package');
        my $version = $q->param('version');
        my $type = $q->param('type');
        my $status = $q->param('status');
        my $platform  = $q->param('platform');
        my $multiuser = $q->param('multiuser');
        my $staffid = $q->param('staffid');
        my $file = $q->param('file');
        my $description = $q->param('description');

        my $tmp_file = $q->tmpFileName($file);

        $file =~ s/.*\\//og;

        $staffid = uc($staffid);

        if (copy($tmp_file, "$upload_dir$file")) {
                print $q->br, "Upload successful";
                my $filestats = stat($tmp_file);
                my $filesize = $filestats->size;
                my $st_handle = $db_handle->prepare(
                        "insert into files values (
                                '$package',
                                '$version',
                                '$type',
                                '$status',
                                '$platform',
                                '$multiuser',
                                NULL,
                                NULL,
                                '$staffid',
                                '$file',
                                '$filesize',
                                '$description',
                                NULL)");
                $st_handle->execute;
                $st_handle->finish();
        } else {
                print $q->br, "Upload failed : $! : $file";
        }

}






Bjorn Nilsen
Manux Solutions Ltd



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to