[users@httpd] CGI and HTTP Header Location redirects

D

Derek Basch

Hello,

I have been dealing with some strange behavior using CGI, python and an HTTP
Header "Location:" redirect on an Apache 1.3 server.

If I call a CGI script and perform a "Location:" redirect the script seems to
silently run off the tracks immediately after the redirect. For example "0.xml"
and "1.xml" are created when there is no redirect and only "0.xml" is created
when a redirect does occur (see below).

Also, after enabling suEXEC on the apache server the script executes perfectly
with the redirect. Can anyone explain this behavior? I would guess that it is
related to apache user rights but I can't find any reference to such problems
via Google.

Thanks everyone!,
Derek Basch

-------------------------------------------------

#! /usr/bin/python

import sys
import cgitb

class Trainer:

def train(self):
fs = open("/tmp/0.xml", "w")
fs.close()
## print "Location: " + "http://www.yahoo.com" + "\n\n"
sys.stdout.flush()
fs = open("/tmp/1.xml", "w")
fs.close()

def main():
try:
cgitb.enable()
trainer = Trainer()
trainer.train()

except Exception, inst:
cgitb.handler()

if __name__ == '__main__':
main()




__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: (e-mail address removed)
" from the digest: (e-mail address removed)
For additional commands, e-mail: (e-mail address removed)
 

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,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top