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 112 def check_host_authorization! 113 r = @_request 114 return if host_authorized?(_convert_host_for_authorization(r.env["HTTP_HOST"].to_s.dup)) 115 116 if self.class.host_authorization_check_forwarded? && (host = r.env["HTTP_X_FORWARDED_HOST"]) 117 if i = host.rindex(',') 118 host = host[i+1, 10000000].to_s 119 end 120 host = _convert_host_for_authorization(host.strip) 121 122 if !host.empty? && host_authorized?(host) 123 return 124 end 125 end 126 127 r.on do 128 host_authorization_unauthorized(r) 129 end 130 end