[pear/Mail_Mime] 402084: Correct soft line breaks to be RFC compliant.

[email protected] (Aleksander Machniak)
Newsgroups php.pear.cvs
Message-ID <pear/Mail_Mime/push/refs/heads/master/[email protected]>
  Branch: refs/heads/master
  Home:   https://github.com/pear/Mail_Mime
  Commit: 4020840472f3e8935e275f6574676d199061c493
      https://github.com/pear/Mail_Mime/commit/4020840472f3e8935e275f6574676d199061c493
  Author: Andreas Thienemann <[email protected]>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M Mail/mimePart.php
    M tests/encoding_case.phpt
    A tests/test_linebreak_larger_76.phpt

  Log Message:
  -----------
  Correct soft line breaks to be RFC compliant.

RFC 2045 says (https://tools.ietf.org/html/rfc2045#section-6.7):

    (5)   (Soft Line Breaks) The Quoted-Printable encoding
          REQUIRES that encoded lines be no more than 76
          characters long.  If longer lines are to be encoded
          with the Quoted-Printable encoding, "soft" line breaks
          must be used.  An equal sign as the last character on a
          encoded line indicates such a non-significant ("soft")
          line break in the encoded text.

The current code incorrectly did line breaks at 75 chars. This
behavior is RFC complient but it leads to unnecessary line breaks
when none are needed.

Fix this off-by-one error and add a check to verify correct line break
behavior.

Fixup test case for tab encoding as it assumes previous behavior.


  Commit: ff75641b2bc123c763792bce3d808beedc6b3e0b
      https://github.com/pear/Mail_Mime/commit/ff75641b2bc123c763792bce3d808beedc6b3e0b
  Author: Andreas Thienemann <[email protected]>
  Date:   2020-09-25 (Fri, 25 Sep 2020)

  Changed paths:
    M Mail/mimePart.php
    A tests/test_linebreak_dot.phpt

  Log Message:
  -----------
  Correct linebreaks for lines ending in dots and length >74

Currently code in quotedPrintableEncode() has code to ensure that a dot
that would end up at the beginning of a line due to soft line breaks,
is properly encoded. This _should_ not be necessary as RFC2821 (4.5.2)
expect the SMTP client to correctly double escape a single dot to two
dots, but Bug #11731 suggests, this might not be the case with all
setups.

Unfortunatly the current code suffers from a miscalculation, where the
line length is calculated based on an already encoded dot at the end of
the line which effectively leads to an off-by-one and an unnecesary
line-break if the line is ending in a dot and is 75 chars long.

Fix the calculation of maximum line length to only consider the
unescaped dot plus the soft line break (=) character only if there's
actually a linebreak needed.

Test added as well.


  Commit: c7e063fb18cdb909a916199d55f4ae901a1ac13e
      https://github.com/pear/Mail_Mime/commit/c7e063fb18cdb909a916199d55f4ae901a1ac13e
  Author: Andreas Thienemann <[email protected]>
  Date:   2020-09-26 (Sat, 26 Sep 2020)

  Changed paths:
    M Mail/mimePart.php
    M tests/encoding_case.phpt
    A tests/qp_encoding_test.phpt

  Log Message:
  -----------
  Ensure we _really_ got all linebreak cases

The tab test failed and uncovered one edge case where the lines
would not be broken in time.
Fix this.


  Commit: 1f80999bf411bd78ed758beb24c00b8b6f0dfd9d
      https://github.com/pear/Mail_Mime/commit/1f80999bf411bd78ed758beb24c00b8b6f0dfd9d
  Author: Andreas Thienemann <[email protected]>
  Date:   2020-09-27 (Sun, 27 Sep 2020)

  Changed paths:
    M tests/qp_encoding_test.phpt

  Log Message:
  -----------
  Rework test to also escape input when printing...


  Commit: 3e482f6eb89cfd2cf0f061acbc64083791a9fce4
      https://github.com/pear/Mail_Mime/commit/3e482f6eb89cfd2cf0f061acbc64083791a9fce4
  Author: Aleksander Machniak <[email protected]>
  Date:   2020-10-03 (Sat, 03 Oct 2020)

  Changed paths:
    M Mail/mimePart.php
    A tests/qp_encoding_test.phpt
    A tests/test_linebreak_dot.phpt
    A tests/test_linebreak_larger_76.phpt

  Log Message:
  -----------
  Merge pull request #23 from ixs/fix_linebreaks

Fix linebreaks


Compare: https://github.com/pear/Mail_Mime/compare/7e203f3786a5...3e482f6eb89c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.