New submission from Christian Schmidbauer <cschmidba...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue36226>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to