söndagen den 29 september 2002 14.51 skrev Paul Cupis: > I don't know if apt will respect it, but the correct way of doing what you > want would be for your cgi program to return a HTTP 302 code, telling the > agent/client (apt in this case) to use a different IP/location/URI. > > If you use 302 as oppsed to 301, then the client (apt) will still go to the > cgi program each time it is run, and not cache the new location/URI. > > The HTTP header should contain something similar to: > > HTTP/1.0 302 Found > Location: http://a.b.c.d/~path/to/files > > If you post your code, I'm sure someone will help you modify it.
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" print 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: ip="217.208.212.10"