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

Control flow clarifications/simplifications (and partly minor optimisations/fixes) #14

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ap
Copy link

@ap ap commented Feb 16, 2019

What it says on the tin.

I also have another inessential commit on top of this branch: a983e2e — Should I add it to this branch/PR?

ap added 10 commits February 16, 2019 18:22
Since $encoding is initialised to `identity` and only possibly assigned
one of the values of the `for` loop, it can never have a value other
than `gzip`, `deflate`, or `identity`.
At this point, $encoding can never have a value other than `gzip` or
`deflate`, so this condition will always be true.
Since we are assigning to $encoder unconditionally, it is obviously
silly to then check if we have an $encoder.
We always return a response, just not always an encoded one. All we
really check for is, does the client accept one of the encodings we
make, or does it not. So it is pointless to scan for the `identity`
encoding: it is simply among the encodings we do not make.
The `ref` function handle undefined input and always produces a defined
output so it is a waste of time to work up to the final check by testing
each component subexpression first.
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.

1 participant