Class: ICAPrb::FilterSolutions::Headers
- Inherits:
-
Object
- Object
- ICAPrb::FilterSolutions::Headers
- Defined in:
- lib/icaprb/filter/solution.rb
Overview
Check in headers for regex
Constant Summary collapse
- FILTER_NAME =
Name in the configuration file
'headers'- MODES =
Available mod modes
[:response_mod]
Instance Method Summary collapse
-
#initialize(_, parameters) ⇒ Headers
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) ⇒ Headers
Constructor
mode-
resp or req mod
parameters-
All parameters given in the configuration file
133 134 135 |
# File 'lib/icaprb/filter/solution.rb', line 133 def initialize(_, parameters) @params = parameters end |
Instance Method Details
#plugin(data) ⇒ Object
Execute plugin
data-
ICAP data
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/icaprb/filter/solution.rb', line 138 def plugin(data) headers = data[:http_request_header] headers.each { |header_name, header_content| @params.each { |header_target, regex_data| if header_name == header_target regex_data.each{ |current_regex| if header_content.match(current_regex) data[:http_response_body] = '<html><body>Blocked header</body></html>' return true end } end } } false end |