[Zope-dev] MIME type syntax (was: Bug in zc.resourcelibrary?)

Thomas Lotze thomas at thomas-lotze.de
Wed Dec 5 04:20:29 EST 2007


Fred Drake wrote:

> On Dec 4, 2007 5:55 PM, Thomas Lotze <thomas at thomas-lotze.de> wrote:
>> It wasn't even about whitespace around the / but leading whitespace in
>> front of the major type.
> 
> Wow.  It probably didn't occur to me that would be screwed up.

I've now looked up RfC 2045 which states that there is to be no whitespace
within the MIME type specification, i.e. in particular none around the
slash. This requires a change to zope.publisher.contenttype. OTOH it's
probably up to us how to treat whitespace surrounding the string
specifying MIME type:

- Either we decide that such a string should always follow the RfC exactly
and contain no whitespace at all (which makes the way zope.publisher.http
handles it the correct way),

- or we allow for it to be some possibly whitespace-padded string that
contains a valid MIME spec, which would allow for surrounding whitespace,
but not space around the slash.

I'd prefer the first option for clarity. Is there any reason to be
forgiving regarding whitespace in the first place?

As for capitalization, the RfC states clearly that major type, minor type
and parameter names are case-insensitive. This requires a change to
zope.publisher.http which currently says:

  if not content_type.startswith('text/'):
      raise ValueError(...)

I'll do all that once we have agreed on one way of treating the MIME type
specs.

-- 
Thomas





More information about the Zope-Dev mailing list