Skip to content

requests: Match response header names case-insensitively. - #1147

Open
pablogventura wants to merge 1 commit into
micropython:masterfrom
pablogventura:requests-case-insensitive-headers
Open

requests: Match response header names case-insensitively.#1147
pablogventura wants to merge 1 commit into
micropython:masterfrom
pablogventura:requests-case-insensitive-headers

Conversation

@pablogventura

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Unix test_requests.py, including lowercase transfer-encoding chunked and location redirect cases.
  • __init__.mpy (mpy-cross, compiled as __init__.py): master 3160, this PR 3169 (+9).

Signed-off-by: Pablo Ventura <pablogventura@gmail.com>
k, v = l.split(":", 1)
v = v.strip()
resp_d[k] = v
if k.lower() == "content-length":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this line now be if lowerl.startswith(b"content-length:")? That saves a call to lower() and the associated memory overhead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants