Re: How are the name in Content-Disposition and the Content-Id related?

On Mon, Nov 23, 2009 at 7:39 AM, Norman Walsh <ndw@nwalsh.com> wrote:
> Alex,
>
> I'm trying to implement multipart post. The Java libraries expect me
> to provide a "name" and a value for each part. They provide this name
> on the Content-Disposition field for each part:
>
>  Content-Disposition: form-data; name="name0"
>
> Our definition of c:body provides an 'id' attribute:
>
>  <c:body
>    content-type = string
>    encoding? = string
>    id? = string
>    description? = string>
>      anyElement*
>  </c:body>
>
> which we assert is the value of the "Content-ID" header for the body or
> body part.
>
> How is the content-id related to the disposition name? Do we need to provide
> a way for authors to specify the name, or is that the same as the content
> id?

The Content-ID header provides a unique identifier by which you can refer to
the body part in another part (e.g. a html document contained in one
part can refer to an image contained in another).  It has no relationship
to the Content-Disposition header.

The Content-Disposition header provides a general means for providing
attributes of the body part like "filename", "creation date", "modification
date", etc.  This is described in RFC 2183 [1].

There is also a nice description of these headers on Wikipedia [2].

Here is an example from RFC 2183:

Content-Type: image/jpeg
Content-Disposition: attachment; filename=genome.jpeg;
          modification-date="Wed, 12 Feb 1997 16:29:51 -0500";
Content-Description: a complete map of the human genome

Note how the Content-ID header isn't specified.  It isn't required
unless you need to refer to that part from another part.

We are notably missing a way to specify this.  While the 'Content-Disposition'
header is optional, there may be legitimate reasons to want to include it.

As of now, our structure for multipart body parts does not allow custom
headers--which is by design.  Each body part is to only have a set of
'Content-*' headers (called, appropriately, "content headers") [3].  As
such, we probably do not want a way to put random headers into a
multipart body part.

As such, we'd need to do one of the following:

   1. Make the generation of the Content-Disposition header
       implementation defined.

   2. Specify that the 'id' attribute is used to generate the
       Content-Disposition filename.

   3. Add an attribute (called 'disposition'?) that allows the user to
      set that header value.  The Content-Disposition would only be
      generated if the attribute is set.

Option (3) allows any of the parameters specified in RFC 2183 to be set.

My opinion is that (2) feels like a hack and not much different than
what someone
might do in (1) if they are required to generate that header.
Pursuing something
like option (3) would be best as it looks like an oversight to me.  Of
course, option
(3) is a change to our specification.

[1] http://tools.ietf.org/html/rfc2183
[2] http://en.wikipedia.org/wiki/MIME
[3] http://tools.ietf.org/html/rfc2387

-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Thursday, 17 December 2009 23:11:42 UTC