[Patches] [ python-Patches-471400 ] quopri.py fix: escape single-dot lines

noreply@sourceforge.net noreply@sourceforge.net
Mon, 15 Oct 2001 11:25:58 -0700


Patches item #471400, was opened at 2001-10-15 11:25
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=471400&group_id=5470

Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason Hildebrand (jdhildeb)
Assigned to: Nobody/Anonymous (nobody)
Summary: quopri.py fix: escape single-dot lines

Initial Comment:
This is a patch against the CVS (head) version of
quopri.py, which ensures that the encoding never outputs
lines which consist of a single dot '.' (as recommended
by RFC 2049), since this can cause parts of messages to
get dropped when they are submitted via SMTP or via
/usr/lib/sendmail.

The patch fixes this problem by encoding the '.' as
'=2E' if it occurs on a line by itself.

In previous versions of quopri.py, line wrapping due to
the 76 character limit could cause single-dot lines to
be created; this does not appear to be a problem in the
current version because the line length is calculated
differently.  However, a '.' on a line by itself may
appear in the input, so this case still needs to be
handled.

--- /tmp/quopri.py	Mon Oct 15 12:50:43 2001
+++ quopri.py	Mon Oct 15 13:06:10 2001
@@ -61,6 +61,8 @@
         # that trailing character encoded.
         if s and s[-1:] in ' \t':
             output.write(s[:-1] + quote(s[-1]) + lineEnd)
+        elif s == '.':
+            output.write( quote(s) + lineEnd)
         else:
             output.write(s + lineEnd)
 


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=471400&group_id=5470