FAQ
Hi,

with issues 4411 and 4771 closed, mime/multipart now supports decoding
quoted printable MIME parts, which is pretty nice. Issue 4771 was already
about making the parser more lenient to unescaped \r\n, and I wonder if
that is enough for dealing with "real life" emails. I have a couple of
emails which are announced as "quoted-printable" (and they are, for example
a link has its "href" encoded as href=3D"http://foo.bar"), however the
piece of code generating this email didn't take care of encoding stuff
outside the US-ASCII range, so I have chars like ä (0xE4 in ISO-8859-1)
which are unescaped.
So far, the parser chokes on them and spits an error, which is probably a
sane default. That said, I wouldn't mind having a way to tell the parser
that "it's OK, just let those bytes through". I used to use
https://github.com/sloonz/go-qprintable before 4411 got merged, and that
one didn't seem to mind those unescaped bytes.

My questions would then be:
- Does anyone has any idea of how one could control how emails get parsed?
I can't see an elegant way of doing that, apart from adding some kind of
flags on the parser
- Should we stick to a strict parser, is my only solution to duplicate the
whole net/mail and deps in my source tree, or is there a nicer alternative?

Cheers

Adrien

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • David Symonds at Apr 1, 2013 at 12:58 am
    I don't think I'd want to change the strictness of net/mail, certainly
    not right now, just before Go 1.1. From the feedback I've heard, it's
    quite rare (though non-zero) to have these kinds of malformed mails.

    For your situation, perhaps a pre-filter to fix up the weird
    characters would be better?

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Adrien B at Apr 1, 2013 at 11:25 am
    Agreed, fixing this issue would definitely not be a "hot fix" to integrate
    before 1.1...

    I thought about "pre filtering", but then it's a bit of a chicken and egg
    problem: I can't use mime/multipart to do so (since it's too strict), so
    I'd need a secondary, more lenient parser... But then I wouldn't need
    mime/multipart anymore :-)

    The definition of "quite rare" is variable, for example the offending
    message I have here comes from O2, which is an internet provider in various
    countries. Users would be rather annoyed if they couldn't see this
    message...

    For now, I'm maintaining locally a small series of patches against go's
    tip, namely one to make the QP decoder not abort on unescaped bytes, and
    another one in net/textproto to harmonize the encoding in MIME header
    values (I have various emails where the "filename=" parameter of an
    attachment is not ASCII, but does not use the "*" syntax either to specify
    the encoding, so I rely on ICU to do encoding detection and conversion -
    probably a performance hit although I haven't quantified it yet). English
    is too easy for being a real test case, it does not have diacritics or
    things like that ;-)
    On Monday, April 1, 2013 2:58:07 AM UTC+2, David Symonds wrote:

    I don't think I'd want to change the strictness of net/mail, certainly
    not right now, just before Go 1.1. From the feedback I've heard, it's
    quite rare (though non-zero) to have these kinds of malformed mails.

    For your situation, perhaps a pre-filter to fix up the weird
    characters would be better?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tamás Gulácsi at Apr 1, 2013 at 12:06 pm
    Can you share those patches? I have to deal with horrible emails (mixed line endings, quopri with some semi-base64 escapes, etc.).
    The less things I have to deal with, the easier my fights.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Adrien B at Apr 1, 2013 at 11:20 pm
    Well the current patches are certainly not enough to deal with all kind of
    horrible messages, but hopefully I get closer to that as I get to widen my
    test set.

    Feel free to reuse whatever you find in
    https://github.com/abustany/go/tree/robust-email (I'll rebase my patches on
    top of upstream's tip from time to time, so they should always be on top of
    the history - but that also means that the branch will see non-fast-forward
    pushes, you've been warned :) ). Should you want to export the patches (for
    example to import them in a hg repo), use something like git format-patch
    master..robust-email

    Cheers

    Adrien

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 31, '13 at 6:06p
activeApr 1, '13 at 11:20p
posts5
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase