]> granicus.if.org Git - python/commitdiff
Tests for message/external-body and for duplicate boundary lines.
authorBarry Warsaw <barry@python.org>
Tue, 11 May 2004 22:23:59 +0000 (22:23 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 11 May 2004 22:23:59 +0000 (22:23 +0000)
Lib/email/FeedParser.py

index d28170e9496c914b00ba7dab332626ad8b9d5a54..294a6a5a789f83574c3f2987d9fba3b12f690456 100644 (file)
@@ -306,9 +306,18 @@ class FeedParser:
                         capturing_preamble = False
                         self._input.unreadline(line)
                         continue
-                    # We saw a boundary separating two parts.  Recurse to
-                    # parse this subpart; the input stream points at the
-                    # subpart's first line.
+                    # We saw a boundary separating two parts.  Consume any
+                    # multiple boundary lines that may be following.  Our
+                    # interpretation of RFC 2046 BNF grammar does not produce
+                    # body parts within such double boundaries.
+                    while True:
+                        line = self._input.readline()
+                        mo = boundaryre.match(line)
+                        if not mo:
+                            self._input.unreadline(line)
+                            break
+                    # Recurse to parse this subpart; the input stream points
+                    # at the subpart's first line.
                     self._input.push_eof_matcher(boundaryre.match)
                     for retval in self._parsegen():
                         if retval is NeedMoreData: