You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1996/10/23 20:59:23 UTC
custom variations with ErrorDocument
I was looking at the dull output one gets if an appropriate variant
can't be found to serve the request..
-=--=
Not Acceptable
An appropriate variant to the requested entity /index.html could not be found on this server.
Available variants:
index.html.en type text/html language en
index.html.de type text/html language de
index.html.fr type text/html language fr
-=-=-=-
Not very pretty, and not in keeping with customised ErrorDocument pages
elswhere on folks sites.
So how do we pass the above information to a custom script ?
Here's a 1 line patch that sets an ENV var to hold the information.
*** mod_negotiation.c.orig Wed Oct 23 19:09:27 1996
--- mod_negotiation.c Wed Oct 23 19:43:08 1996
***************
*** 1651,1656 ****
--- 1651,1657 ----
*content_language ? " language " : "", content_language,
"\n",
NULL);
+ table_merge( r->subprocess_env, "HTTP_VARIANTS", pstrcat(r->pool, filename, " (", description, ";", content_type, ";", content_language, ")", NULL));
}
t = pstrcat(r->pool, t, "</ul>\n", NULL);
which gives my custom 406 handler an ENV var of
REDIRECT_HTTP_VARIANTS = index.html.en (;text/html;en), index.html.de (;text/html;de), index.html.fr (;text/html;fr)
.. a ", " separated list of relative URLs followed
by (description;type;language)
And when it sees
HTTP_ACCEPT_LANGUAGE = it
it can even report the problem in Italian. Now ain't that cute.
rob
Re: custom variations with ErrorDocument
Posted by Paul Sutton <pa...@ukweb.com>.
On Wed, 23 Oct 1996, Rob Hartill wrote:
> I was looking at the dull output one gets if an appropriate variant
> can't be found to serve the request..
> index.html.en type text/html language en
> index.html.de type text/html language de
> index.html.fr type text/html language fr
> Not very pretty, and not in keeping with customised ErrorDocument pages
> elswhere on folks sites.
I would like to see a (optional) third argument to AddType, AddLanguage,
etc so that you could do
AddLanguage en en "English"
AddType text/html html "HTML document"
so the variant list could like much nicer:
HTML document in English
Plain text document in German and French
(or whatever). Only problem is that these directives are handled by
mod_mime, so aren't accessible to mod_negotiation....
> So how do we pass the above information to a custom script ?
>
> Here's a 1 line patch that sets an ENV var to hold the information.
> REDIRECT_HTTP_VARIANTS = index.html.en (;text/html;en), index.html.de (;text/html;de), index.html.fr (;text/html;fr)
> .. a ", " separated list of relative URLs followed
> by (description;type;language)
Yes, I like this idea. But I wonder if the format used shouldn't be the
variant-list format from the Holtman draft for transparent content
negotiation. This is already created (if using tcn), and could easily be
created in all cases. The format, btw, would look like this:
{ "index.html.en" 1.0 {type text/html} {language en}}
{ "index.html.de" 1.0 {type text/html} {language de}}
etc. Note that additional {...} sections could also appear, such as
{charset ...} and {description } and (in the future) {features ...} (the
latter will give browser-specific features, such as screen size, media,
whether it can support tables, java, etc). I think this format would be
more extensible, since the CGI can just ignore any attributes it does not
understand.
Paul
--
Paul Sutton, Technical Director, UK Web --- http://www.ukweb.com/~paul/
Apache Week: Latest news on Apache server... http://www.apacheweek.com/
Re: custom variations with ErrorDocument
Posted by Brian Behlendorf <br...@organic.com>.
On Wed, 23 Oct 1996, Rob Hartill wrote:
>
> Not very pretty, and not in keeping with customised ErrorDocument pages
> elswhere on folks sites.
>
> So how do we pass the above information to a custom script ?
>
> Here's a 1 line patch that sets an ENV var to hold the information.
+1.
Brian
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com www.apache.org hyperreal.com http://www.organic.com/JOBS