Return-Path: Delivered-To: apmail-httpd-apreq-dev-archive@www.apache.org Received: (qmail 81427 invoked from network); 30 Jul 2004 21:28:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Jul 2004 21:28:19 -0000 Received: (qmail 89406 invoked by uid 500); 30 Jul 2004 21:28:18 -0000 Delivered-To: apmail-httpd-apreq-dev-archive@httpd.apache.org Received: (qmail 89385 invoked by uid 500); 30 Jul 2004 21:28:18 -0000 Mailing-List: contact apreq-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list apreq-dev@httpd.apache.org Received: (qmail 89370 invoked by uid 99); 30 Jul 2004 21:28:18 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.27.1) with SMTP; Fri, 30 Jul 2004 14:28:16 -0700 Received: (qmail 23441 invoked by uid 65534); 30 Jul 2004 21:28:14 -0000 Received: from dsl-213-023-233-124.arcor-ip.net (EHLO [213.23.233.124]) (213.23.233.124) by mail.gmx.net (mp002) with SMTP; 30 Jul 2004 23:28:14 +0200 X-Authenticated: #20142289 Message-ID: <410ABD71.5070305@gmx.de> Date: Fri, 30 Jul 2004 23:28:17 +0200 From: Markus Wichitill User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707) X-Accept-Language: en, de MIME-Version: 1.0 To: Joe Schaefer CC: apreq-dev@httpd.apache.org Subject: Re: Problem use Apache::Upload References: <1091171298.4109f3e2f2210@webmail.vcsn.com> <410A38BD.7010207@gmx.de> <1091193034.410a48ca2ed08@webmail.vcsn.com> <410A4E0A.5000506@gmx.de> <1091195154.410a511229eea@webmail.vcsn.com> <410A5F6B.5080506@gmx.de> <87acxha49x.fsf@gemini.sunstarsys.com> <410A9CB1.8040702@gmx.de> <87hdrp8ei5.fsf@gemini.sunstarsys.com> In-Reply-To: <87hdrp8ei5.fsf@gemini.sunstarsys.com> X-Enigmail-Version: 0.84.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Joe Schaefer wrote: > Markus Wichitill writes: >>So is parse() still the recommended way of checking for upload errors? > > Yes, if you're really demanding a final status (versus a current one), > and you're not writing a content-handler. Well, my applications usually need all their parameters anyway, so I don't really see the point of delayed parsing. Also, if the input is too big, incomplete or otherwise corrupted, I want to exit early, since there's no point in working with incomplete or even corrupted data. This is what I currently do during initialization in mwForum, my CGI/mod_perl hybrid forum application (registry scripts using the mp1/mp2 API instead of CGI stuff when running under mod_perl): my $apr = Apache::Request->new($ap, POST_MAX => $cfg->{maxAttachLen}, TEMP_DIR => $cfg->{attachFsPath}, ); if ($ap->method eq 'GET') { $ap->discard_request_body() == 0 or error("discard_request_body() failed."); } elsif ($ap->method eq 'POST') { $apr->parse() == 0 or error("Input exceeds maximum allowed size or is corrupted."); } else { $ap->status(405); exit; } >>On Win32 however, posting a big upload > POST_MAX and then calling parse() to >>get the status will crash Apache. I can reproduce that by using a 4MB file in >>upload.t, setting POST_MAX=1MB and calling parse() in upload.pm. > > parse() in void context is supposed to croak in that case, but it > shouldn't ever crash the server (as a last resort mod_perl should > catch the exception, so eg. the tempfiles should still get cleaned up). > > Can you please show us, explicitly, what happens? Getting a stacktrace on Win32 would mean I have to swap my ASF and ActiveState binaries with self-compiled debug builds, which would take a while. So I had hoped that maybe Randy can reproduce the segfaults with a modified test, before I go to all the trouble. strace on Linux may show somewhat useful output even without debug builds, but on Windows I'v never seen anything useful in VC6 with release builds. Without a stacktrace, there isn't much to see: # Failed test 21 in t\apreq\upload.t at line 71 # testing : fh test for ff.exe # expected: # type: application/octet-stream # size: 4959023 # filename: ff.exe # md5: 65e0f588c3a8b44b0f575363995c1ff5 # received: 500 Unknown error not ok 21 # Failed test 22 in t\apreq\upload.t at line 71 fail #2 # testing : io test for ff.exe # expected: # type: application/octet-stream # size: 4959023 # filename: ff.exe # md5: 65e0f588c3a8b44b0f575363995c1ff5 # received: 500 Can't connect to localhost:8529 (connect: Unknown error) not ok 22 [...] [error] [client 127.0.0.1] (70022)There is no error, this value signifies an initialized error code: Content-Length header (4959211) exceeds configured max_body limit (1000000)