[racket] mime/multipart parsing

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jan 8 14:17:34 EST 2012

At Sun, 8 Jan 2012 06:59:47 -0700, Jordan Schatz wrote:
> > Was this input perhaps extracted as a part of an enclosing multi-part
> > message? (Maybe not using `net/mime' for that outer message?)
> The input was the result of get-pure-port,

That makes sense, in that `get-pure-port' discards the overall message

> the following is the same
> message, but from get-impure-port (CRLF line endings)

If you send that whole stream to `message-analyze' (technically the
first line should be dropped, but it doesn't matter), then it works as
it should --- although the message body that you're after is an extra
layer deeper.

> I've noticed two more "interesting" things. The mime library doesn't know
> about several common (IANA registered I think) MIME types:
> application/json and image/png for example. Also it doesn't return the
> content type header so that I can judge for myself (abit of a problem
> because I also use unusual MIME types like text/sexp)

I'm not sure why the library tries to recognize subtypes at all. I
think it makes more sense to just include a symbol form of type as-is
in the result structure, since it will be difficult to keep up with all
registered types. I've pushed that change.

Posted on the users mailing list.