Skip to content

don't duplicate accept-encoding in vary header - #2796

Merged
hueniverse merged 1 commit into
hapijs:masterfrom
ldesplat:fix-vary-duplicate
Oct 2, 2015
Merged

hueniverse merged 1 commit into
hapijs:masterfrom
ldesplat:fix-vary-duplicate

Conversation

@ldesplat

Copy link
Copy Markdown
Contributor

This is in relation hapijs/h2o2#17 .

accept-encoding value in vary header was being duplicated. This fixes the issue and adds a test case to cover the scenario.

I could have fixed it instead in lib/response.js, to not add a value if it already exists in a header but I thought that was too brittle to do there.

PS: forgot to say, I will make a lts PR if this is accepted.

Comment thread lib/transmit.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better done inside he response.vary() method in a generic way.

@ldesplat

Copy link
Copy Markdown
Contributor Author

You are right and much easier. Updated the PR. Added 1 more test and kept the old one since I thought it was still relevant.

Comment thread lib/response.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not just return here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would have but there appears to be opportunities to return early in this function and it was not done. So, I was following the current flow and decided to break. Returning early does save an allocation and I am already doing split so I just changed it. Thanks!

@ldesplat

ldesplat commented Oct 2, 2015

Copy link
Copy Markdown
Contributor Author

Any update on this? I would love to get it going so I can do a PR for lts and get h2o2 updated! Thank you :)

@hueniverse hueniverse added the bug Bug or defect label Oct 2, 2015
@hueniverse hueniverse added this to the 10.2.0 milestone Oct 2, 2015
@hueniverse hueniverse self-assigned this Oct 2, 2015
hueniverse added a commit that referenced this pull request Oct 2, 2015
don't duplicate accept-encoding in vary header
@hueniverse
hueniverse merged commit 6c5ab9f into hapijs:master Oct 2, 2015
hueniverse added a commit that referenced this pull request Oct 2, 2015
@ldesplat

ldesplat commented Oct 2, 2015

Copy link
Copy Markdown
Contributor Author

@nlf could this be included in LTS branch? h2o2 tests fail when upgrading to hapi 9.x.x otherwize.

@nlf

nlf commented Oct 2, 2015

Copy link
Copy Markdown
Member

it will be. i'll release a new LTS after 10.2.0 is released

@lock

lock Bot commented Jan 9, 2020

Copy link
Copy Markdown

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock Bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants