[Israel.pm] Apache/mod_perl help

Scott Weisman sweisman at pobox.com
Mon Nov 14 17:11:29 PST 2005


Hello,

I'm not sure who to turn to for help on this and hope someone on this
list might have an answer.

I have a web site using Apache2/mod_perl2 (the Apache version string
is "Apache/2.0.55 (Unix) mod_apreq2-20050712/2.1.3-dev mod_perl/2.0.2
Perl/v5.8.3").

A while ago, and I don't remember how long ago, but it was probably
within the last 4 months, with slightly older versions of the
software, I started using Apache2::Upload and had successfully gotten
it to work.

Today I was testing a new feature of the site that also received
uploaded files from the browser and Firefox (v1.0.7 on Linux) now
consistently crashes after very briefly displaying the response page.
This only happens when uploading files. Any other request is displayed
properly. I discovered that requests with file uploads are inserting
data at the beginning and adding data at the end of the response.
Here's the request header:

POST /admin/control/upload HTTP/1.1
Host: myaish.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12)
Gecko/20050921 Firefox/1.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

Content-Type: multipart/form-data;
boundary=---------------------------152806454621133374201063151624

Content-Length: 10519
-----------------------------152806454621133374201063151624
Content-Disposition: form-data; name="domain"

test
-----------------------------152806454621133374201063151624
Content-Disposition: form-data; name="type"

img
-----------------------------152806454621133374201063151624

Content-Disposition: form-data; name="image"; filename="coupon1.gif"
Content-Type: image/gif

Here's the response header:

HTTP/1.1 200 OK
Date: Mon, 14 Nov 2005 23:04:59 GMT
Server: Apache/2.0.55 (Unix) mod_apreq2-20050712/2.1.3-dev
mod_perl/2.0.2 Perl/v5.8.3
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-1

6873

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Branch Control</title>
...
...
</body>
</html>


0

Notice the "6873" at the beginning and the "0" at the end? Those don't
belong there, and I can't figure out why they are showing up! The
value at the beginning does differ, but always seems to be 4
chararacters.

Like I said, this stuff worked fine recently, though I haven't tested
it for a while. The original feature that used file upload also
responds with a browser crash, so it's not local to the new feature.
It's definitely upload-related. Incidentally, the uploaded file is
processed on the server fine. It's just the response that is
corrupted.

Here's the code to process the uploaded files (notice that it's very
straightforward):

use Apache2::Request ();
use Apache2::Upload ();

    my $req = Apache2::Request->new($r,
                                    TEMP_DIR => $cmf::const::TMP,
                                    POST_MAX => 1024 * 1024 * 2);

    foreach my $key ($req->upload())
    {
        $$upload{$key} = $req->upload($key);
    }

If you're curious, I also testing not processing the upload (commented
out the foreach loop) and also bypassing the function where the
uploaded data in the $upload hashref was used. The browser still
crashed.

Thanks,

Scott
--
Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote. - Benjamin Franklin




More information about the Perl mailing list