Commit Graph

33 Commits (5f45b7d53361bd32ce390e12f814660a98f86aa9)

Author SHA1 Message Date
Leah Neukirchen 5f45b7d533 use appropriate integer types
Mainly found with clang -Wconversion -Wshorten-64-to-32.
7 years ago
Leah Neukirchen d4cbac0aa5 mmime: gen_qp: quote ^From and ^.$ to be safe 7 years ago
Leah Neukirchen 54435b30b6 mmime: gen_qp: encode trailing space and tab as =20/=09
See RFC2045 6.7.(3):
> It follows that an octet with decimal value 9 or 32 appearing at the
> end of an encoded line must be represented according to Rule #1.

Prefer this over generating a soft-line break and then a real line break.
7 years ago
Leah Neukirchen 66d0eff12f style 7 years ago
Leah Neukirchen 4a685de739 mmime: ensure 7bit or 8bit Content-Transfer-Encoding for message/rfc822 parts
RFC 2046, Section 5.2.1:
> No encoding other than "7bit", "8bit", or "binary" is permitted for
> the body of a "message/rfc822" entity.

(We'll generate 8bit when we have to and put the blame on the MTA.)
7 years ago
Leah Neukirchen 958ad4e9f6 mmime: disregard line length restriction for message/rfc822 attachments
Many webmail client's don't like qp-encoded message/rfc822 attachments.
7 years ago
Leah Neukirchen 613a1182ff mmime: gen_qp: ensure not to split utf8 multibyte sequences into encoded words
RFC2047, 5.(3):
> Each 'encoded-word' MUST represent an integral number of characters.
> A multi-octet character may not be split across adjacent 'encoded-
> word's.
7 years ago
Leah Neukirchen fc4e4af774 mmime: don't generate empty filenames 7 years ago
Leah Neukirchen cc7ab25814 mmime: allow setting content-disposition and overriding filename 7 years ago
Leah Neukirchen 938b2c2d31 mmime: gen_attachment: try to generate filenames as atoms, use qp for double quotes 7 years ago
Leah Neukirchen 46a44e2f22 mmime: add mblaze/raw for plain text inclusion 7 years ago
Leah Neukirchen d8976d416c mmime: add -t to override toplevel content-type 7 years ago
Leah Neukirchen 67c0a3b17c mmime: print_header: only force qp-encoding for overlong lines
Lines SHOULD not be longer than 78 chars, and we try to fold like that,
but we only enforce qp-encoding for 7-bit safe lines if they would be
longer than 998, which they MUST not be.
7 years ago
Leah Neukirchen f53e8dc672 mmime: check: allow up to 998 chars in header lines 7 years ago
Leah Neukirchen d75c446aff mmime: use RFC2231 for Content-Disposition when needed 7 years ago
Leah Neukirchen d73a3a748a mmime: gen_file: append newline to error message 7 years ago
Leah Neukirchen 2d612ce166 mmime: print_header: refactor
Simplifies the code considerably.  QP-header-wrapping now happens inside
gen_qp.  We wrap the line in advance when this will save QP-encoding, or
splitting a QP-word into two.

Fixes #20.
7 years ago
Leah Neukirchen 2b4e3aa66d clean up whitespace 7 years ago
Christian Neukirchen 2ef903a065 mmime: don't truncate a #type line when it has invalid syntax 8 years ago
Christian Neukirchen 3095d48655 mmime: ensure a new token in qp header generation 8 years ago
Christian Neukirchen f56755cffd mman: gen_file: slurp the file instead of mmap 8 years ago
Christian Neukirchen 0b2e4880f5 mmime: gen_build: don't crash on #-line without space 8 years ago
Christian Neukirchen 472a74b75b use getdelim instead of getline
Avoids weird macros to build on FreeBSD.
8 years ago
Christian Neukirchen f9226dde7b mmime: generate LF before MIME boundaries 8 years ago
Christian Neukirchen d138866fd6 mmime: line length must be <=78 8 years ago
Christian Neukirchen c4822a983b mmime: add -c to check if MIME-encoding is needed 8 years ago
Christian Neukirchen 2073102d4d mmime: add -r for plain text 8 years ago
Christian Neukirchen a52af29aa9 mmime: simplify 8 years ago
Christian Neukirchen cf594afb83 mmime: fix prevq logic 8 years ago
Christian Neukirchen 0ce958a22c mmime: only qp after newline when actually needed 8 years ago
Christian Neukirchen c6d4c79771 mmime: delete dead store
Found by clang-analyzer.
8 years ago
Christian Neukirchen b8c2685a60 mmime: encode headers when neccessary
This is still a bit clumsy, but I'm not sure how to make it better.
8 years ago
Christian Neukirchen 9545981777 add mmime 8 years ago