Skip to content

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

Closed
@jonasniesner

Description

@jonasniesner

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

Activity

lbernstone

lbernstone commented on Jun 7, 2020

@lbernstone
Contributor

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

Jeroen88

Jeroen88 commented on Jun 8, 2020

@Jeroen88
Contributor

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

stale commented on Aug 7, 2020

@stale

[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 commented on Aug 11, 2020

@stale

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

stale

stale commented on Oct 10, 2020

@stale

[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 commented on Oct 24, 2020

@stale

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

added a commit that references this issue on Feb 5, 2022
added a commit that references this issue on Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Multible http response headers with the same name get overwritten · Issue #4069 · espressif/arduino-esp32