From 118e854889de318192f6ef7d3ad55c42dbedfd00 Mon Sep 17 00:00:00 2001 From: Scott Kitterman Date: Sat, 13 Apr 2019 15:05:04 -0400 Subject: [PATCH] - Clarify the crlf does not count towards line length in fold (LP: #1823008) --- ChangeLog | 3 +++ dkim/__init__.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2176499..0ce4031 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ UNRELEASED Version 0.9.2 - Don't log message headers and body unless explicitely requested. This should also reduce memory usage on large messages. (Jonathan Bastien-Filiatrault). + - Clarify the crlf does not count towards line length in fold + (LP: #1823008) + 2018-12-09 Version 0.9.1 - Fixed ARC verification to fail if h= tag is present in Arc-Seal and added tests diff --git a/dkim/__init__.py b/dkim/__init__.py index 5a1708a..b98f6b9 100644 --- a/dkim/__init__.py +++ b/dkim/__init__.py @@ -368,7 +368,8 @@ def text(s): def fold(header, namelen=0): - """Fold a header line into multiple crlf-separated lines at column 72. + """Fold a header line into multiple crlf-separated lines of text at column + 72. The crlf does not count for line length. >>> text(fold(b'foo')) 'foo' @@ -382,6 +383,8 @@ def fold(header, namelen=0): 'x' >>> text(fold(b'xyz'*24)) 'xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz' + >>> len(fold('abxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxy\\r\\n')) + 78 """ # 72 is the max line length we actually want, but the header field name # has to fit in the first line too (See Debian Bug #863690).