Skip to content

Protect against {boolean}.to_i raising on invalid stale-while-revalidate cache control directives#144

Open
matthutchinson wants to merge 1 commit into
sourcelevel:masterfrom
matthutchinson:safer-stale-while-revalidate-parsing
Open

Protect against {boolean}.to_i raising on invalid stale-while-revalidate cache control directives#144
matthutchinson wants to merge 1 commit into
sourcelevel:masterfrom
matthutchinson:safer-stale-while-revalidate-parsing

Conversation

@matthutchinson

Copy link
Copy Markdown
Contributor

Invalid cache control directives for stale-while-revalidate are raising here when we attempt to parse the integer value.

Eg. an invalid cache-control directive such as this

public, max-age=60, stale-while-revalidate

The gem converts directives without values to true here.

This PR will allow the gem to ignore these invalid values (see spec), and prevent this error from raising;

[NoMethodError] undefined method 'to_i' for true

Added tests to verify behaviour.

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