Skip to content

Retrieving HTTP header parameters should be case-insensitive using HTTPClient #8524

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

Closed
1 task done
TeepMZ opened this issue Aug 14, 2023 · 1 comment · Fixed by #8713
Closed
1 task done

Retrieving HTTP header parameters should be case-insensitive using HTTPClient #8524

TeepMZ opened this issue Aug 14, 2023 · 1 comment · Fixed by #8713
Assignees
Labels
Area: Libraries Issue is related to Library support. Status: In Progress ⚠️ Issue is in progress Type: Bug 🐛 All bugs

Comments

@TeepMZ
Copy link

TeepMZ commented Aug 14, 2023

Related area

it is related to Http request using HTTPClient

Hardware specification

ESP32-WROOM-DA-MODULE

Is your feature request related to a problem?

No

Describe the solution you'd like

Using the HTTPClient library to read a response received from the server via the HTTP protocol, we can use the collectHeaders and header functions to obtain specific header parameter values. Currently, the String HTTPClient::header(const char* name) function is case-sensitive. However, certain server containers might employ lowercase for all header parameters. Consequently, it would be advantageous for the HTTPClient::header function to be case-insensitive when searching for a specific parameter.

PS: A similar behavior is observed in the HTTPClient::handleHeaderResponse function, where the "equalsIgnoreCase" function is employed to verify the existence of a header key
Lib link : libraries/HTTPClient

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@TeepMZ TeepMZ added the Type: Feature request Feature request for Arduino ESP32 label Aug 14, 2023
@lucasssvaz lucasssvaz self-assigned this Sep 13, 2023
@lucasssvaz lucasssvaz added Type: Bug 🐛 All bugs Area: Libraries Issue is related to Library support. Status: In Progress ⚠️ Issue is in progress and removed Type: Feature request Feature request for Arduino ESP32 labels Sep 13, 2023
@lucasssvaz
Copy link
Collaborator

You are correct, the comparison in HTTPClient::header(const char* name) should be case-insensitive to conform to the RFC. I'll open a PR to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Libraries Issue is related to Library support. Status: In Progress ⚠️ Issue is in progress Type: Bug 🐛 All bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants