We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
supported_directives
The change in #179 can cause a performance issue.
I learned that lib/secure_headers/headers/content_security_policy.rb, UserAgentParser.parse(@ua) in supported_directives is executed for each request. As user_agent_parser's author is planning to remove, UserAgentParser.parse(@ua) is problematic. Because it loads common regexps yaml file as large as 4.7k lines on every call.
UserAgentParser.parse(@ua)
According to user_agent_parser's README's recommendation, we should instantiate a user_agent_parser by UserAgentParser::Parser.new, then cache it. So, which class / object should cache a user_agent_parser?
UserAgentParser::Parser.new
The text was updated successfully, but these errors were encountered:
In the upcoming 3.x series I've moved it here: https://github.com/twitter/secureheaders/blob/dd1fd6ab751e6026431be9ecb25e8664f70ee714/lib/secure_headers.rb#L26. I'll do the same for the 2.x series. Thanks.
Sorry, something went wrong.
Cache UserAgentParser instance
48b048c
Thanks to @igrep for pointing this out. Fixes #187
2.4.3 has been released with this fix. Thanks!
You're welcome! 😄 I confirmed it works perfectly on our production environment! 🎉 Thank you very much for fixing! 👍
No branches or pull requests
Problem
The change in #179 can cause a performance issue.
I learned that lib/secure_headers/headers/content_security_policy.rb,
UserAgentParser.parse(@ua)
insupported_directives
is executed for each request.As user_agent_parser's author is planning to remove,
UserAgentParser.parse(@ua)
is problematic.Because it loads common regexps yaml file as large as 4.7k lines on every call.
Possible solution
According to user_agent_parser's README's recommendation, we should instantiate a user_agent_parser by
UserAgentParser::Parser.new
, then cache it.So, which class / object should cache a user_agent_parser?
The text was updated successfully, but these errors were encountered: