[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[OT] Redirection with CGI (was: Re: KDE 3.2-beta2)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 29 September 2002 09:26 am, Paul Cupis wrote:
> print 'HTTP/`1.0 302 Found'
> print 'Location: ', newuri'

[I realize the original problem has now been solved (hooray!), and anyway, apt 
doesn't like 30x status codes, however they are generated.]

This is totally off-topic, but I feel compelled to share this, as I spent many 
years in painful ignorance of the following, until just recently when I 
actually sat down and read the CGI spec.

You do not have to have your CGI program output a raw HTTP header just to 
change the status code.  You may instead use the "Status" header to set the 
status code, and any CGI 1.1 compliant web server will translate this into 
the appropriate HTTP header, (i.e. "Location: 302 Found" will cause Apache to 
change the header to "HTTP/1.1 302 Found").  

The relevent part of the CGI spec is: 
http://CGI-Spec.Golux.Com/draft-coar-cgi-v11-03-clean.html#7.2

This means you do not have to worry about figuring out how to get your web 
server to allow raw headers, like naming your CGI with some wierd prefix 
(which messes up your carefully crafted URI naming scheme)...

Yay!

Ok, so now that I have totally abused this list, I will crawl off and get some 
sleep...

- -- 
Nathaniel W. Turner
http://www.houseofnate.net/
Tel: +1 508 579 1948 (mobile)
"Mamma Mia!  Here I go again // My, my!  How can I resist you?"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE9oReX25cAeUrFyDIRAhfiAJ9AAeOgvLpqdTmkZUCYrSX+i8z70QCgzFYT
D15JAOq/f1U+yUm8CDVYehQ=
=ema4
-----END PGP SIGNATURE-----



Reply to: