Re: How do I follow the XHTML Content-Type recommendations?

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

 



Darxus@xxxxxxxxxxxxxxx wrote:
So it's not possible to serve one file with two different Content-Types,
and you think that is as it should be?

Yes, because it would be very confusing otherwise.
But it is not what I think that counts; what counts is the HTTP RFC.


Did you read the part about why XHTML should be served to some clients as
text/html, and others as application/xhtml+xml?
Wherever that is, I disagree with it. Content should be served with a Content-Type that corresponds to what the content /is/, not to what the client understands.


application/xhtml+xml is the correct Content-Type for xhtml.  So it should
be sent with that Content-Type.
Yes, and yes.

  But XHTML 1.0 was created to be compatible
with existing browsers that didn't understand XML, so they should be served
the same file, with the different Content-Type of text/html.
That may be where we disagree. They could be sent the same content, but not necessarily the same file.



On 07/17, Andr? Warnier wrote:
No, if a client asks for the URL "/abc/file.html", it wants the resource corresponding to that URL.

Right.  And in this case, regardless of which Content-Type the client
wants that resource in, it's the same file.

No, and that is where you are confused. You are confusing resource and file.
Quote from http://httpd.apache.org/docs/2.2/content-negotiation.html:

A resource is a conceptual entity identified by a URI (RFC 2396). An HTTP server like Apache provides access to representations of the resource(s) within its namespace, with each representation in the form of a sequence of bytes with *a defined media type*, character set, encoding, etc. Each resource may be associated with zero, one, or more than one representation at any given time. If multiple representations are available, the resource is referred to as negotiable and each of its representations is termed a variant. The ways in which the variants for a negotiable resource vary are called the dimensions of negotiation.

Unquote


Except I can't figure out how to provide multiple Content-Types for a
single file.
Logical, because you can't. One document/file has only one MIME type, not several.

Why not?
That, you should ask the people who have created all these Internet RFC's. I am sure that they have thought long and hard about it.


Unless you mean what is described here :
http://httpd.apache.org/docs/2.2/content-negotiation.html
(Read it, don't just guess how it works)

I read it before posting.

   AddType "application/xhtml+xml,text/html; qs=0.01" .html
What makes you think that you can do that ?

I tried it because it should work, not because I believed documentation
said it would.

Tells the client "Content-Type: application/xhtml+xml,text/html; qs=0.01",
which is no good.
No, and it's even invalid.

That's what I meant by "which is no good".

No, you are confused again.

The client says :
"I want a glass of red wine. If you happen to have a Bourgogne and/or a Bordeaux, then I prefer the Bourgogne (0.9), followed by the Bordeaux (0.5). And otherwise, any red wine will do (0.1)."

The server looks at which variants it has in the cellar. It finds a red Bordeaux, and a red Spanish table wine. It decides that the Bordeaux best matches what the client wants. So it sends the Bordeaux, and adds a header saying : "here is a red Bordeaux".

The server cannot answer : here is a Bourgogne or Bordeaux; quality = 0.9. That just does not make sense, even if the Bordeaux is a Chateau Cheval Blanc 1er Grand Cru Classé St Emilion.


I believe you are a bit confused.
Your typemap file has the same mistake.

If what you said above is correct, I am not confused.  I want to do
something Apache is currently incapable of.
It is phrases like that, which make these posts endearing.

You can get the correct response from Apache, but you have to do it right, according to how it works, which is explained in the documentation. And not according to how you think it /should/ work.

Lack of support for this capability is lack of support for XHTML.
Not really. The one that should support XHTML is the client, not the server. Apache doesn't know anything about HTML or XHTML or XML or whatever content type, and does not need to know. It serves content, whatever that content is; it does not look inside of it. It is only supposed to indicate to the client the MIME type of this content, which it determines according to a set of configuration rules, which you are creating.

So, if you tell Apache that a file whose name ends in ".xyz" has a content-type of "image/bubblegum", then that is what Apache will put in the Content-type it sends to the client.

But Apache should not send 2 MIME types in a Content-type header, because that is illegal according to the HTTP specification, and Apache, being a HTTP server, has to respect the HTTP specification.

You can do an
AddType text/html .html
 and an
AddType application/xhtml+xml .xhtml
but you cannot combine them into one single AddType.
(and you should check first if these types are not already in Apache by default; they probably are)

Let's go back to the type-map file and the explanation about content negociation, and think again. (Maybe also look at MultiViews).

To use the standard Apache content-negociation,
you have to create 2 files, and then use your type-map to return one /or/ the other, with the corresponding Content-type. It /may/ work with a single file, and another symbolic link to it, but of that I am not sure.

(Personally, I think that you /should/ have 2 files, because their content should not be identical. If they are proper html and xhtml, then at least their DOCTYPE and <meta http-equiv="content-type"> tags should be different)

Note however that old browsers who do not understand the type "application/xhtml+xml", may also not send an "Accept" header.

Note however that old browsers who do not understand the type "application/xhtml+xml", are *really* old.

Note also that no matter what the server sends as Content-Type header, if the browser is IE, it will ignore it anyway and make its own guess.

Note also that if you do not like how Apache does it, you can write your own add-on modules to do it any way you like.
That's what filters are for.
You could probably even achieve what you want more precisely by using the mod_SetEnvIf, mod_headers and/or mod_rewrite.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux