Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hash request URIs before using them as a cache key
Issue #132 notes that the caching middleware can generate keys which are too long when the input is a complex URL, leading to errors like `Errno::ENAMETOOLONG: File name too long @ rb_sysopen`. (The effective length limit depends on what cache driver you're using.) At the moment, we use the normalised request URI as the cache key. The fixes the issue by using `Digest::SHA1.hexdigest` to hash the URLs, giving us a constant 20-byte result. The trade-off of using a hash is that: * there is the potential for collisions (as rare as they will realistically be!) * performing a hash takes time
- Loading branch information