Permalink
Browse files

Go back to depending on Rack 1.0.x gem

  • Loading branch information...
1 parent 18e68d9 commit f36d9a67582a857720aecf835917748163baa5a6 @josh josh committed Jul 13, 2009
Showing with 2 additions and 5,420 deletions.
  1. +2 −6 actionpack/lib/action_controller.rb
  2. +0 −90 actionpack/lib/action_controller/vendor/rack-1.0.x/rack.rb
  3. +0 −22 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/adapter/camping.rb
  4. +0 −37 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/abstract/handler.rb
  5. +0 −37 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/abstract/request.rb
  6. +0 −58 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/basic.rb
  7. +0 −124 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/digest/md5.rb
  8. +0 −51 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/digest/nonce.rb
  9. +0 −55 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/digest/params.rb
  10. +0 −40 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/digest/request.rb
  11. +0 −487 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/auth/openid.rb
  12. +0 −63 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/builder.rb
  13. +0 −41 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/cascade.rb
  14. +0 −49 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/chunked.rb
  15. +0 −52 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/commonlogger.rb
  16. +0 −47 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/conditionalget.rb
  17. +0 −29 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/content_length.rb
  18. +0 −23 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/content_type.rb
  19. +0 −96 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/deflater.rb
  20. +0 −153 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/directory.rb
  21. +0 −88 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/file.rb
  22. +0 −69 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler.rb
  23. +0 −61 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/cgi.rb
  24. +0 −8 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/evented_mongrel.rb
  25. +0 −88 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/fastcgi.rb
  26. +0 −55 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/lsws.rb
  27. +0 −84 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/mongrel.rb
  28. +0 −59 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/scgi.rb
  29. +0 −8 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/swiftiplied_mongrel.rb
  30. +0 −18 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/thin.rb
  31. +0 −68 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/handler/webrick.rb
  32. +0 −19 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/head.rb
  33. +0 −537 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/lint.rb
  34. +0 −65 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/lobster.rb
  35. +0 −16 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/lock.rb
  36. +0 −27 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/methodoverride.rb
  37. +0 −204 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/mime.rb
  38. +0 −184 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/mock.rb
  39. +0 −57 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/recursive.rb
  40. +0 −106 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/reloader.rb
  41. +0 −248 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/request.rb
  42. +0 −183 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/response.rb
  43. +0 −98 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/rewindable_input.rb
  44. +0 −142 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/session/abstract/id.rb
  45. +0 −91 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/session/cookie.rb
  46. +0 −109 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/session/memcache.rb
  47. +0 −100 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/session/pool.rb
  48. +0 −349 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/showexceptions.rb
  49. +0 −106 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/showstatus.rb
  50. +0 −38 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/static.rb
  51. +0 −55 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/urlmap.rb
  52. +0 −520 actionpack/lib/action_controller/vendor/rack-1.0.x/rack/utils.rb
@@ -31,12 +31,8 @@
end
end
-begin
- gem 'rack', '~> 1.0.0'
- require 'rack'
-rescue Gem::LoadError
- require 'action_controller/vendor/rack-1.0.x/rack'
-end
+gem 'rack', '~> 1.0.0'
+require 'rack'
module ActionController
# TODO: Review explicit to see if they will automatically be handled by
@@ -1,90 +0,0 @@
-# Copyright (C) 2007, 2008, 2009 Christian Neukirchen <purl.org/net/chneukirchen>
-#
-# Rack is freely distributable under the terms of an MIT-style license.
-# See COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-path = File.expand_path(File.dirname(__FILE__))
-$:.unshift(path) unless $:.include?(path)
-
-
-# The Rack main module, serving as a namespace for all core Rack
-# modules and classes.
-#
-# All modules meant for use in your application are <tt>autoload</tt>ed here,
-# so it should be enough just to <tt>require rack.rb</tt> in your code.
-
-module Rack
- # The Rack protocol version number implemented.
- VERSION = [1,0]
-
- # Return the Rack protocol version as a dotted string.
- def self.version
- VERSION.join(".")
- end
-
- # Return the Rack release as a dotted string.
- def self.release
- "1.0"
- end
-
- autoload :Builder, "rack/builder"
- autoload :Cascade, "rack/cascade"
- autoload :Chunked, "rack/chunked"
- autoload :CommonLogger, "rack/commonlogger"
- autoload :ConditionalGet, "rack/conditionalget"
- autoload :ContentLength, "rack/content_length"
- autoload :ContentType, "rack/content_type"
- autoload :File, "rack/file"
- autoload :Deflater, "rack/deflater"
- autoload :Directory, "rack/directory"
- autoload :ForwardRequest, "rack/recursive"
- autoload :Handler, "rack/handler"
- autoload :Head, "rack/head"
- autoload :Lint, "rack/lint"
- autoload :Lock, "rack/lock"
- autoload :MethodOverride, "rack/methodoverride"
- autoload :Mime, "rack/mime"
- autoload :Recursive, "rack/recursive"
- autoload :Reloader, "rack/reloader"
- autoload :ShowExceptions, "rack/showexceptions"
- autoload :ShowStatus, "rack/showstatus"
- autoload :Static, "rack/static"
- autoload :URLMap, "rack/urlmap"
- autoload :Utils, "rack/utils"
-
- autoload :MockRequest, "rack/mock"
- autoload :MockResponse, "rack/mock"
-
- autoload :Request, "rack/request"
- autoload :Response, "rack/response"
-
- module Auth
- autoload :Basic, "rack/auth/basic"
- autoload :AbstractRequest, "rack/auth/abstract/request"
- autoload :AbstractHandler, "rack/auth/abstract/handler"
- autoload :OpenID, "rack/auth/openid"
- module Digest
- autoload :MD5, "rack/auth/digest/md5"
- autoload :Nonce, "rack/auth/digest/nonce"
- autoload :Params, "rack/auth/digest/params"
- autoload :Request, "rack/auth/digest/request"
- end
- end
-
- module Session
- autoload :Cookie, "rack/session/cookie"
- autoload :Pool, "rack/session/pool"
- autoload :Memcache, "rack/session/memcache"
- end
-
- # *Adapters* connect Rack with third party web frameworks.
- #
- # Rack includes an adapter for Camping, see README for other
- # frameworks supporting Rack in their code bases.
- #
- # Refer to the submodules for framework-specific calling details.
-
- module Adapter
- autoload :Camping, "rack/adapter/camping"
- end
-end
@@ -1,22 +0,0 @@
-module Rack
- module Adapter
- class Camping
- def initialize(app)
- @app = app
- end
-
- def call(env)
- env["PATH_INFO"] ||= ""
- env["SCRIPT_NAME"] ||= ""
- controller = @app.run(env['rack.input'], env)
- h = controller.headers
- h.each_pair do |k,v|
- if v.kind_of? URI
- h[k] = v.to_s
- end
- end
- [controller.status, controller.headers, [controller.body.to_s]]
- end
- end
- end
-end
@@ -1,37 +0,0 @@
-module Rack
- module Auth
- # Rack::Auth::AbstractHandler implements common authentication functionality.
- #
- # +realm+ should be set for all handlers.
-
- class AbstractHandler
-
- attr_accessor :realm
-
- def initialize(app, realm=nil, &authenticator)
- @app, @realm, @authenticator = app, realm, authenticator
- end
-
-
- private
-
- def unauthorized(www_authenticate = challenge)
- return [ 401,
- { 'Content-Type' => 'text/plain',
- 'Content-Length' => '0',
- 'WWW-Authenticate' => www_authenticate.to_s },
- []
- ]
- end
-
- def bad_request
- return [ 400,
- { 'Content-Type' => 'text/plain',
- 'Content-Length' => '0' },
- []
- ]
- end
-
- end
- end
-end
@@ -1,37 +0,0 @@
-module Rack
- module Auth
- class AbstractRequest
-
- def initialize(env)
- @env = env
- end
-
- def provided?
- !authorization_key.nil?
- end
-
- def parts
- @parts ||= @env[authorization_key].split(' ', 2)
- end
-
- def scheme
- @scheme ||= parts.first.downcase.to_sym
- end
-
- def params
- @params ||= parts.last
- end
-
-
- private
-
- AUTHORIZATION_KEYS = ['HTTP_AUTHORIZATION', 'X-HTTP_AUTHORIZATION', 'X_HTTP_AUTHORIZATION']
-
- def authorization_key
- @authorization_key ||= AUTHORIZATION_KEYS.detect { |key| @env.has_key?(key) }
- end
-
- end
-
- end
-end
@@ -1,58 +0,0 @@
-require 'rack/auth/abstract/handler'
-require 'rack/auth/abstract/request'
-
-module Rack
- module Auth
- # Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617.
- #
- # Initialize with the Rack application that you want protecting,
- # and a block that checks if a username and password pair are valid.
- #
- # See also: <tt>example/protectedlobster.rb</tt>
-
- class Basic < AbstractHandler
-
- def call(env)
- auth = Basic::Request.new(env)
-
- return unauthorized unless auth.provided?
-
- return bad_request unless auth.basic?
-
- if valid?(auth)
- env['REMOTE_USER'] = auth.username
-
- return @app.call(env)
- end
-
- unauthorized
- end
-
-
- private
-
- def challenge
- 'Basic realm="%s"' % realm
- end
-
- def valid?(auth)
- @authenticator.call(*auth.credentials)
- end
-
- class Request < Auth::AbstractRequest
- def basic?
- :basic == scheme
- end
-
- def credentials
- @credentials ||= params.unpack("m*").first.split(/:/, 2)
- end
-
- def username
- credentials.first
- end
- end
-
- end
- end
-end
@@ -1,124 +0,0 @@
-require 'rack/auth/abstract/handler'
-require 'rack/auth/digest/request'
-require 'rack/auth/digest/params'
-require 'rack/auth/digest/nonce'
-require 'digest/md5'
-
-module Rack
- module Auth
- module Digest
- # Rack::Auth::Digest::MD5 implements the MD5 algorithm version of
- # HTTP Digest Authentication, as per RFC 2617.
- #
- # Initialize with the [Rack] application that you want protecting,
- # and a block that looks up a plaintext password for a given username.
- #
- # +opaque+ needs to be set to a constant base64/hexadecimal string.
- #
- class MD5 < AbstractHandler
-
- attr_accessor :opaque
-
- attr_writer :passwords_hashed
-
- def initialize(*args)
- super
- @passwords_hashed = nil
- end
-
- def passwords_hashed?
- !!@passwords_hashed
- end
-
- def call(env)
- auth = Request.new(env)
-
- unless auth.provided?
- return unauthorized
- end
-
- if !auth.digest? || !auth.correct_uri? || !valid_qop?(auth)
- return bad_request
- end
-
- if valid?(auth)
- if auth.nonce.stale?
- return unauthorized(challenge(:stale => true))
- else
- env['REMOTE_USER'] = auth.username
-
- return @app.call(env)
- end
- end
-
- unauthorized
- end
-
-
- private
-
- QOP = 'auth'.freeze
-
- def params(hash = {})
- Params.new do |params|
- params['realm'] = realm
- params['nonce'] = Nonce.new.to_s
- params['opaque'] = H(opaque)
- params['qop'] = QOP
-
- hash.each { |k, v| params[k] = v }
- end
- end
-
- def challenge(hash = {})
- "Digest #{params(hash)}"
- end
-
- def valid?(auth)
- valid_opaque?(auth) && valid_nonce?(auth) && valid_digest?(auth)
- end
-
- def valid_qop?(auth)
- QOP == auth.qop
- end
-
- def valid_opaque?(auth)
- H(opaque) == auth.opaque
- end
-
- def valid_nonce?(auth)
- auth.nonce.valid?
- end
-
- def valid_digest?(auth)
- digest(auth, @authenticator.call(auth.username)) == auth.response
- end
-
- def md5(data)
- ::Digest::MD5.hexdigest(data)
- end
-
- alias :H :md5
-
- def KD(secret, data)
- H([secret, data] * ':')
- end
-
- def A1(auth, password)
- [ auth.username, auth.realm, password ] * ':'
- end
-
- def A2(auth)
- [ auth.method, auth.uri ] * ':'
- end
-
- def digest(auth, password)
- password_hash = passwords_hashed? ? password : H(A1(auth, password))
-
- KD(password_hash, [ auth.nonce, auth.nc, auth.cnonce, QOP, H(A2(auth)) ] * ':')
- end
-
- end
- end
- end
-end
Oops, something went wrong.

0 comments on commit f36d9a6

Please sign in to comment.