Skip to content

Conversation

m-czernek
Copy link
Contributor

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

if write_body[0] is None:
try:
hdr = parse_response_start_line(hdr)
hdr = parse_response_start_line(hdr.strip())
Copy link
Contributor

@bdrx312 bdrx312 Sep 15, 2025

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())

Copy link
Contributor

@twangboy twangboy left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test:full Run the full test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants