[New-bugs-announce] [issue29991] http client marks valid multipart headers with defects.

Paresh Verma report at bugs.python.org
Wed Apr 5 04:04:42 EDT 2017


New submission from Paresh Verma:

When http client parses a multipart response, it always taints the headers with defects. e.g.
Use the attached file to start a simple http server, using current python exec, with commands:
```python .\example_bug.py server```
and run client with:
```python .\example_bug.py client```
which outputs:
"""[StartBoundaryNotFoundDefect(), MultipartInvariantViolationDefect()]"""

even though the multipart response is correct.
This appears to be happening because http.client, when parsing headers of response doesn't specifies the headersonly option, which leads to email.feedparser to parse response body (but http.client only passes header lines for parsing in parse_headers method, and the request body isn't available to email.feedparser).

The issue has been mentioned at:
https://github.com/shazow/urllib3/issues/800
https://github.com/Azure/azure-storage-python/issues/167

The submitted PR partially fixes the problem:
```..\python.bat .\example_bug.py client```
which outputs
"""[MultipartInvariantViolationDefect()]"""

----------
components: Library (Lib)
files: example_bug.py
messages: 291165
nosy: pareshverma91
priority: normal
pull_requests: 1172
severity: normal
status: open
title: http client marks valid multipart headers with defects.
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file46780/example_bug.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29991>
_______________________________________


More information about the New-bugs-announce mailing list