-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Strip CRLF from headers before parsing #68328
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
base: master
Are you sure you want to change the base?
Conversation
dc9355a
to
7f49620
Compare
if write_body[0] is None: | ||
try: | ||
hdr = parse_response_start_line(hdr) | ||
hdr = parse_response_start_line(hdr.strip()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hdr.strip() is also called back on like 688: if not hdr.strip() and "Content-Type" not in write_body[1]:
. Maybe refactor this to an assignment stripped_hdr = hdr.strip()
on line 685 and use stripped_hdr everywhere hdr is used.
Also can you rename this return variable to something like response_start
? parse_response_start_line
does not return a header and this is very confusing that we assign the response to the same hdr
variable name. Or we could go ahead and split out the tuple since we only care about the code (_, code, *_) = parse_response_start_line(hdr.strip())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will also need a test, please.
What does this PR do?
After Tornado 6.4, 6.5 and later break compatibility in the
parse_response_start_line
, which no longer accepts CRLF. See [0] for more information.This change ensures that fileclient tests (and functionality) do not break when you decide to upgrade Tornado :).
[0] tornadoweb/tornado#3540
What issues does this PR fix or reference?
Previous Behavior
Fileclient download functionality (used e.g. in
cp.cache_file
) is broken with Tornado > 6.4.New Behavior
Fileclient download functionality works with Tornado > 6.4.
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes