Hello Bryan,

On Apr 24, 2008, at 10:59 PM, [EMAIL PROTECTED] wrote:
I have a Perl file upload script I'd been using for years under Apache 1 in Tiger. I haven't modified it in ages. No mod_perl, just CGI.pm and the default Perl installation. It's always worked fine for files of any size (some as many as a gigabyte and taking more than an hour to upload), but since upgrading to Leopard, with its Apache2 nonsense,

Um, apache2 rocks. It has a much better configuration layout, particularly for virtual hosts, and is a more secure web server. Once you get used to it you'll agree.

the script fails on large files -- anything over a megabyte -- with this being output to the browser:

"CGI.pm: Server closed socket during multipart read (client aborted?).".

This is the only error message logged, too. I've tested this with multiple clients on different operating systems and it's the same every time, unless the file's smaller than 1MB, in which case the script executes as it should. I added a debugging line to the upload hook that runs when I first create my CGI query object, and it reports the bytes increasing up to a point, after which it keeps logging these messages but the number of bytes stays static. It's never the exact same number but the files always seem to fail above 1 megabyte, with about 1.4 being the upper limit I've seen so far.

Any ideas? Thanks

Well I know that CGI.pm has tools to limit the size of uploads, or more specifically tools for controlling uploaded files as they get spooled to disk, but it appears that you did not change those settings so I am not sure if that is your problem or not. Here are some things you can add to your perl script to get more information:

Use Carp, diagnostics, and warnings, if you haven't already:

use warnings
use diagnostics
use CGI::Carp 'fatalsToBrowser'

That last use directive, (the one for CGI::Carp), will print warnings to your browser which may help if you chose to diagnose the problem with a browser. You'd probably want to turn that off once the problem is solved, it reveals juicy information about the cgi environment.

You can change the type and amount of messages your error log receives in the httpd.conf file for your specific domain - I think the default is "warn", but you can set higher levels which might give you some more info, look for this stanza:

        ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

Set it to info or debug for more info on errors. apache2 does not use httpd.conf anymore, at least on other operating systems, but Apple has decided in their infinite wisdom to fork apache2 and they bundle configuration in httpd.conf. Bad Apple. So you will have to look in / etc/apachce2/httpd.conf to find if there are any settings there that are limiting your uploads, though a cursory check of my httpd.conf file under Leopard shows nothing that might point to limits on uploads, but as I mentioned, Apple takes liberties with apache so you never know. :)

Hope that helps,
                
        Jeremiah

Reply via email to