Issue 30532: email.policy.SMTP.fold() mangles long headers (original) (raw)

Created on 2017-05-31 22:08 by chris@arrai.com, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_long_mime_headers.py chris@arrai.com,2017-05-31 22:08 Test case for folding long email headers.
Pull Requests
URL Status Linked Edit
PR 1892 merged jhillacre,2017-05-31 22:52
PR 2591 merged jhillacre,2017-07-05 20:00
PR 2592 merged jhillacre,2017-07-05 20:14
Messages (10)
msg294875 - (view) Author: Chris Bradley (chris@arrai.com) Date: 2017-05-31 22:08
When email.policy.SMTP.fold() attempts to wrap a line in which a chunk that does not contain a space is longer than the maximum line length, two things go wrong: - The second line does not begin with a space, creating an invalid header. - The space before the long chunk is stripped, causing the line break to occur in an invalid place. In the attached test case, email.policy.SMTP.fold() is called on a line of the style: Content-Disposition: attachment; filename="" does not contain any spaces and increases in length with each pass. Everything works correctly when 'filename=""' fits onto one line. However, once it is longer than the maximum line length, the following happens: - the space after the semicolon is dropped - the line break often splits up the 'filename' keyword - the second line loses the initial whitespace
msg294878 - (view) Author: Joel Hillacre (jhillacre) * Date: 2017-05-31 22:54
I added a pull request that causes Chris's test to pass. I can confirm that the Chris's was not pass for me on master branch.
msg295209 - (view) Author: Joel Hillacre (jhillacre) * Date: 2017-06-05 20:14
Rebased the github PR on latest master to get the windows build passing CI. Is there anything I need to do to keep the PR moving?
msg295210 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-06-05 20:31
Ping the issue again next week if I don't get to it this weekend.
msg296584 - (view) Author: Joel Hillacre (jhillacre) * Date: 2017-06-21 21:06
> Ping the issue again next week if I don't get to it this weekend. I am a week late, but here is a ping.
msg296732 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-06-23 18:09
Just as well. I had no time last weekend. I should have time this Sunday, though.
msg296948 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-06-26 21:41
New changeset b350c22ebcbb891412e0b334afc9f0db19534e06 by R. David Murray (Joel Hillacre) in branch 'master': bpo-30532: Fix whitespace folding in certain cases https://github.com/python/cpython/commit/b350c22ebcbb891412e0b334afc9f0db19534e06
msg297843 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-06 21:28
New changeset c60d2f5e8609b040ab58c498fde23928fe9dbef5 by R. David Murray (Joel Hillacre) in branch '3.6': bpo-30532: Fix whitespace folding in certain cases (#2591) https://github.com/python/cpython/commit/c60d2f5e8609b040ab58c498fde23928fe9dbef5
msg297844 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-06 21:29
New changeset 3bbdf990a2c1b0b303b950058e3177a1bd5f697a by R. David Murray (Joel Hillacre) in branch '3.5': bpo-30532: Fix whitespace folding in certain cases (#2592) https://github.com/python/cpython/commit/3bbdf990a2c1b0b303b950058e3177a1bd5f697a
msg297845 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-06 21:30
Thanks, Joel!
History
Date User Action Args
2022-04-11 14:58:47 admin set github: 74717
2017-07-06 21:30:10 r.david.murray set status: open -> closedtype: behaviormessages: + resolution: fixedstage: backport needed -> resolved
2017-07-06 21:29:12 r.david.murray set messages: +
2017-07-06 21:28:25 r.david.murray set messages: +
2017-07-05 20:14:27 jhillacre set pull_requests: + <pull%5Frequest2663>
2017-07-05 20:00:12 jhillacre set pull_requests: + <pull%5Frequest2662>
2017-06-26 21:44:06 r.david.murray set stage: backport needed
2017-06-26 21:41:37 r.david.murray set messages: +
2017-06-23 18:09:38 r.david.murray set messages: +
2017-06-21 21:06:04 jhillacre set messages: +
2017-06-05 20:31:11 r.david.murray set messages: +
2017-06-05 20:14:17 jhillacre set messages: +
2017-05-31 22:54:51 jhillacre set nosy: + jhillacremessages: +
2017-05-31 22:52:02 jhillacre set pull_requests: + <pull%5Frequest1968>
2017-05-31 22:29:20 ned.deily set nosy: + barry, r.david.murray
2017-05-31 22:08:53 chris@arrai.com create