How do I follow the XHTML Content-Type recommendations?

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

 



If a client requests an XHTML file, it says to do normal
content-negotiation.  If the client's HTTP Accept header says they like
text/html more, send them that.  If it says they like application/xhtml+xml
more, send them that.

Fine.  I have even done that successfully with two different files.

Except I can't figure out how to provide multiple Content-Types for a
single file.  And I don't think creating multiple copies of the document
(even with linkes) is an appropriate solution.

   AddType "application/xhtml+xml,text/html; qs=0.01" .html

Tells the client "Content-Type: cation/xhtml+xml,text/html; qs=0.01",
which is no good.

An apache type-map always returns the Content-Type specified by AddType in
my main apache config file.


Test cases:

Both of these files are the same, hard linked to each other.

http://www.chaosreigns.com/xhtmltest/addtype.xhtml

Apache config:

   AddType "application/xhtml+xml,text/html; qs=0.01" .xhtml

The test: 

   $ telnet www.chaosreigns.com 80
   Trying 64.71.152.40...
   Connected to panic.chaosreigns.com.
   Escape character is '^]'.
   HEAD /xhtmltest/addtype.xhtml HTTP/1.1
   Host: www.chaosreigns.com
   Accept: text/html
   
   HTTP/1.1 200 OK
   Date: Fri, 17 Jul 2009 17:28:46 GMT
   Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
   Last-Modified: Fri, 17 Jul 2009 17:15:16 GMT
   ETag: "1c93d4-1aa-46ee9ee94b100"
   Accept-Ranges: bytes
   Content-Length: 426
   Content-Type: application/xhtml+xml,text/html; qs=0.01


http://www.chaosreigns.com/xhtmltest/typemap.var

File contents:

  URI: typemap

  URI: typemap.html
  Content-Type: text/html; qs=0.01
  
  URI: typemap.html
  Content-Type: application/xhtml+xml; qs=1

The test:

   telnet www.chaosreigns.com 80
   Trying 64.71.152.40...
   Connected to panic.chaosreigns.com.
   Escape character is '^]'.
   HEAD /xhtmltest/typemap.var HTTP/1.1
   Host: www.chaosreigns.com
   Accept: application/xhtml+xml
   
   HTTP/1.1 200 OK
   Date: Fri, 17 Jul 2009 17:35:13 GMT
   Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch
   Content-Location: typemap.html
   Vary: negotiate,accept
   TCN: choice
   Last-Modified: Fri, 17 Jul 2009 17:15:16 GMT
   ETag: "1c93d4-1aa-46ee9ee94b100;1c93d3-7e-46eea269bf400"
   Accept-Ranges: bytes
   Content-Length: 426
   Content-Type: text/html

When I have "AddType "application/xhtml+xml" .html" in my main apache
config and specify Content-Type: text/html, I get application/xhtml+xml.
This is its current state.

I think I should file bugs for these?



It also suggests that if neither text/html or application/xhtml+xml are
listed in the Accept header, that application/xhtml+html should not be
used.  I suppose it would be nice to be able to do that for particularly
bad browsers.

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