[New-bugs-announce] [issue36226] multipart/related header causes false positive StartBoundaryNotFoundDefect and MultipartInvariantViolationDefect

Christian Schmidbauer report at bugs.python.org
Thu Mar 7 10:31:17 EST 2019


New submission from Christian Schmidbauer <cschmidbauer at genesiscloud.com>:

The current implementation of `multipart/related` in urllib triggers header defects even though the headers are valid:
`[StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()]`

The example header is valid according to RFC 2387 (https://tools.ietf.org/html/rfc2387):
```
Content-Type: multipart/related; boundary="==="

```

Both defects are triggered by the fact that httplib only passes on headers to the underlying email parser, while the email parser assumes to receive a full message. The simple fix is to tell the underlying email parser that we are only passing the header: 0a89fc15c93c271eb08e46e2cda9a72adb97d633

The second issue is related, but independent: The underlying email parser checks if the parsed message is of type multipart by checking of the object "root" is of type list. As we only passed the header (and set `headersonly=True`), the check does makes no sense anymore at this point, creating a false positive: fdc7c47b77e330a36255fd00dc36accd72824e5b

----------
components: Library (Lib)
messages: 337395
nosy: Christian Schmidbauer
priority: normal
severity: normal
status: open
title: multipart/related header causes false positive StartBoundaryNotFoundDefect and MultipartInvariantViolationDefect
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36226>
_______________________________________


More information about the New-bugs-announce mailing list