Skip to content

fix: Ignore max-age and s-maxage directives without a value - #152

Merged
georgeguimaraes merged 1 commit into
masterfrom
fix/integer-directives
Sep 15, 2026
Merged

georgeguimaraes merged 1 commit into
masterfrom
fix/integer-directives

Conversation

@georgeguimaraes

Copy link
Copy Markdown
Member

Follow-up to #144. max_age, shared_max_age and normalize_max_ages had the same to_i on a possibly-true value, so a bare max-age or s-maxage directive raised NoMethodError inside the middleware. All three integer directives now go through one integer_directive helper that treats a valueless directive as absent, which is also what #144 did for stale-while-revalidate.

Three new specs fail against master and pass here; 191 examples green locally on Ruby 4.0, rubocop clean.

A bare max-age or s-maxage parses as true and calling to_i on it raised NoMethodError, the same crash #144 fixed for stale-while-revalidate. Read all three integer directives through one helper that treats a valueless directive as absent, including in normalize_max_ages.
@georgeguimaraes
georgeguimaraes merged commit d7e3e91 into master Sep 15, 2026
10 checks passed
@georgeguimaraes
georgeguimaraes deleted the fix/integer-directives branch September 15, 2026 21:38
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.

1 participant