Skip to content

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Mar 15, 2023

There were concerns that the caching based on the class may cause unexpected behaviour: #2056 (comment)

So we change to cache based on the identity of the object.

This still has some short-comings, e.g. it's easy to modify the query parser AFTER it's used which won't invalidate the cache, but I think no matter how you cut this, the problem still exists.

@ioquatix ioquatix force-pushed the rack-request-cache-key branch from fa0e20f to 534ab35 Compare March 15, 2023 21:10
Change the cache hash table to use `compare_by_identity` for improved
semantics/performance.
@ioquatix ioquatix force-pushed the rack-request-cache-key branch from 534ab35 to f669e22 Compare March 15, 2023 21:11
@ioquatix ioquatix merged commit 5f90c33 into rack:main Mar 16, 2023
@ioquatix ioquatix deleted the rack-request-cache-key branch March 16, 2023 01:13
jeremyevans added a commit to jeremyevans/rack that referenced this pull request Mar 16, 2023
ioquatix pushed a commit that referenced this pull request Mar 16, 2023
* Revert "Prefer to use `query_parser` itself as the cache key. (#2058)"

This reverts commit 5f90c33.

* Revert "Fix handling of cached values in `Rack::Request`. (#2054)"

This reverts commit d25fedd.

* Revert "Add `QueryParser#missing_value` for handling missing values + tests. (#2052)"

This reverts commit 59d9ba9.

* Revert "Split form/query parsing into two steps (#2038)"

This reverts commit 9f059d1.

* Make query parameters without = have nil values

This was Rack's historical behavior.  While it doesn't match
URL spec section 5.1.3.3, keeping the historical behavior avoids
all of the complexity required to support the URL spec standard
by default, but also support frameworks that want to be backwards
compatible.

This keeps as much of the specs added by the recently reverted
commits that make sense.
ioquatix added a commit to socketry/rack that referenced this pull request Mar 16, 2023
* Revert "Prefer to use `query_parser` itself as the cache key. (rack#2058)"

This reverts commit 5f90c33.

* Revert "Fix handling of cached values in `Rack::Request`. (rack#2054)"

This reverts commit d25fedd.

* Revert "Add `QueryParser#missing_value` for handling missing values + tests. (rack#2052)"

This reverts commit 59d9ba9.

* Revert "Split form/query parsing into two steps (rack#2038)"

This reverts commit 9f059d1.

* Make query parameters without = have nil values

This was Rack's historical behavior.  While it doesn't match
URL spec section 5.1.3.3, keeping the historical behavior avoids
all of the complexity required to support the URL spec standard
by default, but also support frameworks that want to be backwards
compatible.

This keeps as much of the specs added by the recently reverted
commits that make sense.
# Conflicts:
#	lib/rack/multipart.rb
#	lib/rack/request.rb
#	test/spec_request.rb
ioquatix added a commit that referenced this pull request Mar 16, 2023
* Revert "Prefer to use `query_parser` itself as the cache key. (#2058)"

This reverts commit 5f90c33.

* Revert "Fix handling of cached values in `Rack::Request`. (#2054)"

This reverts commit d25fedd.

* Revert "Add `QueryParser#missing_value` for handling missing values + tests. (#2052)"

This reverts commit 59d9ba9.

* Revert "Split form/query parsing into two steps (#2038)"

This reverts commit 9f059d1.

* Make query parameters without = have nil values

This was Rack's historical behavior.  While it doesn't match
URL spec section 5.1.3.3, keeping the historical behavior avoids
all of the complexity required to support the URL spec standard
by default, but also support frameworks that want to be backwards
compatible.

This keeps as much of the specs added by the recently reverted
commits that make sense.
# Conflicts:
#	lib/rack/multipart.rb
#	lib/rack/request.rb
#	test/spec_request.rb
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