[Python-checkins] python/dist/src/Lib/email FeedParser.py,1.8,1.9

bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Sat Aug 7 17:57:54 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10203/Lib/email

Modified Files:
	FeedParser.py 
Log Message:
Resolution of SF bug #1002475 and patch #1003693; Header lines that end in
\r\n only get the \n stripped, not the \r (unless it's the last header which
does get the \r stripped).  Patch by Tony Meyer.

test_whitespace_continuation_last_header(),
test_strip_line_feed_and_carriage_return_in_headers(): New tests.

_parse_headers(): Be sure to strip \r\n from the right side of header lines.


Index: FeedParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/FeedParser.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** FeedParser.py	15 May 2004 16:26:28 -0000	1.8
--- FeedParser.py	7 Aug 2004 15:57:51 -0000	1.9
***************
*** 416,420 ****
              if lastheader:
                  # XXX reconsider the joining of folded lines
!                 self._cur[lastheader] = EMPTYSTRING.join(lastvalue)[:-1]
                  lastheader, lastvalue = '', []
              # Check for envelope header, i.e. unix-from
--- 416,421 ----
              if lastheader:
                  # XXX reconsider the joining of folded lines
!                 lhdr = EMPTYSTRING.join(lastvalue)[:-1].rstrip('\r\n')
!                 self._cur[lastheader] = lhdr
                  lastheader, lastvalue = '', []
              # Check for envelope header, i.e. unix-from
***************
*** 450,452 ****
          if lastheader:
              # XXX reconsider the joining of folded lines
!             self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip()
--- 451,453 ----
          if lastheader:
              # XXX reconsider the joining of folded lines
!             self._cur[lastheader] = EMPTYSTRING.join(lastvalue).rstrip('\r\n')



More information about the Python-checkins mailing list