You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
http client marks valid multipart headers with defects. #74177
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).
Looks like a duplicate of bpo-29353, which has a more complete patch proposed. However, see my comment about a problem with using heartersonly=True.
My policy-flag.v2.patch for bpo-24363 may help (the details have faded from my mind, but I suspect it will either fix the problem as-is, or could be adapted).
Activity
pareshverma91 commentedon Apr 5, 2017
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 serverand run client with:
python .\example_bug.py clientwhich 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:
urllib3/urllib3#800
Azure/azure-storage-python#167
The submitted PR partially fixes the problem:
..\python.bat .\example_bug.py clientwhich outputs
"""[MultipartInvariantViolationDefect()]"""
vadmium commentedon Apr 5, 2017
Looks like a duplicate of bpo-29353, which has a more complete patch proposed. However, see my comment about a problem with using heartersonly=True.
My policy-flag.v2.patch for bpo-24363 may help (the details have faded from my mind, but I suspect it will either fix the problem as-is, or could be adapted).