Re: [racket] mime/multipart parsing

2012-01-09 Thread Jordan Schatz
> 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. Thanks! On Sun, Jan 08, 2012 at 12:17:

Re: [racket] mime/multipart parsing

2012-01-08 Thread Matthew Flatt
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 ov

Re: [racket] mime/multipart parsing

2012-01-08 Thread Jordan Schatz
> 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, the following is the same message, but from get-impure-port (CRLF line endings) ---

Re: [racket] mime/multipart parsing

2012-01-07 Thread Matthew Flatt
Looking at this again, I see that `net/mime' expects a complete message --- header and body, but no extra prefix --- so there shouldn't be a "--9nbsYRvJBLR..." line before the "Content-Type" header. By itself, that line is essentially being ignored as an ill-formed header element. Adding a blank li

Re: [racket] mime/multipart parsing

2012-01-07 Thread Jordan Schatz
Thank you Matthew, The message I was using did have CRLF line endings, but it had one too many: -- #lang racket (require net/mime) (define message-string (let ([sep "\r\n"]) (string-append sep ;;This message starts

Re: [racket] mime/multipart parsing

2012-01-06 Thread Neil Van Dyke
While the example input here is not precise about newlines, if someone finds a real-world example that does not use CRLF properly, then Racket might want to be more liberal in what it accepts here. Matthew Flatt wrote at 01/07/2012 12:12 AM: I think the main problem is that the input string ha

Re: [racket] mime/multipart parsing

2012-01-06 Thread Matthew Flatt
I think the main problem is that the input string has LF newlines, and it needs to have CRLF newlines. You'll also want a terminating CRLF. With those changes, then `(message-fields inner-message)' instead of `(entity-fields inner-entity)' will get you the headers that include "X-Riak-Vclock: ..."

[racket] mime/multipart parsing

2012-01-06 Thread Jordan Schatz
I'm having difficulties parsing mime multipart messages (probably I missed something in the docs again). I have this code: -- #lang racket (require net/mime) (define ip (open-input-string "--9nbsYRvJBLRyuL4VOuuejw9LcAy Cont