You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Behlendorf <br...@organic.com> on 1997/01/06 05:23:31 UTC

406 responses, variant list

Hello, folks!  Finally back from my see-america-by-train trip, almost got
washed away by flood waters in Reno, but had a great time overall.  I'm slowly
catching up on email, but came home to the latest browser-incompatibility
issue.

It seems that Lynx 2.6 on SGI gets 406 None Acceptible responses on negotiated
content from 1.2.  This is pretty traceable to a problem in Lynx - it's sending
"Accept: text/html;q=0.000", and I believe is a "known bug" (if it's not now it
will be soon).  Anyways it caused us to investigate the 406 responses we're
returning, and have found lots of very interesting situations in which they are
being returned.  We'll investigate that and report more later - for now we're
setting up a 406 ErrorDocument to give some better info than is there now.

So, the problem is, I want to get a list of the possible variants instead of
having to hunt for them on my own.  I could have sworn that at one point Rob
Hartill posted a patch which put the possible variants in a 406 response into a
CGI environment variable, which then allowed an ErrorDocument 406 CGI script to
use that to format the output. Since it appears that 406 responses from
www.imdb.com are very prettily outputted, I presume he was doing something like
this, yet I can't find it in the apache code anywhere.  I do see
make_variant_list in mod_negotiation.c, which puts a really simple HTML list of
the variants in the "variants-list"  note, but it doesn't appear to actually
work.  Try doing a 

  telnet www.apache.org 80
  GET / HTTP/1.0
  Accept: image/gif

and you'll see what I mean.  The code looks like it might have been an
ommission in the case switch in http_protocol.c for NOT_ACCEPTIBLE (notice
that the one below it, MULTIPLE_CHOICES, appears to try and output the
"variant-list" note), yet it doesn't work for MULTIPLE_CHOICES either.

Any ideas?

	Brian


--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--
brian@organic.com  www.apache.org  hyperreal.com  http://www.organic.com/JOBS


Re: 406 responses, variant list

Posted by Rob Hartill <ro...@imdb.com>.
This from last week:

On Sun, 5 Jan 1997, Brian Behlendorf wrote:

> It seems that Lynx 2.6 on SGI gets 406 None Acceptible responses on negotiated
> content from 1.2.  This is pretty traceable to a problem in Lynx - it's sending
> "Accept: text/html;q=0.000", and I believe is a "known bug" (if it's not now it
> will be soon).

A known bug. I put an affected (infected ? :-) user in touch with the
Lynx people and together they worked out it was an SGI compiler problem.

> So, the problem is, I want to get a list of the possible variants instead of
> having to hunt for them on my own.  I could have sworn that at one point Rob
> Hartill posted a patch which put the possible variants in a 406 response
> into a CGI environment variable, which then allowed an ErrorDocument 406
> CGI script to use that to format the output.

That's correct. Paul Sutton suggested the list be created in a
slightly different format. That seemed reasonable and that's where
the story ended.

Here's the patch I sent on Oct 23rd:

*** 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);



and here's Paul's comments:

  : 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.

> Since it appears that 406 responses from
> www.imdb.com are very prettily outputted, I presume he was doing something like
> this, yet I can't find it in the apache code anywhere.

I never used it. I have a vanilla mod_perl handler to intercept "406" and
just do diagnostics on the error. It doesn't offer a list of alternatives
because I never got round to using the patch.

Since then, I've decided to stop using mod_negotiation and use a custom-built
mod_perl replacement that just gives people a reasonable default if they
have daft settings.

It's just not worth getting involved with the diagnostics
or showing the variants IMO - *for my server* - users aren't interested in
HTTP specs or browser bugs, they just want to get at the information.

I haven't put the mod_perl version online yet because I need to install
a new binary and I'm waiting for other changes before making one and
uploading it to my servers.


rob
--
Rob Hartill.       Internet Movie Database Ltd.    http://www.imdb.com/  


Re: 406 responses, variant list

Posted by Alexei Kosut <ak...@nueva.pvt.k12.ca.us>.
On Sun, 5 Jan 1997, Brian Behlendorf wrote:

> So, the problem is, I want to get a list of the possible variants instead of
> having to hunt for them on my own.  I could have sworn that at one point Rob
> Hartill posted a patch which put the possible variants in a 406 response into a
> CGI environment variable, which then allowed an ErrorDocument 406 CGI script to
> use that to format the output. Since it appears that 406 responses from
> www.imdb.com are very prettily outputted, I presume he was doing something like
> this, yet I can't find it in the apache code anywhere.  I do see
> make_variant_list in mod_negotiation.c, which puts a really simple HTML list of
> the variants in the "variants-list"  note, but it doesn't appear to actually
> work.  Try doing a 
> 
>   telnet www.apache.org 80
>   GET / HTTP/1.0
>   Accept: image/gif
> 
> and you'll see what I mean.  The code looks like it might have been an
> ommission in the case switch in http_protocol.c for NOT_ACCEPTIBLE (notice
> that the one below it, MULTIPLE_CHOICES, appears to try and output the
> "variant-list" note), yet it doesn't work for MULTIPLE_CHOICES either.

This has to do with the way mod_dir works. Use /index and it will work
as advertised. (you'll also see why AddHandler is a better idea than
AddType for includes, but that's a different story).

The problem is that if you have "DirectoryIndex index welcome", say,
and there exists some variants of index that are not acceptable, but
there is an acceptable variant of welcome, you'd want the acceptable
variant of welcome. So the code (if you recall, we added this just
recently) looks at each variant, and stores the response code (unless
sucessful) - in this case, the 406. But any other information gets
lost.

Now, the other approach would be if the first directoy index is not a
404, just return it, regardless of the others. This would result in
more correct behavior, HTTP-wise (esp in the case you mention here),
but would not allow additional DirectoryIndex entries to be
considred.

-- 
________________________________________________________________________
Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/