lib/rack/contrib/nonce.rb in rack-contrib-nonce-0.0.1 vs lib/rack/contrib/nonce.rb in rack-contrib-nonce-0.0.2

- old
+ new

@@ -1,28 +1,28 @@ module Rack module Contrib class Nonce - VERSION = '0.0.1' + VERSION = '0.0.2' def initialize app, opts @app = app @logger = opts[:logger] || Logger.new('/dev/null') @seen = opts[:seen] || [] @header = opts[:header] || 'Nonce' end def header_name - 'HTTP_' + @header.upcase + 'HTTP_' + @header.upcase.gsub(/-/, '_') end def call env unless env[header_name] - @logger.error "Denied: #{header} not present." + @logger.error "Denied: #{@header} not present." return [401, {}, []] end if @seen.include? env[header_name] - @logger.error "Denied: #{header} not unique." + @logger.error "Denied: #{@header} not unique." return [401, {}, []] end @seen << env[header_name]