Re: KDE 3.2-beta2
-----BEGIN PGP SIGNED MESSAGE-----
On Sunday 29 September 2002 14:10, Karolina Lindqvist wrote:
> That sounds like a much better way of doing that what I am doing. Should I
> just send that stuff back?
> This is my small cgi script with the name "debian":
> #! /usr/local/bin/python
> import os, string, ip
> print "Content-type: text/html"
> QUERY_STRING = os.environ["QUERY_STRING"]
> PATH_INFO = os.environ["PATH_INFO"]
> request_uri = os.environ["REQUEST_URI"]
> where = string.index(request_uri, "htbin/cgiwrap/pgd/")
> newurl = "http://" + ip.ip + request_uri[where+17:]
> print "<html><head>"
> print '<meta http-equiv="refresh" content="0; url=', newurl, '">'
> print "</html>"
> The file ip.py just contains whatever is my current ip at the moment:
I don't know python, but the following should be what you want:
import os, string, ip
QUERY_STRING = os.environ["QUERY_STRING"]
PATH_INFO = os.environ["PATH_INFO"]
request_uri = os.environ["REQUEST_URI"]
where = string.index(request_uri, "htbin/cgiwrap/pgd/")
newuri = "http://" + ip.ip + request_uri[where+17:]
print 'HTTP/`1.0 302 Found'
print 'Location: ', newuri'
Please exuse any errors in the code/syntax - I don't know python.
Also, you will need to configure your webserver so that it does not create
it's own HTTP header for this cgi program. Search the config file for nph,
non-parsed-head, parse or similar and check the documentation. Basically, if
your webserver manages to run the program okay, it will put a HTTP header on
the output, but you want your program to give the HTTP header, not your
Again, let us know what server you are running (and maybe post an except from
it's config) and someone will try and help, I'm sure.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
-----END PGP SIGNATURE-----