Skip to content

Commit

Permalink
Integrate Rack::Static
Browse files Browse the repository at this point in the history
darcs-hash:20070311140658-4fc50-bc01fedf758eef91af2bc8a88fd90495c21713de.gz
  • Loading branch information
leahneukirchen committed Mar 11, 2007
1 parent bfae003 commit e276c2d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
@@ -1,5 +1,5 @@
* Christian Neukirchen <chneukirchen@gmail.com>
* Rails adapter: Christoffer Sawicki <christoffer.sawicki@gmail.com>
* HTTP authentication: Tim Fletcher <twoggle@gmail.com>
* Cookie sessions: Luc Heinrich <luc@honk-honk.com>
* Cookie sessions, Static handler: Luc Heinrich <luc@honk-honk.com>
* Official Logo: Armin Ronacher
2 changes: 2 additions & 0 deletions README
Expand Up @@ -101,8 +101,10 @@ at my site:

* XXX: Second public release 0.2.
* Bug fixes in the Camping handler.
* Improved Rack::Response.
* HTTP Basic authentication.
* Cookie Sessions.
* Static file handler.

== Contact

Expand Down
1 change: 1 addition & 0 deletions lib/rack.rb
Expand Up @@ -29,6 +29,7 @@ def self.version
autoload :Recursive, "rack/recursive"
autoload :Reloader, "rack/reloader"
autoload :ShowExceptions, "rack/showexceptions"
autoload :Static, "rack/static"
autoload :URLMap, "rack/urlmap"
autoload :Utils, "rack/utils"

Expand Down
8 changes: 3 additions & 5 deletions lib/rack/static.rb
Expand Up @@ -2,7 +2,7 @@ module Rack

# The Rack::Static middleware intercepts requests for static files
# (javascript files, images, stylesheets, etc) based on the url prefixes
# passed in the options, and serve them using a Rack::File object. This
# passed in the options, and serves them using a Rack::File object. This
# allows a Rack stack to serve both static and dynamic content.
#
# Examples:
Expand All @@ -16,10 +16,9 @@ module Rack

class Static

def initialize(app, options={})
def initialize(app, options={})
@app = app
@urls = options[:urls] || Array.new
@urls << "/favicon.ico"
@urls = options[:urls] || ["/favicon.ico"]
root = options[:root] || Dir.pwd
@file_server = Rack::File.new(root)
end
Expand All @@ -36,5 +35,4 @@ def call(env)
end

end

end

0 comments on commit e276c2d

Please sign in to comment.