Opened 5 years ago

Last modified 2 years ago

#3947 defect new

imap4.IMAPServer sends bodystructure body size as string

Reported by: biny Owned by: argonemyth
Priority: normal Milestone:
Component: mail Keywords: imap fetch bodystructure
Cc: fei@… Branch:
Author: Launchpad Bug:

Description

Made test_imap.SimpleClient to log the received lines and ran test

twisted.mail.test.test_imap.NewFetchTestCase.testFetchBodyStructure

The bodystructure line received is

'* 0 FETCH (BODYSTRUCTURE ("text" "plain" (("name" "thing") ("key" "value")) "this-is-the-content-id" "describing-the-content-goes-here!" "8BIT" "20" "4" NIL NIL NIL))'

See how the body size is quoted. Now look at http://tools.ietf.org/html/rfc3501#section-7.4.2 and notice that the examples there do not have quotes around the body size.

Change History (4)

comment:1 Changed 5 years ago by biny

Same for the lines too.

comment:2 Changed 5 years ago by exarkun

I'm not sure this behavior is actually against the spec. Quoted strings fill almost exactly the same role in the grammar as unquoted strings. However, not quoting things when it is not necessary to (as it should never be necessary in these cases), particularly if doing so causes the results to line up with an example from the RFC, still sounds like a good thing.

I'm a bit surprised at this behavior. collapseNestedLists already has some code to avoid quoting numbers. Perhaps collapseNestedLists isn't actually being used for this case (somehow... that would be extra weird). Or maybe getBodyStructure isn't giving back numbers for these fields. Ah, yes, that seems to be it. It explicitly converts the size and line count to strings. Possibly it should leave them as numbers, or possibly it should use the DontQuoteMe helper. Whichever has the least impact. :)

comment:3 Changed 4 years ago by <automation>

  • Owner exarkun deleted

comment:4 Changed 2 years ago by argonemyth

  • Cc fei@… added
  • Keywords imap fetch bodystructure added
  • Owner set to argonemyth
Note: See TracTickets for help on using tickets.