CGI.pm File Upload doesn't work (blocks) on my Server (but workson my Desktop)

B

Bjoern

Hello,

my script handles file uploads (using CGI.pm) fine on my Windows Desktop
(with Apache 1.3.28), but it seems to hang on my Linux Server (debian,
Apache 1.3.26). I think it is actually never called, as I don't get any
logging output, either.

What coud be wrong? I've checked that /temp can be written to by anyone,
but other than that, I have no idea. Other scripts in the same directory
and with the same permissions work fine.

Many thanks in advance for any ideas!


Bjoern


P.S.: Because I was drowning in spam, replying to this email will only
trigger an automated reply that will give you my active email address.
Sorry for the inconvenience.



--


Let's not weep for their evil deeds,
but for their lack of imagination
(Nick Cave)
 
B

Bjoern

There is no /temp on a standard unix or gnu/linux distribution.

oops, true - but there is a /tmp, which is what I meant.

I'll try to create a simple script that reproduces my problem and that I
can post.


Bjoern


--


Let's not weep for their evil deeds,
but for their lack of imagination
(Nick Cave)
 
B

Bjoern

mike said:
How? Posting code would be a good start.

OK, made a short version now, and it seems as if CGI.pm is not at fault.
I don't think the script is even ever called, as even if I point the
upload form to a non-existant script, it still blocks forever.

So you'll probably tell me to go away. But for what it's worth, here the
test page and code:

---------- page -----------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/transitional.dtd">
<html> <head>
<link rel="stylesheet" type="text/css" href="../../arcus.css">
<title>Arcus Investment</title>
</head>
<body>
<form name="upload" action="cgi-bin/uploadTest.pl" method="post"
enctype="multipart/form-data">
test:
<input type=file size="40" name="test">
<input type="submit" value="submit">
</form>
</body>
</html>


----------- Script -----------

#!/usr/bin/perl

use CGI; # load CGI routines
$q = new CGI;

print $q->header(-type => 'text/html');

my $test = $q->upload('test');

while(<$test>){
print;
}

print "perl cgi test ok";



--


Let's not weep for their evil deeds,
but for their lack of imagination
(Nick Cave)
 
A

Alan J. Flavell

OK, made a short version now, and it seems as if CGI.pm is not at fault.
I don't think the script is even ever called, as even if I point the
upload form to a non-existant script, it still blocks forever.

So you'll probably tell me to go away.

If you think that you don't primarily have a Perl language problem
here, you're probably right. If you think that you'd get a better
answer to your HTML authoring and/or web server configuration problems
on a more appropriate group, you'd probably be right. If you think
that we don't care whether you succeed or not, you're probably wrong.
We _do_ like to see folks getting good results, but we're happier when
we see them going about it in the right way.

[snip]
<form name="upload" action="cgi-bin/uploadTest.pl" method="post"
enctype="multipart/form-data">

Looks promising, but are you sure what absolute URL that relative
URLpath "cgi-bin/uploadTest.pl" is going to resolve to?
----------- Script -----------

#!/usr/bin/perl

Guess who isn't paying proper attention to this group's posting
guidelines? The regulars hate that. It's demeaning for a human being
to be asked to do the job of a machine.

I don't see anything obvious that leaps out at me.

What you've omitted to tell us is what you observed when you tried it.

Take a look at those guidelines - use strict and warnings - in this
context I'd also recommend making use of CGI::Carp to get any
diagnostics back to the browser while testing (take it out again
before opening the web site to the public - no need to expose internal
details to hackers...)

good luck
 
B

Bjoern

[...]

OK, the problem cause is really embarrassing: apparently my desktop
computers firewall (Kerio) was blocking the file uploads. I still don't
know why, because it let's other http requests pass, but at least I can
test my script by temporarily disabling the firewall.

So it wasn't perl-related after all. But for completeness sake I wanted
to post the solution here anyway, in case somebody with a similiar
problem is searching the archives.

[...]
Guess who isn't paying proper attention to this group's posting
guidelines? The regulars hate that. It's demeaning for a human being
to be asked to do the job of a machine.

I am not sure what I did wrong here? I was asked to post code, and in
the guidelines I just found: "First make a short (less than 20-30 lines)
and complete program that illustrates the problem you are having. People
should be able to run your program by copy/pasting the code from your
article.". Or is it that the #!/usr/bin/perl doesn't belong into the script?

Just trying to understand? Sorry I didn't read the guidelines
beforehand, but it isn't obvious to look for 'guidelines', I only
searched for the faq.

Thanks for all the helpful replies!


Bjoern

--


Let's not weep for their evil deeds,
but for their lack of imagination
(Nick Cave)
 
A

Alan J. Flavell

OK, the problem cause is really embarrassing:

Don't worry about it! We all make mistakes. Main thing is, you've
learned something about debugging for next time, and we've got the
satisfying sense of closure that comes from hearing how the problem
panned out in the end.
apparently my desktop
computers firewall (Kerio) was blocking the file uploads. I still don't
know why, because it let's other http requests pass, but at least I can
test my script by temporarily disabling the firewall.

So it wasn't perl-related after all. But for completeness sake

Indeed. Thanks for posting the update!
I am not sure what I did wrong here?

Specifically: you didn't have strict and warnings enabled...

all the best
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top