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

[WIP] Append header duplicate headers when http error #54722

Open
wants to merge 5 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@Lunik
Copy link
Contributor

Lunik commented Apr 2, 2019

SUMMARY

When http return error, headers are not concatenated when receiv multiple with the same name

Fixe #54721

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

module_utils/urls

ADDITIONAL INFORMATION

Append header duplicate headers when http error
# Don't be lossy, append header values for duplicate headers
# In Py2 there is nothing that needs done, py2 does this for us
@Lunik

This comment has been minimized.

Copy link
Contributor Author

Lunik commented Apr 3, 2019

ready_for_review

@sivel sivel self-assigned this Apr 3, 2019

@sivel sivel removed the needs_triage label Apr 3, 2019

@sivel
Copy link
Member

sivel left a comment

This should also be accompanied by a changelog fragment in changelog/fragments

Show resolved Hide resolved lib/ansible/module_utils/urls.py Outdated

@Lunik Lunik force-pushed the Lunik:patch-1 branch from e5f1185 to c1a4eb7 Apr 10, 2019

@@ -1351,21 +1368,8 @@ def fetch_url(module, url, data=None, headers=None, method=None,
follow_redirects=follow_redirects, client_cert=client_cert,
client_key=client_key, cookies=cookies, use_gssapi=use_gssapi,
unix_socket=unix_socket)
# Lowercase keys, to conform to py2 behavior, so that py3 and py2 are predictable
info.update(dict((k.lower(), v) for k, v in r.info().items()))

This comment has been minimized.

Copy link
@sivel

sivel Apr 10, 2019

Member

I believe we still need this info.update here. There are cases where r.info() is more than just headers iirc.

And I had completely forgotten that my normalize_headers didn't do anything with lowercasing. So we'll need to add lowercasing back in. Although I'd recommend not doing the lowercasing in normalize_headers. I'd still do that on info, since it is a specific implementation detail of fetch_url.

This comment has been minimized.

Copy link
@Lunik

Lunik Apr 10, 2019

Author Contributor

We can keep lowercase in normalize_headers function and add an extra argument to the function to activate lowercasing (false by default) ?

@ansibot ansibot removed the stale_ci label Apr 10, 2019

Lunik added some commits Apr 10, 2019

@Lunik Lunik changed the title Append header duplicate headers when http error [WIP] Append header duplicate headers when http error Apr 10, 2019

@ansibot ansibot added the WIP label Apr 10, 2019

@ansibot ansibot added the stale_ci label Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.