Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bounce those annoying favicon requests

  • Loading branch information...
commit 1e55d85e5f96dff9187ede31c0100e000d2496ff 1 parent f2169bd
@josh josh authored
Showing with 17 additions and 0 deletions.
  1. +16 −0 lib/rack/bounce_favicon.rb
  2. +1 −0  lib/rack/contrib.rb
View
16 lib/rack/bounce_favicon.rb
@@ -0,0 +1,16 @@
+module Rack
+ # Bounce those annoying favicon.ico requests
+ class BounceFavicon
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ if env["PATH_INFO"] == "/favicon.ico"
+ [404, {"Content-Type" => "text/html", "Content-Length" => "0"}, []]
+ else
+ @app.call(env)
+ end
+ end
+ end
+end
View
1  lib/rack/contrib.rb
@@ -6,6 +6,7 @@ def self.release
end
end
+ autoload :BounceFavicon, "rack/bounce_favicon"
autoload :ETag, "rack/etag"
autoload :JSONP, "rack/jsonp"
autoload :LighttpdScriptNameFix, "rack/lighttpd_script_name_fix"
Please sign in to comment.
Something went wrong with that request. Please try again.