rzward has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Please let me know if I am posting this in the wrong place.

I have a machine that is running Apache/1.3.26 (Unix) mod_perl/1.27 on Linux.

My Perl script handles form submissions and checks the environment variable CONTENT_TYPE via $ENV{'CONTENT_TYPE'} before parsing the information coming from the Web page. The script expects CONTENT_TYPE to be 'application/x-www-form-urlencoded'. Otherwise, the script halts with an error message.

This script has been working for years on many different machines including this one. But now, interimittently, on this machine, when the script checks the CONTENT_TYPE environment variable it finds it empty.

Unfortunately, I am not an administrator of the machine. Also, this installation of Apache supports a product called Blackboard, which appears to require that all URLs be redirected to themselves plus a ?batt=Y added to the end. The configuration is complicated, I'm sure and I don't understand it well.

I'm confident the problem lies either in the interaction between mod_perl and Apache or the configuration of the Apache Web server.

My questions are:

1. Under what circumstances can the CONTENT_TYPE environment variable be set to nothing when the script program is called from a Web page via something like

<FORM ACTION="http://myserver.edu/cgi-bin/myscript.pl" METHOD="POST"> ... </FORM>

2. Is it possible for aliasing or redirecting from Apache to cause the CONTENT_TYPE to be reset? It feels like a timing issue because half the time it works and the other half the CONTENT_TYPE environment variable is empty.

Any advice would be greatly appreciated.

Thank you in advance.

Richard

  • Comment on CONTENT_TYPE environment variable sometimes empty when posting a form?

Replies are listed 'Best First'.
Re: CONTENT_TYPE environment variable sometimes empty when posting a form?
by rzward (Monk) on Sep 19, 2002 at 20:56 UTC
    Sorry for the non-perl related question. The problem no longer appears after making 2 changes to the calling HTML file. I do not pretend to understand this.

    1. I removed the following meta tag in the head section:

    <meta http-equiv="Expires" content="0">

    2. I changed the form tag from

    <form action="http://school.edu/cgi-bin/myscript.pl" method="POST">

    to

    <form action="http://www.school.edu/cgi-bin/myscript.pl" method="POST">

    Because I do not have control over the Web server, I do not have a lot of chances to test different possibilities.

    It's possible that the configuration of the Web server the URL without the "www" caused the problem or maybe the expiration tag was causing a problem with the browser.

    This is very strange. There are 2 web pages and 1 of them always worked and the other worked but not always. Both had the expires meta tag and the one that was failing did not have "www" in the url.

    Maybe someday they'll let me do a test to find out which one was the culprit. In the meantime, I'm staying away from the expires meta tag. It's not a good thing for the web page anyway.

    Richard