Re: [PATCH] Output unmodified Content-Type header value for JSON format.

Subject: Re: [PATCH] Output unmodified Content-Type header value for JSON format.

Date: Mon, 16 Jan 2012 08:49:03 +0000

To: Austin Clements, Pieter Praet

Cc: notmuch@notmuchmail.org

From: David Edmondson


On Sun, 15 Jan 2012 12:58:40 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> Yes.  I was mostly reiterating the IRC discussion for Pieter.  Since
> this discussion, I've stabilized on the pre-fetching notion I described
> in id:"20120115003617.GH1801@mit.edu",

Will read when I get there.

> though I do think we should make this clear in the code: that the rule
> for whether the JSON includes a "content" key for a leaf part is
> internal to the CLI and that consumers should be prepared to use it if
> it's there and to retrieve the content separately if it's not.  This
> is exactly how the Emacs code happens to work, it just hasn't been
> codified anywhere.

It's a bit more than 'happens to work' :-)

> Looking at it this way gives us more flexibility than the current code
> takes advantage of; for example we could omit content from the JSON if
> it's over some size threshold since the cost of sending that to a
> client that doesn't need it is high while the cost of having the
> client retrieve it for itself is relatively low.

This, I suspect, brings us back to what may have been Dmitry's original
concern. If we codify the current behaviour then we're actually
_forcing_ clients to use inline content if it's present, because
otherwise they have no way to discover the charset/encoding used for the
raw part.

That seems as though it could be a problem for some clients.

> OTOH, I don't understand the encoding story for HTML, since the encoding
> can come from either a header or from the body of the HTML.  Does this
> make it strictly necessary for the client to handle the encoding?

If it can be specified by the content of a part rather than the part
headers, then I think that the client will have to be prepared to handle
it.

Even if not, it might still be more effective to choose that approach -
it would remove the need to add arbitrary encoding support to the CLI
application.
part-000.sig (application/pgp-signature)

Thread: