Skip to content
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

accept-encoding can contain whitespace #26

Merged
merged 3 commits into from
Apr 10, 2018

Conversation

JimmyHurrah
Copy link
Contributor

This will allow whitepsaces in accept-encoding headers.

While working on #25 I discovered that accept headers with whitespace did not work.

Taken from a real request in the wild accept-encoding: "br, gzip, deflate"

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

index.js Outdated
@@ -132,10 +132,10 @@ function getEncodingHeader (request) {
if (!header) return undefined
var acceptEncodings = header.split(',')
for (var i = 0; i < acceptEncodings.length; i++) {
if (supportedEncodings.indexOf(acceptEncodings[i]) > -1) {
return acceptEncodings[i]
if (supportedEncodings.indexOf(acceptEncodings[i].trim()) > -1) {
Copy link
Member

@delvedor delvedor Apr 10, 2018

Choose a reason for hiding this comment

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

Can you cache the value?

var acceptEncoding = acceptEncodings[i].trim()

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

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

LGTM

Can you resolve the conflicts?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@delvedor delvedor merged commit a9c2f99 into fastify:master Apr 10, 2018
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.

3 participants