Skip to content

Multible http response headers with the same name get overwritten #4069

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
jonasniesner opened this issue Jun 7, 2020 · 7 comments
Closed
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@jonasniesner
Copy link

If the http client gets multible headers with the same name in the response (for example set-cookie headers), they get overwritten. My way to fix it was to change

if(_currentHeaders[i].key.equalsIgnoreCase(headerName)) {

to

if(_currentHeaders[i].key.equalsIgnoreCase(headerName) && _currentHeaders[i].value.length() == 0) {

to check if the header value is not set to avoid overwriting when saving multible headers with the same name

@lbernstone
Copy link
Contributor

lbernstone commented Jun 7, 2020

Make an edit right at that page and in the pull request mention @Jeroen88

@Jeroen88
Copy link
Contributor

Jeroen88 commented Jun 8, 2020

I just took a quick review of the code. I am not in favor of this change:

  • It does not fix the underlying problem: only one header with a specific name can exists, while a server may send more than one
  • It only changes the behavior from keeping the last header sent with a certain name to keeping the first with a certain name

A real solution would involve quite some adaptations and very likely an API change, since requestArgument (not a very good name because in this context it is used as a responseArgument) needs to accommodate an array or vector of values. This implies changes in the functions for accessing the values as well.

@stale
Copy link

stale bot commented Aug 7, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 7, 2020
@stale
Copy link

stale bot commented Aug 11, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Aug 11, 2020
@stale
Copy link

stale bot commented Oct 10, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Oct 10, 2020
@stale
Copy link

stale bot commented Oct 24, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Oct 24, 2020
me-no-dev pushed a commit that referenced this issue Feb 5, 2022
* Support concatenation of headers (as in esp8266/Arduino@1de0c34#diff-977435a9cc4619fa0b8b995085f6ae683485cf563722756bab57108b362da316 for ESP8266, fixes #4069)

* Add support for receiving, storing and sending cookies (cookie jar)

* Cookie support: Respect `secure` attribute when sending a request

* Fix missing `_secure` flag

* Comment out support concatenation of headers (not needed anymore when using cookie jar)
Jason2866 added a commit to tasmota/arduino-esp32 that referenced this issue Feb 5, 2022
* Support concatenation of headers (as in esp8266/Arduino@1de0c34#diff-977435a9cc4619fa0b8b995085f6ae683485cf563722756bab57108b362da316 for ESP8266, fixes espressif#4069)

* Add support for receiving, storing and sending cookies (cookie jar)

* Cookie support: Respect `secure` attribute when sending a request

* Fix missing `_secure` flag

* Comment out support concatenation of headers (not needed anymore when using cookie jar)

Co-authored-by: Matthias Dreher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants