lloyd/connect-etagify

Vary logic appears to be incorrect.

Opened this issue · 0 comments

I'm pretty sure you're supposed to build the lookup key from the request headers specified in the Vary response header. So if the response indicated Vary: Accept-Encoding, Accept-Language you wouldn't actually store [ 'Accept-Encoding', 'Accept-Language' ] in your data structure, I think you're supposed to store the tuple of [req.path, "gzip,deflate,sdch", "en-US,en;q=0.8"] (assuming Chrome user agent used in request). And you probably need to handle Vary: * specially.

Ideally though, as mentioned in issue #1, you'd just buffer the content and calculate the ETag directly, in which case the Vary header should be irrelevant since you're not actually acting as a cache. (i.e., if issue #1 is resolved by calculating ETag every single time, this issue becomes invalid.)