W3C home > Mailing lists > Public > www-webdav-dasl@w3.org > January to March 2003

Comparisons on DAV:getcontenttype

From: Julian Reschke <julian.reschke@gmx.de>
Date: Fri, 17 Jan 2003 14:37:58 +0100
To: <www-webdav-dasl@w3.org>
Message-ID: <JIEGINCHMLABHJBIGKBCKEJGGDAA.julian.reschke@gmx.de>

Hi,

we recently came across the following issue.

DAV:getcontenttype is defined to have the value of the HTTP content-type
header. However, this header is defined as:

Content-Type   = "Content-Type" ":" media-type
media-type     = type "/" subtype *( ";" parameter )
       type           = token
       subtype        = token

This means, that queries against the content type can be quite tricky.

For instance,

	<eq xmlns="DAV:" casesensitive="0">
		<prop><getconttenttype/></prop>
		<literal>text/plain</literal>
	</eq>

will *not* match for resources where the HTTP content-type header would
contain a parameter such as "charset".

On the other hand,

	<like xmlns="DAV:" casesensitive="0">
		<prop><getconttenttype/></prop>
		<literal>text/plain;%</literal>
	</like>

will not match resource where no parameter is given. The naive fix:

	<like xmlns="DAV:" casesensitive="0">
		<prop><getconttenttype/></prop>
		<literal>text/plain%</literal>
	</like>

won't work either, because it would match "text/plain123" as well.

At this point, the only robust way to match the complete type and subtype,
but not any parameters, seems to be:

	<or xmlns="DAV:">
		<eq casesensitive="0">
			<prop><getconttenttype/></prop>
			<literal>text/plain</literal>
		</eq>
		<like casesensitive="0">
			<prop><getconttenttype/></prop>
			<literal>text/plain;%</literal>
		</like>
	</or>

and even this is fragile if a server decides not to support the casesentive
attribute.


Maybe we need a specific operator for queries on content types?

Julian

--
<green/>bytes GmbH -- http://www.greenbytes.de -- tel:+492512807760
Received on Friday, 17 January 2003 08:38:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 22 March 2009 03:38:09 GMT