lib/rack/auth/abstract/handler.rb in rack-0.9.1 vs lib/rack/auth/abstract/handler.rb in rack-1.0.0
- old
+ new
@@ -6,22 +6,31 @@
class AbstractHandler
attr_accessor :realm
- def initialize(app, &authenticator)
- @app, @authenticator = app, authenticator
+ def initialize(app, realm=nil, &authenticator)
+ @app, @realm, @authenticator = app, realm, authenticator
end
private
def unauthorized(www_authenticate = challenge)
- return [ 401, { 'WWW-Authenticate' => www_authenticate.to_s }, [] ]
+ return [ 401,
+ { 'Content-Type' => 'text/plain',
+ 'Content-Length' => '0',
+ 'WWW-Authenticate' => www_authenticate.to_s },
+ []
+ ]
end
def bad_request
- [ 400, {}, [] ]
+ return [ 400,
+ { 'Content-Type' => 'text/plain',
+ 'Content-Length' => '0' },
+ []
+ ]
end
end
end
end