Weird cgi error

J

Jesse Aldridge

I uploaded the following script, called "test.py", to my webhost.
It works find except when I input the string "python ". Note that's
the word "python" followed by a space. If I submit that I get a 403
error. It seems to work fine with any other string.
What's going on here?

Here's the script in action: http://crookedgames.com/cgi-bin/test.py

Here's the code:

#!/usr/bin/python
print "Content-Type: text/html\n"
print """
<html>
<body>
<form action="test.py" method="post">
<textarea name="data">
</textarea>
<INPUT type="submit" value="Submit">
</form>
</body>
</html>
"""
 
G

Gerardo Herzig

Jesse said:
I uploaded the following script, called "test.py", to my webhost.
It works find except when I input the string "python ". Note that's
the word "python" followed by a space. If I submit that I get a 403
error. It seems to work fine with any other string.
What's going on here?

Here's the script in action: http://crookedgames.com/cgi-bin/test.py

Here's the code:

#!/usr/bin/python
print "Content-Type: text/html\n"
print """
<html>
<body>
<form action="test.py" method="post">
<textarea name="data">
</textarea>
<INPUT type="submit" value="Submit">
</form>
</body>
</html>
"""
If you cant have access to the apache (?) error_log, you can put this in
your code:
import cgitb
cgitb.enable()

Which should trap what is being writed on the error stream and put it on
the cgi output.

Gerardo
 
J

Jesse Aldridge

If you cant have access to the apache (?) error_log, you can put this in
your code:
import cgitb
cgitb.enable()

Which should trap what is being writed on the error stream and put it on
the cgi output.

Gerardo

I added that. I get no errors. It still doesn't work. Well, I do
get several errors about the missing favicon, but I'm pretty sure
that's unrelated.
 
J

Jesse Aldridge

I added that. I get no errors. It still doesn't work. Well, I do
get several errors about the missing favicon, but I'm pretty sure
that's unrelated.

Oh, and yeah, the server's running Apache.
 
S

Steve Holden

Jesse said:
I uploaded the following script, called "test.py", to my webhost.
It works find except when I input the string "python ". Note that's
the word "python" followed by a space. If I submit that I get a 403
error. It seems to work fine with any other string.
What's going on here?

Here's the script in action: http://crookedgames.com/cgi-bin/test.py

Here's the code:

#!/usr/bin/python
print "Content-Type: text/html\n"
print """
<html>
<body>
<form action="test.py" method="post">
<textarea name="data">
</textarea>
<INPUT type="submit" value="Submit">
</form>
</body>
</html>
"""

This is some kind of crooked game, right? Your code works fine on a
local server, and there's no reason why it shouldn't work just fine on
yours either. All you are changing is the standard input to the process.

Since you claim to have spotted this specific error, perhaps you'd like
to explain just exactly how you came across it. I mean that's a pretty
specific input to test with ...

Frankly I am not sure you are telling the truth about the code behind
that page. If you *are* then you'd better provide specifics: Python
version, Apache version, httpd.conf file, and so on. April 1 is still
over a month away.

regards
Steve

PS: consider closing the <textarea> tag on the same line as the opening
tag to avoid spurious spaces in your pristine form.
 
J

Jesse Aldridge

This is some kind of crooked game, right? Your code works fine on a
local server, and there's no reason why it shouldn't work just fine on
yours either. All you are changing is the standard input to the process.

Since you claim to have spotted this specific error, perhaps you'd like
to explain just exactly how you came across it. I mean that's a pretty
specific input to test with ...

Frankly I am not sure you are telling the truth about the code behind
that page. If you *are* then you'd better provide specifics: Python
version, Apache version, httpd.conf file, and so on. April 1 is still
over a month away.

regards
Steve

PS: consider closing the <textarea> tag on the same line as the opening
tag to avoid spurious spaces in your pristine form.

Thanks for the reply.

No, it's not a game, crookedgames.com is a mostly defunct games site
that I was working on for a while. I'm just hosting the script
there. What I am actually working on is a tool used to compare
various things. Check it out here: http://crookedgames.com/cgi-bin/Language_Comparison.py
Here's some input you can use to test with:

Cats
+2 Fuzzy
-1 Medium Maintenance

Fish
+1 Low Maintenance
-1 Stupid

Dogs
+2 Fuzzy
-2 High Maintenance

(note that there's supposed to be two spaces before the +/- symbols --
in case my formatting doesn't go through)

I originally created that tool because I wanted to compare programming
languages, python among them, thus leading me discover this issue.

Now, I'm very new to this web development stuff (this is my first real
app), so it's quite likely that I'm just doing something stupid, but I
can't figure out what.

I'm using LunarPages. CPanel reports my Apache version as: 1.3.37
(Unix)

I added the line "print sys.version" to the test script, and that
spits out: "2.3.4 (#1, Dec 11 2007, 05:27:57) [GCC 3.4.6 20060404 (Red
Hat 3.4.6-9)]"

I can't find any file called httpd.conf. It would be in /etc, right?
I guess I don't have one.

Still having the same problem.

Here's the new contents of test.py:

#!/usr/bin/python
import cgitb, sys
cgitb.enable()

print "Content-Type: text/html\n"
print sys.version
print """
<html>
<body>
<form action="test.py" method="post">
<textarea name="data"> </textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
"""

It's not a joke, honest :)
 
G

gherzig

This is some kind of crooked game, right? Your code works fine on a
local server, and there's no reason why it shouldn't work just fine on
yours either. All you are changing is the standard input to the process.

Since you claim to have spotted this specific error, perhaps you'd like
to explain just exactly how you came across it. I mean that's a pretty
specific input to test with ...

Frankly I am not sure you are telling the truth about the code behind
that page. If you *are* then you'd better provide specifics: Python
version, Apache version, httpd.conf file, and so on. April 1 is still
over a month away.

regards
Steve

PS: consider closing the <textarea> tag on the same line as the opening
tag to avoid spurious spaces in your pristine form.

Thanks for the reply.

No, it's not a game, crookedgames.com is a mostly defunct games site
that I was working on for a while. I'm just hosting the script
there. What I am actually working on is a tool used to compare
various things. Check it out here:
http://crookedgames.com/cgi-bin/Language_Comparison.py
Here's some input you can use to test with:

Cats
+2 Fuzzy
-1 Medium Maintenance

Fish
+1 Low Maintenance
-1 Stupid

Dogs
+2 Fuzzy
-2 High Maintenance

(note that there's supposed to be two spaces before the +/- symbols --
in case my formatting doesn't go through)

I originally created that tool because I wanted to compare programming
languages, python among them, thus leading me discover this issue.

Now, I'm very new to this web development stuff (this is my first real
app), so it's quite likely that I'm just doing something stupid, but I
can't figure out what.

I'm using LunarPages. CPanel reports my Apache version as: 1.3.37
(Unix)

I added the line "print sys.version" to the test script, and that
spits out: "2.3.4 (#1, Dec 11 2007, 05:27:57) [GCC 3.4.6 20060404 (Red
Hat 3.4.6-9)]"

I can't find any file called httpd.conf. It would be in /etc, right?
I guess I don't have one.

Still having the same problem.

Here's the new contents of test.py:

#!/usr/bin/python
import cgitb, sys
cgitb.enable()

print "Content-Type: text/html\n"
print sys.version
print """
<html>
<body>
<form action="test.py" method="post">
<textarea name="data"> </textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
"""

It's not a joke, honest :)
--
It just doesnt make sense to me. I guess we all agree that is not a python
problem, because that code does actually nothing but showing the form.
 

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,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top