Skip to content

Set headersonly for parsing header data.#996

Closed
pareshverma91 wants to merge 1 commit into
python:masterfrom
pareshverma91:fix-multipart-parse-warning
Closed

Set headersonly for parsing header data.#996
pareshverma91 wants to merge 1 commit into
python:masterfrom
pareshverma91:fix-multipart-parse-warning

Conversation

@pareshverma91

Copy link
Copy Markdown

http.client's parse_headers ends up providing only header data to parsestr, but
doesn't set the headersonly option. This ends up generating warning for
StartBoundaryNotFoundDefect. This only corrects this defect.

urllib3/urllib3#800 is related.

http.client's parse_headers ends up providing only header data to parsestr, but
doesn't set the headersonly option. This ends up generating warning for
StartBoundaryNotFoundDefect. This only corrects this defect.
@mention-bot

Copy link
Copy Markdown

@pareshverma91, thanks for your PR! By analyzing the history of the files in this pull request, we identified @serhiy-storchaka, @orsenthil and @vadmium to be potential reviewers.

@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA. This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

Comment thread Lib/http/client.py
break
hstring = b''.join(headers).decode('iso-8859-1')
return email.parser.Parser(_class=_class).parsestr(hstring)
return email.parser.Parser(_class=_class).parsestr(hstring, headersonly=True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a change like this, please

  1. Please create bugs.python.org ticket, and show us the problem with steps to reproduce.
  2. Show how this fixes along with a tests.
  3. We need to document this too.

This patch is incomplete (even for review) without all three above.

@pareshverma91 pareshverma91 Apr 5, 2017

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I have created a bug at https://bugs.python.org/issue29991. I will soon send out an update to the PR with some tests.

@louisom

louisom commented Apr 5, 2017

Copy link
Copy Markdown
Contributor

@pareshverma91 small problem, the title of this commit should change, start with bpo-29991: .

@pareshverma91

Copy link
Copy Markdown
Author

It seems the same resolution was suggested under https://bugs.python.org/issue29353 2 months ago. The discussion is still ongoing, but closing this PR and the corresponding bug as duplicate. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants