Public Instance methods
check_host_authorization!()
Check whether the host is authorized. If not authorized, return a response immediately based on the plugin block.
[show source]
# File lib/roda/plugins/host_authorization.rb 107 def check_host_authorization! 108 r = @_request 109 return if host_authorized?(_convert_host_for_authorization(r.env["HTTP_HOST"].to_s.dup)) 110 111 if opts[:host_authorization_check_forwarded] && (host = r.env["HTTP_X_FORWARDED_HOST"]) 112 if i = host.rindex(',') 113 host = host[i+1, 10000000].to_s 114 end 115 host = _convert_host_for_authorization(host.strip) 116 117 if !host.empty? && host_authorized?(host) 118 return 119 end 120 end 121 122 r.on do 123 host_authorization_unauthorized(r) 124 end 125 end