Error getting REMOTE_USER Environment Variable

MRAB python at mrabarnett.plus.com
Thu Feb 20 10:33:58 EST 2014


On 2014-02-20 14:53, Hobie Audet wrote:
> I'm running the Abyss Web Server X1 (v 2.9.0.1) on a Windows XP Home
> (SP3) system and am using Python 3.3 for a scripting language.  I'm
> having a problem getting the environment variable "REMOTE_USER".  Here's
> the situation:
>
> 1.  I have created a user under Abyss.  The userid is "userxyz"..
> 2.  I have created a directory under htdocs called "Test" and using the
> Abyss console I have password protected it.
> 3.  In the "Test" directory, there is no "index.html" file but there is
> an "index.py" file, so that should get executed when I access the "Test"
> directory.
> 4.  If I start up my web browser and point it to "localhost/Test", I get
> challenged for user authentication, as I should.
> 5.  I enter the userid ("userxyz") and its password and click the "Log
> in" button.  Authentication succeeds. So far, so good.
> 6.  The "index.py" script is launched.  It's only function (so far) is
> to fetch the "REMOTE_USER" environment variable and echo it back to me.
> 7.  What it echoes back is "userxyzuserxyz".  In other words, the
> REMOTE_USER value is repeated.
>
> In case you're interested, here is the entire "index.py" script:
>
>     import os
>     userid =os.environ["REMOTE_USER"]
>     print("Content-type: text/html")
>     print()
>     print("<HTML><BODY>" + userid + "</BODY></HTML")
>
> That's about as simple as anything could be.  The fact that the script
> is displaying anything at all indicates to me that my Python cgi support
> is installed correctly and that the script is being executed correctly.
> By why the "REMOTE_USER" value is doubled is beyond my understanding.
> Is this a bug in the os package that comes with Python 3.3?   Anybody
> got a fix for it?
>
> By the way, if I try to fetch "AUTH_USER", I get the same problem.
>
> Thanks in advance.
>
How many other environment variables are doubled? All of them?

Does the problem exist when the Python script is run directly, outside
Abyss, or in IDLE, for example?



More information about the Python-list mailing list