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

Fix parsing of Accept-Encoding request header #220

Merged
merged 5 commits into from
Mar 2, 2022
Merged

Fix parsing of Accept-Encoding request header #220

merged 5 commits into from
Mar 2, 2022

Conversation

mdickopp
Copy link
Contributor

Motivation

This PR fixes some of the issues described in bug report #215, in particular those related to parsing the Accept-Encoding header (cases 1, 2, 3, and 5).

Solution

  • Add unit tests to content_encoding
  • Represent quality values (qvalues) by a separate type
  • Parse encodings case-insensitively
  • Parse qvalues as specified in RFC 7231 section 5.3.1

* Add unit tests to content_encoding

* Represent quality values (qvalues) by a separate type

* Parse encodings case-insensitively

* Parse qvalues as specified in RFC 7231 section 5.3.1

Refs: #215
Copy link
Collaborator

@Nehliin Nehliin left a comment

Choose a reason for hiding this comment

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

Thank you for your pr! Great find and sorry for the long review delay. Have had a lot of other things on my plate. I will be faster in any follow ups on this.

tower-http/src/content_encoding.rs Outdated Show resolved Hide resolved
tower-http/src/content_encoding.rs Outdated Show resolved Hide resolved
tower-http/src/content_encoding.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Nehliin Nehliin left a comment

Choose a reason for hiding this comment

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

Great! thank you @davidpdrsn do you want to add anything?

@Nehliin Nehliin merged commit a0e8227 into tower-rs:master Mar 2, 2022
davidpdrsn pushed a commit that referenced this pull request Mar 7, 2022
* Fix parsing of Accept-Encoding request header

* Add unit tests to content_encoding

* Represent quality values (qvalues) by a separate type

* Parse encodings case-insensitively

* Parse qvalues as specified in RFC 7231 section 5.3.1

Refs: #215

* Do not use or-pattern syntax

This syntax is not supported in rust 1.51 (the minimum toolchain
version).

* Add comments to QValue::parse

* Remove redundant SupportedEncodingsAll::new function

* Add unit tests for all content-encodings (gzip, deflate, br)
@davidpdrsn davidpdrsn mentioned this pull request Mar 7, 2022
davidpdrsn added a commit that referenced this pull request Mar 7, 2022
* Release 0.2.4

- Added `CatchPanic` middleware which catches panics and converts them
  into `500 Internal Server` responses ([#214])

[#214]: #214

* Fix parsing of `Accept-Encoding` request header (#220)

* Fix parsing of Accept-Encoding request header

* Add unit tests to content_encoding

* Represent quality values (qvalues) by a separate type

* Parse encodings case-insensitively

* Parse qvalues as specified in RFC 7231 section 5.3.1

Refs: #215

* Do not use or-pattern syntax

This syntax is not supported in rust 1.51 (the minimum toolchain
version).

* Add comments to QValue::parse

* Remove redundant SupportedEncodingsAll::new function

* Add unit tests for all content-encodings (gzip, deflate, br)

* Update changelog

* add changelog groups

Co-authored-by: Martin Dickopp <martin@zero-based.org>
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.

None yet

2 participants