Weird cgi error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jesse Aldridge

    Weird cgi error

    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>
    """
  • Gerardo Herzig

    #2
    Re: Weird cgi error

    Jesse Aldridge wrote:
    >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

    Comment

    • Jesse Aldridge

      #3
      Re: Weird cgi error

      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.

      Comment

      • Jesse Aldridge

        #4
        Re: Weird cgi error

        On Feb 25, 11:42 am, Jesse Aldridge <JesseAldri...@ gmail.comwrote:
        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.
        Oh, and yeah, the server's running Apache.

        Comment

        • Steve Holden

          #5
          Re: Weird cgi error

          Jesse Aldridge wrote:
          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 <textareatag on the same line as the opening
          tag to avoid spurious spaces in your pristine form.
          --
          Steve Holden +1 571 484 6266 +1 800 494 3119
          Holden Web LLC http://www.holdenweb.com/

          Comment

          • Jesse Aldridge

            #6
            Re: Weird cgi error

            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 <textareatag on the same line as the opening
            tag to avoid spurious spaces in your pristine form.
            --
            Steve Holden +1 571 484 6266 +1 800 494 3119
            Holden Web LLC http://www.holdenweb.com/
            Thanks for the reply.

            No, it's not a game, crookedgames.co m 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 :)

            Comment

            • gherzig@fmed.uba.ar

              #7
              Re: Weird cgi error

              >
              >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 <textareatag on the same line as the opening
              >tag to avoid spurious spaces in your pristine form.
              >--
              >Steve Holden +1 571 484 6266 +1 800 494 3119
              >Holden Web LLC http://www.holdenweb.com/
              >
              Thanks for the reply.
              >
              No, it's not a game, crookedgames.co m 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:

              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.

              Comment

              Working...