You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Jo...@amat.com on 1999/10/08 22:01:36 UTC

Re: config/5091: Form handling: Upload = server error when no file is specified

Hi,

You can close this bug listing (5091).
This ended up being a CGI.pm issue.  I've identified it and fixed it, and sent
the following to Lstein@cshl.org (CGI.pm owner).

Thanks,
John

---------------
CGI.pm version 1.19 1999/08/31
Apache 1.3.6, Linux 2.2.5-15 (Redhat 6.0 distrib).  Perl 5.005
**********
Here's the bug:
I'm testing using a html & perl script pair of files that are commonly used
for file-upload.  They are publicly available on:
http://www.terminalp.com/scripts/file_upload.shtml

When a file is specified, it will succeed by uploading the file and displaying
the results page.

However, if the filename is left blank, there is a server error,
and the apache log file indicates "premature end of script headers."
*********
Here's the fix:
in line 2862 of CGI.pm, change
     unless (defined $filename) {
to
     unless (defined $filename & $filename gt "") {

This works.  Files are still uploaded, and it doesn't abort when a filename
isn't specified.
I only suspect that the problem was that the Netscape browser and/or Apache was
sending a filename that "existed", but was essentially NULL.