andris9 / hoodiecrow

Scriptable IMAP server for client integration testing
http://andris9.github.io/hoodiecrow/
Other
60 stars 27 forks source link

issue fetching message parts #4

Closed dominikgehl closed 10 years ago

dominikgehl commented 10 years ago

fetching the mime description of a message part seems to work

=> 'A5 UID FETCH 8 (UID FLAGS INTERNALDATE BODY.PEEK[1.MIME])'
<= '* 8 FETCH (UID 8 FLAGS () INTERNALDATE "22-Oct-2013 09:00:14 -0400" BODY[1.MIME] {96}'

unfortunately obtaining the actual content doesn't

=> 'A5 UID FETCH 8 (UID FLAGS INTERNALDATE BODY.PEEK[1])'
<= 'A5 BAD Not implemented: 1'
andris9 commented 10 years ago

The latest version of hoodiecrow (v1.1.15) should be able to handle this query (7c67087d5c450838d96e646030471e04a4ad0455). I'm not 100% sure Hoodiecrow handles the BODY queries correctly so if you find anything else that is not handled properly, let me know.

This is what I get when running complete.js example:

CLIENT: A5 UID FETCH 1 (UID FLAGS INTERNALDATE BODY.PEEK[1])
SERVER: * 1 FETCH (UID 1 FLAGS () INTERNALDATE "14-Sep-2013 21:22:28 -0300" BODY[1] {8}
World 1!)
dominikgehl commented 10 years ago

Upgraded to the latest version and it definitely is way better. There still seem to be some errors though ... for example on a message with text and image (multipart / mixed), I get the following bodystructure

BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "ISO-8859-1" "FORMAT" "flowed") NIL NIL "7BIT" 11 2 NIL NIL NIL) ("IMAGE" "PNG" ("NAME" "Screen shot 2009-10-01 at 2.30.41 PM.png") NIL NIL "BASE64" 60408 NIL ("INLINE" ("FILENAME" "Screen shot 2009-10-01 at 2.30.41 PM.png")) NIL) "MIXED" ("BOUNDARY" "------------090004050608040703090000") NIL NIL) )

When then trying to fetch the individual parts, I obtain a response, but no actual content

=> 'A5 UID FETCH 8 (UID FLAGS INTERNALDATE BODY.PEEK[1])'
<= '* 8 FETCH (UID 8 FLAGS () INTERNALDATE "22-Oct-2013 09:54:29 -0400" BODY[1] {0}'

while 1.MIME returns the correct info

=> 'A5 UID FETCH 8 (UID FLAGS INTERNALDATE BODY.PEEK[1.MIME])'
<= '* 8 FETCH (UID 8 FLAGS () INTERNALDATE "22-Oct-2013 09:58:04 -0400" BODY[1.MIME] {96}'

and 2.MIME gives me

=> 'A5 UID FETCH 8 (UID FLAGS INTERNALDATE BODY.PEEK[2.MIME])'
<= 'A5 BAD Cannot read property \'header\' of undefined'

and 2

=> 'A5 UID FETCH 8 (UID FLAGS INTERNALDATE BODY.PEEK[2])'
<= 'A5 BAD Cannot read property \'text\' of undefined'
dominikgehl commented 10 years ago

Let me know if you prefer having actual failing test cases in a PR for example

andris9 commented 10 years ago

Failing test cases would be great! Fetching numbered body parts is the weakest part of Hoodiecrow and your samples indicate that it is really buggy.

dominikgehl commented 10 years ago

PR with failing test added.

andris9 commented 10 years ago

Thanks a lot! I also fixed hoodiecrow so it would pass the added tests. Pushed the updated version to npm registry as v1.1.16

felixhammerl commented 10 years ago

this is awesome, thanks so much!