Skip to content

Fix parsing of Accept-Encoding request header#220

Merged
Nehliin merged 5 commits intotower-rs:masterfrom
mdickopp:accept-encoding-parsing
Mar 2, 2022
Merged

Fix parsing of Accept-Encoding request header#220
Nehliin merged 5 commits intotower-rs:masterfrom
mdickopp:accept-encoding-parsing

Conversation

@mdickopp
Copy link
Copy Markdown
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
Copy Markdown
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.

Copy link
Copy Markdown
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.

2 participants