Module: Roda::RodaPlugins::HostAuthorization::InstanceMethods
- Defined in:
- lib/roda/plugins/host_authorization.rb
Instance Method Summary collapse
-
#check_host_authorization! ⇒ Object
Check whether the host is authorized.
Instance Method Details
#check_host_authorization! ⇒ Object
Check whether the host is authorized. If not authorized, return a response immediately based on the plugin block.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/roda/plugins/host_authorization.rb', line 107 def r = @_request return if ((r.env["HTTP_HOST"].to_s.dup)) if opts[:host_authorization_check_forwarded] && (host = r.env["HTTP_X_FORWARDED_HOST"]) if i = host.rindex(',') host = host[i+1, 10000000].to_s end host = (host.strip) if !host.empty? && (host) return end end r.on do (r) end end |