Class: ICAPrb::FilterSolutions::ContentHasKey
- Inherits:
-
Object
- Object
- ICAPrb::FilterSolutions::ContentHasKey
- Defined in:
- lib/icaprb/filter/solution.rb
Overview
Check if any attribute keys matching
Constant Summary collapse
- FILTER_NAME =
Name in the configuration file
'content_has_key'- MODES =
Available mod modes
[:response_mod]
Instance Method Summary collapse
-
#initialize(_, parameters) ⇒ ContentHasKey
constructor
- Constructor
mode - resp or req mod
parameters -
All parameters given in the configuration file.
- resp or req mod
- Constructor
-
#plugin(data) ⇒ Object
- Execute plugin
data -
ICAP data.
- Execute plugin
Constructor Details
#initialize(_, parameters) ⇒ ContentHasKey
Constructor
mode-
resp or req mod
parameters-
All parameters given in the configuration file
164 165 166 |
# File 'lib/icaprb/filter/solution.rb', line 164 def initialize(_, parameters) @params = parameters end |
Instance Method Details
#plugin(data) ⇒ Object
Execute plugin
data-
ICAP data
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/icaprb/filter/solution.rb', line 169 def plugin(data) doc = Nokogiri::HTML(data[:http_response_body]) doc.traverse do |node| node.keys.each do |key| @params.each do |attribute_key| if key == attribute_key data[:http_response_body] = '<html><body>Blocked attribute key</body></html>' return true end end end end false end |