Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header folder folds incorrectly causing MissingHeaderBodySeparatorDefect #72449

Open
vincenttc mannequin opened this issue Sep 23, 2016 · 2 comments
Open

Header folder folds incorrectly causing MissingHeaderBodySeparatorDefect #72449

vincenttc mannequin opened this issue Sep 23, 2016 · 2 comments
Labels
stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@vincenttc
Copy link
Mannequin

vincenttc mannequin commented Sep 23, 2016

BPO 28262
Nosy @warsaw, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2016-09-23.21:22:55.097>
labels = ['type-bug', 'expert-email']
title = 'Header folder folds incorrectly causing MissingHeaderBodySeparatorDefect'
updated_at = <Date 2016-09-23.21:48:42.280>
user = 'https://bugs.python.org/vincenttc'

bugs.python.org fields:

activity = <Date 2016-09-23.21:48:42.280>
actor = 'r.david.murray'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['email']
creation = <Date 2016-09-23.21:22:55.097>
creator = 'vincenttc'
dependencies = []
files = []
hgrepos = []
issue_num = 28262
keywords = []
message_count = 2.0
messages = ['277299', '277302']
nosy_count = 3.0
nosy_names = ['barry', 'r.david.murray', 'vincenttc']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue28262'
versions = ['Python 3.4', 'Python 3.5', 'Python 3.6']

@vincenttc
Copy link
Mannequin Author

vincenttc mannequin commented Sep 23, 2016

Example:

X-Report-Abuse:
=?us-ascii?q?=3Chttps=3A=2F=2Fwww=2Emailitapp=2Ecom=2Freport=5Fabuse=2Ephp=3Fmid=3Dxxx-xxx-xxxx?=
=?us-ascii?q?xxxxxxxxxxxxxxxxxxxx=3D=3D-xxx-xx-xx=3E?=

When this header is parsed and reencoded as bytes using policy.default, the result is this:

X-Report-Abuse: <https://www.mailitapp.com/report_abuse.php?mid=xxx-xxx-xxxx
xxxxxxxxxxxxxxxxxxxx==-xxx-xx-xx>

Since the header does not require its value to be an encoded word, it is written as plain text. This removes the FWS between the encoded words. However, it appears that it is still seen as a, now invalid, folding point. When an email with this header is parsed again, it causes a MissingHeaderBodySeparatorDefect

@vincenttc vincenttc mannequin added topic-email type-bug An unexpected behavior, bug, or error labels Sep 23, 2016
@bitdancer
Copy link
Member

It seems to me this has been reported before, but I couldn't lay hands on the issue in a quick search. With this description of the problem and example, I think I see what is wrong. The folding algorithm is probably trying to handle the encoded words one by one instead of joining the ascii-only runs together first.

I'll try to take a look at this this weekend.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added the stdlib Python modules in the Lib dir label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants