You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@avron.ICS.UCI.EDU> on 1995/03/20 12:18:03 UTC

Re: Fun with Content Negotiation.

> If that isn't enough of a thrill for you (yeah, right), you can poke
> around at http://www.ai.mit.edu:8000/xperimental/map-test/foo.map.  A
> copy of the actual map is at the bottom of this note --- the syntax is
> Roy's meta/http, with '#' comments thrown in.  (Roy, I know that's not
> kosher, but people would expect it to work anyway).

Hmmmmm, I hadn't thought about comments -- kind of funny, given that I
am an SE type.  I guess that shows how limiting the syntax is since
comments in HTTP headers should be in "(" parentheses ")".

Don't worry about it being kosher -- this is the only group to which
I've mentioned the concept of "meta/http".  Personally, I prefer a
hierarchical syntax like PRDM (or even a restricted subset of HTML).

> Oh yes, here are the contents of foo.map --- I was trying to break the
> parser with this; if I were trying to impress anyone with the elegance
> of the syntax, it would look a little different...
> 
>   URI: foo, vary="type,encoding"
            ^
should be a ;

>   #Let's get some comments in here.
>   
>   URI: foo.html
>   # this is another comment.
>   Content-type: text/html
>   Content-language: fr-provencal
>   
>   URI: foo.au
>   # Now, how about continuation lines?
>   Content-type:
>      audio/basic
>   
>   # The next example shows how you might jigger things to
>   # get a compressed version shipped, if the client will take it...
>   
>   Uri: foo.gif.Z
>   Content-type: image/gif; qs = 0.8
>   Content-encoding: gzip
>   
>   uri: foo.gif
>   Content-type: image/gif; qs = 0.5

Argh! That's exactly what you don't want to do.  Instead, the qs should
be identical and both entries should include the Content-Length (after
all, the only reason foo.gif.Z is better is because it has a smaller length).
The negotiation algorithm should choose the highest quality image first,
and then choose from the accepted encodings afterwords.  The encoding should
only affect the "qs" when it affects the quality of the source.

>   URI: foo.html3
>   Content-type: text/html;
>   # Comments can appear in the STRANGEST places.
>      level = 3
>   # Even here.
>   Content-language: en
>   Content-encoding: 8bit
>   #and here
>   
>   URI: foo.txt
>   Content-type: text/plain

Hmmmm, I think restricting comments to (comments) would be more readable.

........Roy