rack 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rack might be problematic. Click here for more details.
- data/COPYING +1 -1
 - data/KNOWN-ISSUES +9 -0
 - data/README.rdoc +72 -7
 - data/Rakefile +18 -11
 - data/SPEC +3 -1
 - data/contrib/rack.png +0 -0
 - data/contrib/rack.svg +150 -0
 - data/contrib/rdoc.css +412 -0
 - data/lib/rack/auth/basic.rb +1 -1
 - data/lib/rack/auth/digest/nonce.rb +1 -1
 - data/lib/rack/backports/uri/common_18.rb +14 -28
 - data/lib/rack/backports/uri/common_192.rb +14 -17
 - data/lib/rack/backports/uri/common_193.rb +29 -0
 - data/lib/rack/body_proxy.rb +10 -0
 - data/lib/rack/builder.rb +1 -1
 - data/lib/rack/cascade.rb +11 -0
 - data/lib/rack/commonlogger.rb +18 -5
 - data/lib/rack/deflater.rb +5 -1
 - data/lib/rack/directory.rb +1 -1
 - data/lib/rack/etag.rb +6 -3
 - data/lib/rack/file.rb +13 -4
 - data/lib/rack/head.rb +1 -0
 - data/lib/rack/lint.rb +3 -1
 - data/lib/rack/lock.rb +3 -4
 - data/lib/rack/mime.rb +1 -1
 - data/lib/rack/mock.rb +3 -2
 - data/lib/rack/multipart.rb +2 -2
 - data/lib/rack/multipart/parser.rb +6 -4
 - data/lib/rack/reloader.rb +1 -1
 - data/lib/rack/request.rb +2 -4
 - data/lib/rack/response.rb +2 -1
 - data/lib/rack/server.rb +28 -2
 - data/lib/rack/session/abstract/id.rb +5 -0
 - data/lib/rack/session/cookie.rb +9 -0
 - data/lib/rack/static.rb +90 -8
 - data/lib/rack/utils.rb +17 -10
 - data/rack.gemspec +3 -3
 - data/test/builder/line.ru +1 -0
 - data/test/cgi/assets/folder/test.js +1 -0
 - data/test/cgi/assets/fonts/font.eot +1 -0
 - data/test/cgi/assets/images/image.png +1 -0
 - data/test/cgi/assets/index.html +1 -0
 - data/test/cgi/assets/javascripts/app.js +1 -0
 - data/test/cgi/assets/stylesheets/app.css +1 -0
 - data/test/spec_auth_basic.rb +8 -0
 - data/test/spec_auth_digest.rb +14 -0
 - data/test/spec_body_proxy.rb +4 -0
 - data/test/spec_builder.rb +7 -1
 - data/test/spec_cascade.rb +8 -0
 - data/test/spec_chunked.rb +6 -6
 - data/test/spec_config.rb +0 -1
 - data/test/spec_content_length.rb +26 -13
 - data/test/spec_content_type.rb +15 -5
 - data/test/spec_deflater.rb +35 -17
 - data/test/spec_directory.rb +20 -1
 - data/test/spec_etag.rb +29 -13
 - data/test/spec_file.rb +42 -25
 - data/test/spec_head.rb +25 -7
 - data/test/spec_lobster.rb +20 -5
 - data/test/spec_lock.rb +46 -21
 - data/test/spec_logger.rb +2 -7
 - data/test/spec_methodoverride.rb +21 -22
 - data/test/spec_mock.rb +12 -7
 - data/test/spec_multipart.rb +29 -0
 - data/test/spec_nulllogger.rb +13 -2
 - data/test/spec_recursive.rb +12 -9
 - data/test/spec_request.rb +2 -2
 - data/test/spec_response.rb +30 -0
 - data/test/spec_runtime.rb +15 -5
 - data/test/spec_sendfile.rb +11 -8
 - data/test/spec_server.rb +47 -0
 - data/test/spec_session_cookie.rb +68 -1
 - data/test/spec_session_memcache.rb +10 -8
 - data/test/spec_session_pool.rb +13 -10
 - data/test/spec_showexceptions.rb +9 -4
 - data/test/spec_showstatus.rb +10 -5
 - data/test/spec_static.rb +85 -9
 - data/test/spec_urlmap.rb +10 -10
 - data/test/spec_utils.rb +14 -1
 - data/test/static/another/index.html +1 -0
 - metadata +21 -8
 
    
        data/test/spec_session_cookie.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'rack/session/cookie'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rack/lint'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'rack/mock'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            describe Rack::Session::Cookie do
         
     | 
| 
         @@ -9,7 +10,7 @@ describe Rack::Session::Cookie do 
     | 
|
| 
       9 
10 
     | 
    
         
             
                hash.delete("session_id")
         
     | 
| 
       10 
11 
     | 
    
         
             
                Rack::Response.new(hash.inspect).to_a
         
     | 
| 
       11 
12 
     | 
    
         
             
              end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
              
         
     | 
| 
       13 
14 
     | 
    
         
             
              session_id = lambda do |env|
         
     | 
| 
       14 
15 
     | 
    
         
             
                Rack::Response.new(env["rack.session"].to_hash.inspect).to_a
         
     | 
| 
       15 
16 
     | 
    
         
             
              end
         
     | 
| 
         @@ -24,6 +25,50 @@ describe Rack::Session::Cookie do 
     | 
|
| 
       24 
25 
     | 
    
         
             
                Rack::Response.new("Nothing").to_a
         
     | 
| 
       25 
26 
     | 
    
         
             
              end
         
     | 
| 
       26 
27 
     | 
    
         | 
| 
      
 28 
     | 
    
         
            +
              renewer = lambda do |env|
         
     | 
| 
      
 29 
     | 
    
         
            +
                env["rack.session.options"][:renew] = true
         
     | 
| 
      
 30 
     | 
    
         
            +
                Rack::Response.new("Nothing").to_a
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              only_session_id = lambda do |env|
         
     | 
| 
      
 34 
     | 
    
         
            +
                Rack::Response.new(env["rack.session"]["session_id"].to_s).to_a
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              bigcookie = lambda do |env|
         
     | 
| 
      
 38 
     | 
    
         
            +
                env["rack.session"]["cookie"] = "big" * 3000
         
     | 
| 
      
 39 
     | 
    
         
            +
                Rack::Response.new(env["rack.session"].inspect).to_a
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              destroy_session = lambda do |env|
         
     | 
| 
      
 43 
     | 
    
         
            +
                env["rack.session"].destroy
         
     | 
| 
      
 44 
     | 
    
         
            +
                Rack::Response.new("Nothing").to_a
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              def response_for(options={})
         
     | 
| 
      
 48 
     | 
    
         
            +
                request_options = options.fetch(:request, {})
         
     | 
| 
      
 49 
     | 
    
         
            +
                cookie = if options[:cookie].is_a?(Rack::Response)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  options[:cookie]["Set-Cookie"]
         
     | 
| 
      
 51 
     | 
    
         
            +
                else
         
     | 
| 
      
 52 
     | 
    
         
            +
                  options[:cookie]
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
                request_options["HTTP_COOKIE"] = cookie || ""
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                app_with_cookie = Rack::Session::Cookie.new(*options[:app])
         
     | 
| 
      
 57 
     | 
    
         
            +
                app_with_cookie = Rack::Lint.new(app_with_cookie)
         
     | 
| 
      
 58 
     | 
    
         
            +
                Rack::MockRequest.new(app_with_cookie).get("/", request_options)
         
     | 
| 
      
 59 
     | 
    
         
            +
              end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              before do
         
     | 
| 
      
 62 
     | 
    
         
            +
                @warnings = warnings = []
         
     | 
| 
      
 63 
     | 
    
         
            +
                Rack::Session::Cookie.class_eval do
         
     | 
| 
      
 64 
     | 
    
         
            +
                  define_method(:warn) { |m| warnings << m }
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              after do
         
     | 
| 
      
 69 
     | 
    
         
            +
                Rack::Session::Cookie.class_eval { remove_method :warn }
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
       27 
72 
     | 
    
         
             
              describe 'Base64' do
         
     | 
| 
       28 
73 
     | 
    
         
             
                it 'uses base64 to encode' do
         
     | 
| 
       29 
74 
     | 
    
         
             
                  coder = Rack::Session::Cookie::Base64.new
         
     | 
| 
         @@ -57,6 +102,14 @@ describe Rack::Session::Cookie do 
     | 
|
| 
       57 
102 
     | 
    
         
             
                end
         
     | 
| 
       58 
103 
     | 
    
         
             
              end
         
     | 
| 
       59 
104 
     | 
    
         | 
| 
      
 105 
     | 
    
         
            +
              it "warns if no secret is given" do
         
     | 
| 
      
 106 
     | 
    
         
            +
                cookie = Rack::Session::Cookie.new(incrementor)
         
     | 
| 
      
 107 
     | 
    
         
            +
                @warnings.first.should =~ /no secret/i
         
     | 
| 
      
 108 
     | 
    
         
            +
                @warnings.clear
         
     | 
| 
      
 109 
     | 
    
         
            +
                cookie = Rack::Session::Cookie.new(incrementor, :secret => 'abc')
         
     | 
| 
      
 110 
     | 
    
         
            +
                @warnings.should.be.empty?
         
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
       60 
113 
     | 
    
         
             
              it 'uses a coder' do
         
     | 
| 
       61 
114 
     | 
    
         
             
                identity = Class.new {
         
     | 
| 
       62 
115 
     | 
    
         
             
                  attr_reader :calls
         
     | 
| 
         @@ -291,4 +344,18 @@ describe Rack::Session::Cookie do 
     | 
|
| 
       291 
344 
     | 
    
         
             
                res = Rack::MockRequest.new(app).get("/", 'rack.session' => {:foo => 'bar'})
         
     | 
| 
       292 
345 
     | 
    
         
             
                res.body.should.match(/foo/)
         
     | 
| 
       293 
346 
     | 
    
         
             
              end
         
     | 
| 
      
 347 
     | 
    
         
            +
             
     | 
| 
      
 348 
     | 
    
         
            +
              it "allows modifying session data with session data from middleware in front" do
         
     | 
| 
      
 349 
     | 
    
         
            +
                request = { 'rack.session' => { :foo => 'bar' }}
         
     | 
| 
      
 350 
     | 
    
         
            +
                response = response_for(:app => incrementor, :request => request)
         
     | 
| 
      
 351 
     | 
    
         
            +
                response.body.should.match(/counter/)
         
     | 
| 
      
 352 
     | 
    
         
            +
                response.body.should.match(/foo/)
         
     | 
| 
      
 353 
     | 
    
         
            +
              end
         
     | 
| 
      
 354 
     | 
    
         
            +
             
     | 
| 
      
 355 
     | 
    
         
            +
              it "allows modifying session data with session data from middleware in front" do
         
     | 
| 
      
 356 
     | 
    
         
            +
                request = { 'rack.session' => { :foo => 'bar' }}
         
     | 
| 
      
 357 
     | 
    
         
            +
                response = response_for(:app => incrementor, :request => request)
         
     | 
| 
      
 358 
     | 
    
         
            +
                response.body.should.match(/counter/)
         
     | 
| 
      
 359 
     | 
    
         
            +
                response.body.should.match(/foo/)
         
     | 
| 
      
 360 
     | 
    
         
            +
              end
         
     | 
| 
       294 
361 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            begin
         
     | 
| 
       2 
2 
     | 
    
         
             
              require 'rack/session/memcache'
         
     | 
| 
      
 3 
     | 
    
         
            +
              require 'rack/lint'
         
     | 
| 
       3 
4 
     | 
    
         
             
              require 'rack/mock'
         
     | 
| 
       4 
5 
     | 
    
         
             
              require 'thread'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
         @@ -11,22 +12,23 @@ begin 
     | 
|
| 
       11 
12 
     | 
    
         
             
                  env["rack.session"]["counter"] += 1
         
     | 
| 
       12 
13 
     | 
    
         
             
                  Rack::Response.new(env["rack.session"].inspect).to_a
         
     | 
| 
       13 
14 
     | 
    
         
             
                end
         
     | 
| 
       14 
     | 
    
         
            -
                drop_session = proc do |env|
         
     | 
| 
      
 15 
     | 
    
         
            +
                drop_session = Rack::Lint.new(proc do |env|
         
     | 
| 
       15 
16 
     | 
    
         
             
                  env['rack.session.options'][:drop] = true
         
     | 
| 
       16 
17 
     | 
    
         
             
                  incrementor.call(env)
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
                renew_session = proc do |env|
         
     | 
| 
      
 18 
     | 
    
         
            +
                end)
         
     | 
| 
      
 19 
     | 
    
         
            +
                renew_session = Rack::Lint.new(proc do |env|
         
     | 
| 
       19 
20 
     | 
    
         
             
                  env['rack.session.options'][:renew] = true
         
     | 
| 
       20 
21 
     | 
    
         
             
                  incrementor.call(env)
         
     | 
| 
       21 
     | 
    
         
            -
                end
         
     | 
| 
       22 
     | 
    
         
            -
                defer_session = proc do |env|
         
     | 
| 
      
 22 
     | 
    
         
            +
                end)
         
     | 
| 
      
 23 
     | 
    
         
            +
                defer_session = Rack::Lint.new(proc do |env|
         
     | 
| 
       23 
24 
     | 
    
         
             
                  env['rack.session.options'][:defer] = true
         
     | 
| 
       24 
25 
     | 
    
         
             
                  incrementor.call(env)
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
                skip_session = proc do |env|
         
     | 
| 
      
 26 
     | 
    
         
            +
                end)
         
     | 
| 
      
 27 
     | 
    
         
            +
                skip_session = Rack::Lint.new(proc do |env|
         
     | 
| 
       27 
28 
     | 
    
         
             
                  env['rack.session.options'][:skip] = true
         
     | 
| 
       28 
29 
     | 
    
         
             
                  incrementor.call(env)
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
                end)
         
     | 
| 
      
 31 
     | 
    
         
            +
                incrementor = Rack::Lint.new(incrementor)
         
     | 
| 
       30 
32 
     | 
    
         | 
| 
       31 
33 
     | 
    
         
             
                # test memcache connection
         
     | 
| 
       32 
34 
     | 
    
         
             
                Rack::Session::Memcache.new(incrementor)
         
     | 
    
        data/test/spec_session_pool.rb
    CHANGED
    
    | 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'thread'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rack/lint'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'rack/mock'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'rack/session/pool'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
         @@ -12,28 +13,30 @@ describe Rack::Session::Pool do 
     | 
|
| 
       12 
13 
     | 
    
         
             
                Rack::Response.new(env["rack.session"].inspect).to_a
         
     | 
| 
       13 
14 
     | 
    
         
             
              end
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              session_id = lambda do |env|
         
     | 
| 
      
 16 
     | 
    
         
            +
              session_id = Rack::Lint.new(lambda do |env|
         
     | 
| 
       16 
17 
     | 
    
         
             
                Rack::Response.new(env["rack.session"].inspect).to_a
         
     | 
| 
       17 
     | 
    
         
            -
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end)
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              nothing = lambda do |env|
         
     | 
| 
      
 20 
     | 
    
         
            +
              nothing = Rack::Lint.new(lambda do |env|
         
     | 
| 
       20 
21 
     | 
    
         
             
                Rack::Response.new("Nothing").to_a
         
     | 
| 
       21 
     | 
    
         
            -
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end)
         
     | 
| 
       22 
23 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              drop_session = lambda do |env|
         
     | 
| 
      
 24 
     | 
    
         
            +
              drop_session = Rack::Lint.new(lambda do |env|
         
     | 
| 
       24 
25 
     | 
    
         
             
                env['rack.session.options'][:drop] = true
         
     | 
| 
       25 
26 
     | 
    
         
             
                incrementor.call(env)
         
     | 
| 
       26 
     | 
    
         
            -
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end)
         
     | 
| 
       27 
28 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
              renew_session = lambda do |env|
         
     | 
| 
      
 29 
     | 
    
         
            +
              renew_session = Rack::Lint.new(lambda do |env|
         
     | 
| 
       29 
30 
     | 
    
         
             
                env['rack.session.options'][:renew] = true
         
     | 
| 
       30 
31 
     | 
    
         
             
                incrementor.call(env)
         
     | 
| 
       31 
     | 
    
         
            -
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end)
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
              defer_session = lambda do |env|
         
     | 
| 
      
 34 
     | 
    
         
            +
              defer_session = Rack::Lint.new(lambda do |env|
         
     | 
| 
       34 
35 
     | 
    
         
             
                env['rack.session.options'][:defer] = true
         
     | 
| 
       35 
36 
     | 
    
         
             
                incrementor.call(env)
         
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end)
         
     | 
| 
      
 38 
     | 
    
         
            +
              
         
     | 
| 
      
 39 
     | 
    
         
            +
              incrementor = Rack::Lint.new(incrementor)
         
     | 
| 
       37 
40 
     | 
    
         | 
| 
       38 
41 
     | 
    
         
             
              it "creates a new cookie" do
         
     | 
| 
       39 
42 
     | 
    
         
             
                pool = Rack::Session::Pool.new(incrementor)
         
     | 
    
        data/test/spec_showexceptions.rb
    CHANGED
    
    | 
         @@ -1,12 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'rack/showexceptions'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rack/lint'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'rack/mock'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            describe Rack::ShowExceptions do
         
     | 
| 
      
 6 
     | 
    
         
            +
              def show_exceptions(app)
         
     | 
| 
      
 7 
     | 
    
         
            +
                Rack::Lint.new Rack::ShowExceptions.new(app)
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
              
         
     | 
| 
       5 
10 
     | 
    
         
             
              it "catches exceptions" do
         
     | 
| 
       6 
11 
     | 
    
         
             
                res = nil
         
     | 
| 
       7 
12 
     | 
    
         | 
| 
       8 
13 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       9 
     | 
    
         
            -
                   
     | 
| 
      
 14 
     | 
    
         
            +
                  show_exceptions(
         
     | 
| 
       10 
15 
     | 
    
         
             
                    lambda{|env| raise RuntimeError }
         
     | 
| 
       11 
16 
     | 
    
         
             
                ))
         
     | 
| 
       12 
17 
     | 
    
         | 
| 
         @@ -25,7 +30,7 @@ describe Rack::ShowExceptions do 
     | 
|
| 
       25 
30 
     | 
    
         
             
                res = nil
         
     | 
| 
       26 
31 
     | 
    
         | 
| 
       27 
32 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       28 
     | 
    
         
            -
                   
     | 
| 
      
 33 
     | 
    
         
            +
                  show_exceptions(
         
     | 
| 
       29 
34 
     | 
    
         
             
                    lambda{|env| raise RuntimeError, "It was never supposed to work" }
         
     | 
| 
       30 
35 
     | 
    
         
             
                ))
         
     | 
| 
       31 
36 
     | 
    
         | 
| 
         @@ -46,7 +51,7 @@ describe Rack::ShowExceptions do 
     | 
|
| 
       46 
51 
     | 
    
         
             
                res = nil
         
     | 
| 
       47 
52 
     | 
    
         | 
| 
       48 
53 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
      
 54 
     | 
    
         
            +
                  show_exceptions(
         
     | 
| 
       50 
55 
     | 
    
         
             
                    lambda{|env| raise RuntimeError, "It was never supposed to work" }
         
     | 
| 
       51 
56 
     | 
    
         
             
                ))
         
     | 
| 
       52 
57 
     | 
    
         | 
| 
         @@ -68,7 +73,7 @@ describe Rack::ShowExceptions do 
     | 
|
| 
       68 
73 
     | 
    
         
             
                res = nil
         
     | 
| 
       69 
74 
     | 
    
         | 
| 
       70 
75 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       71 
     | 
    
         
            -
                   
     | 
| 
      
 76 
     | 
    
         
            +
                  show_exceptions(
         
     | 
| 
       72 
77 
     | 
    
         
             
                    lambda{|env| raise RuntimeError, "", [] }
         
     | 
| 
       73 
78 
     | 
    
         
             
                  )
         
     | 
| 
       74 
79 
     | 
    
         
             
                )
         
     | 
    
        data/test/spec_showstatus.rb
    CHANGED
    
    | 
         @@ -1,10 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'rack/showstatus'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rack/lint'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'rack/mock'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            describe Rack::ShowStatus do
         
     | 
| 
      
 6 
     | 
    
         
            +
              def show_status(app)
         
     | 
| 
      
 7 
     | 
    
         
            +
                Rack::Lint.new Rack::ShowStatus.new(app)
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
              
         
     | 
| 
       5 
10 
     | 
    
         
             
              should "provide a default status message" do
         
     | 
| 
       6 
11 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       7 
     | 
    
         
            -
                   
     | 
| 
      
 12 
     | 
    
         
            +
                  show_status(lambda{|env|
         
     | 
| 
       8 
13 
     | 
    
         
             
                    [404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []]
         
     | 
| 
       9 
14 
     | 
    
         
             
                }))
         
     | 
| 
       10 
15 
     | 
    
         | 
| 
         @@ -19,7 +24,7 @@ describe Rack::ShowStatus do 
     | 
|
| 
       19 
24 
     | 
    
         | 
| 
       20 
25 
     | 
    
         
             
              should "let the app provide additional information" do
         
     | 
| 
       21 
26 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       22 
     | 
    
         
            -
                   
     | 
| 
      
 27 
     | 
    
         
            +
                  show_status(
         
     | 
| 
       23 
28 
     | 
    
         
             
                    lambda{|env|
         
     | 
| 
       24 
29 
     | 
    
         
             
                      env["rack.showstatus.detail"] = "gone too meta."
         
     | 
| 
       25 
30 
     | 
    
         
             
                      [404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []]
         
     | 
| 
         @@ -37,7 +42,7 @@ describe Rack::ShowStatus do 
     | 
|
| 
       37 
42 
     | 
    
         | 
| 
       38 
43 
     | 
    
         
             
              should "not replace existing messages" do
         
     | 
| 
       39 
44 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
      
 45 
     | 
    
         
            +
                  show_status(
         
     | 
| 
       41 
46 
     | 
    
         
             
                    lambda{|env|
         
     | 
| 
       42 
47 
     | 
    
         
             
                      [404, {"Content-Type" => "text/plain", "Content-Length" => "4"}, ["foo!"]]
         
     | 
| 
       43 
48 
     | 
    
         
             
                }))
         
     | 
| 
         @@ -52,7 +57,7 @@ describe Rack::ShowStatus do 
     | 
|
| 
       52 
57 
     | 
    
         
             
                headers = {"WWW-Authenticate" => "Basic blah"}
         
     | 
| 
       53 
58 
     | 
    
         | 
| 
       54 
59 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       55 
     | 
    
         
            -
                   
     | 
| 
      
 60 
     | 
    
         
            +
                  show_status(lambda{|env| [401, headers, []] }))
         
     | 
| 
       56 
61 
     | 
    
         
             
                res = req.get("/", :lint => true)
         
     | 
| 
       57 
62 
     | 
    
         | 
| 
       58 
63 
     | 
    
         
             
                res["WWW-Authenticate"].should.equal("Basic blah")
         
     | 
| 
         @@ -60,7 +65,7 @@ describe Rack::ShowStatus do 
     | 
|
| 
       60 
65 
     | 
    
         | 
| 
       61 
66 
     | 
    
         
             
              should "replace existing messages if there is detail" do
         
     | 
| 
       62 
67 
     | 
    
         
             
                req = Rack::MockRequest.new(
         
     | 
| 
       63 
     | 
    
         
            -
                   
     | 
| 
      
 68 
     | 
    
         
            +
                  show_status(
         
     | 
| 
       64 
69 
     | 
    
         
             
                    lambda{|env|
         
     | 
| 
       65 
70 
     | 
    
         
             
                      env["rack.showstatus.detail"] = "gone too meta."
         
     | 
| 
       66 
71 
     | 
    
         
             
                      [404, {"Content-Type" => "text/plain", "Content-Length" => "4"}, ["foo!"]]
         
     | 
    
        data/test/spec_static.rb
    CHANGED
    
    | 
         @@ -1,22 +1,27 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'rack/static'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rack/lint'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'rack/mock'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            class DummyApp
         
     | 
| 
       5 
6 
     | 
    
         
             
              def call(env)
         
     | 
| 
       6 
     | 
    
         
            -
                [200, {}, ["Hello World"]]
         
     | 
| 
      
 7 
     | 
    
         
            +
                [200, {"Content-Type" => "text/plain"}, ["Hello World"]]
         
     | 
| 
       7 
8 
     | 
    
         
             
              end
         
     | 
| 
       8 
9 
     | 
    
         
             
            end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
       10 
11 
     | 
    
         
             
            describe Rack::Static do
         
     | 
| 
      
 12 
     | 
    
         
            +
              def static(app, *args)
         
     | 
| 
      
 13 
     | 
    
         
            +
                Rack::Lint.new Rack::Static.new(app, *args)
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       11 
16 
     | 
    
         
             
              root = File.expand_path(File.dirname(__FILE__))
         
     | 
| 
       12 
17 
     | 
    
         | 
| 
       13 
18 
     | 
    
         
             
              OPTIONS = {:urls => ["/cgi"], :root => root}
         
     | 
| 
       14 
     | 
    
         
            -
              STATIC_OPTIONS = {:urls => [""], :root => root, :index => ' 
     | 
| 
      
 19 
     | 
    
         
            +
              STATIC_OPTIONS = {:urls => [""], :root => "#{root}/static", :index => 'index.html'}
         
     | 
| 
       15 
20 
     | 
    
         
             
              HASH_OPTIONS = {:urls => {"/cgi/sekret" => 'cgi/test'}, :root => root}
         
     | 
| 
       16 
21 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              @request = Rack::MockRequest.new( 
     | 
| 
       18 
     | 
    
         
            -
              @static_request = Rack::MockRequest.new( 
     | 
| 
       19 
     | 
    
         
            -
              @hash_request = Rack::MockRequest.new( 
     | 
| 
      
 22 
     | 
    
         
            +
              @request = Rack::MockRequest.new(static(DummyApp.new, OPTIONS))
         
     | 
| 
      
 23 
     | 
    
         
            +
              @static_request = Rack::MockRequest.new(static(DummyApp.new, STATIC_OPTIONS))
         
     | 
| 
      
 24 
     | 
    
         
            +
              @hash_request = Rack::MockRequest.new(static(DummyApp.new, HASH_OPTIONS))
         
     | 
| 
       20 
25 
     | 
    
         | 
| 
       21 
26 
     | 
    
         
             
              it "serves files" do
         
     | 
| 
       22 
27 
     | 
    
         
             
                res = @request.get("/cgi/test")
         
     | 
| 
         @@ -35,12 +40,19 @@ describe Rack::Static do 
     | 
|
| 
       35 
40 
     | 
    
         
             
                res.body.should == "Hello World"
         
     | 
| 
       36 
41 
     | 
    
         
             
              end
         
     | 
| 
       37 
42 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              it "calls index file when requesting root" do
         
     | 
| 
      
 43 
     | 
    
         
            +
              it "calls index file when requesting root in the given folder" do
         
     | 
| 
       39 
44 
     | 
    
         
             
                res = @static_request.get("/")
         
     | 
| 
       40 
45 
     | 
    
         
             
                res.should.be.ok
         
     | 
| 
       41 
46 
     | 
    
         
             
                res.body.should =~ /index!/
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                res = @static_request.get("/other/")
         
     | 
| 
      
 49 
     | 
    
         
            +
                res.should.be.not_found
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                res = @static_request.get("/another/")
         
     | 
| 
      
 52 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 53 
     | 
    
         
            +
                res.body.should =~ /another index!/
         
     | 
| 
       42 
54 
     | 
    
         
             
              end
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
       44 
56 
     | 
    
         
             
              it "doesn't call index file if :index option was omitted" do
         
     | 
| 
       45 
57 
     | 
    
         
             
                res = @request.get("/")
         
     | 
| 
       46 
58 
     | 
    
         
             
                res.body.should == "Hello World"
         
     | 
| 
         @@ -58,12 +70,76 @@ describe Rack::Static do 
     | 
|
| 
       58 
70 
     | 
    
         
             
                res.body.should == "Hello World"
         
     | 
| 
       59 
71 
     | 
    
         
             
              end
         
     | 
| 
       60 
72 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
              it "supports serving fixed cache-control" do
         
     | 
| 
      
 73 
     | 
    
         
            +
              it "supports serving fixed cache-control (legacy option)" do
         
     | 
| 
       62 
74 
     | 
    
         
             
                opts = OPTIONS.merge(:cache_control => 'public')
         
     | 
| 
       63 
     | 
    
         
            -
                request = Rack::MockRequest.new( 
     | 
| 
      
 75 
     | 
    
         
            +
                request = Rack::MockRequest.new(static(DummyApp.new, opts))
         
     | 
| 
       64 
76 
     | 
    
         
             
                res = request.get("/cgi/test")
         
     | 
| 
       65 
77 
     | 
    
         
             
                res.should.be.ok
         
     | 
| 
       66 
78 
     | 
    
         
             
                res.headers['Cache-Control'].should == 'public'
         
     | 
| 
       67 
79 
     | 
    
         
             
              end
         
     | 
| 
       68 
80 
     | 
    
         | 
| 
      
 81 
     | 
    
         
            +
              HEADER_OPTIONS = {:urls => ["/cgi"], :root => root, :header_rules => [
         
     | 
| 
      
 82 
     | 
    
         
            +
                [:all, {'Cache-Control' => 'public, max-age=100'}],
         
     | 
| 
      
 83 
     | 
    
         
            +
                [:fonts, {'Cache-Control' => 'public, max-age=200'}],
         
     | 
| 
      
 84 
     | 
    
         
            +
                [%w(png jpg), {'Cache-Control' => 'public, max-age=300'}],
         
     | 
| 
      
 85 
     | 
    
         
            +
                ['/cgi/assets/folder/', {'Cache-Control' => 'public, max-age=400'}],
         
     | 
| 
      
 86 
     | 
    
         
            +
                ['cgi/assets/javascripts', {'Cache-Control' => 'public, max-age=500'}],
         
     | 
| 
      
 87 
     | 
    
         
            +
                [/\.(css|erb)\z/, {'Cache-Control' => 'public, max-age=600'}]
         
     | 
| 
      
 88 
     | 
    
         
            +
              ]}
         
     | 
| 
      
 89 
     | 
    
         
            +
              @header_request = Rack::MockRequest.new(static(DummyApp.new, HEADER_OPTIONS))
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              it "supports header rule :all" do
         
     | 
| 
      
 92 
     | 
    
         
            +
                # Headers for all files via :all shortcut
         
     | 
| 
      
 93 
     | 
    
         
            +
                res = @header_request.get('/cgi/assets/index.html')
         
     | 
| 
      
 94 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 95 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=100'
         
     | 
| 
      
 96 
     | 
    
         
            +
              end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
              it "supports header rule :fonts" do
         
     | 
| 
      
 99 
     | 
    
         
            +
                # Headers for web fonts via :fonts shortcut
         
     | 
| 
      
 100 
     | 
    
         
            +
                res = @header_request.get('/cgi/assets/fonts/font.eot')
         
     | 
| 
      
 101 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 102 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=200'
         
     | 
| 
      
 103 
     | 
    
         
            +
              end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
              it "supports file extension header rules provided as an Array" do
         
     | 
| 
      
 106 
     | 
    
         
            +
                # Headers for file extensions via array
         
     | 
| 
      
 107 
     | 
    
         
            +
                res = @header_request.get('/cgi/assets/images/image.png')
         
     | 
| 
      
 108 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 109 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=300'
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
              it "supports folder rules provided as a String" do
         
     | 
| 
      
 113 
     | 
    
         
            +
                # Headers for files in folder via string
         
     | 
| 
      
 114 
     | 
    
         
            +
                res = @header_request.get('/cgi/assets/folder/test.js')
         
     | 
| 
      
 115 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 116 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=400'
         
     | 
| 
      
 117 
     | 
    
         
            +
              end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
              it "supports folder header rules provided as a String not starting with a slash" do
         
     | 
| 
      
 120 
     | 
    
         
            +
                res = @header_request.get('/cgi/assets/javascripts/app.js')
         
     | 
| 
      
 121 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 122 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=500'
         
     | 
| 
      
 123 
     | 
    
         
            +
              end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
              it "supports flexible header rules provided as Regexp" do
         
     | 
| 
      
 126 
     | 
    
         
            +
                # Flexible Headers via Regexp
         
     | 
| 
      
 127 
     | 
    
         
            +
                res = @header_request.get('/cgi/assets/stylesheets/app.css')
         
     | 
| 
      
 128 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 129 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=600'
         
     | 
| 
      
 130 
     | 
    
         
            +
              end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
              it "prioritizes header rules over fixed cache-control setting (legacy option)" do
         
     | 
| 
      
 133 
     | 
    
         
            +
                opts = OPTIONS.merge(
         
     | 
| 
      
 134 
     | 
    
         
            +
                  :cache_control => 'public, max-age=24',
         
     | 
| 
      
 135 
     | 
    
         
            +
                  :header_rules => [
         
     | 
| 
      
 136 
     | 
    
         
            +
                    [:all, {'Cache-Control' => 'public, max-age=42'}]
         
     | 
| 
      
 137 
     | 
    
         
            +
                  ])
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                request = Rack::MockRequest.new(static(DummyApp.new, opts))
         
     | 
| 
      
 140 
     | 
    
         
            +
                res = request.get("/cgi/test")
         
     | 
| 
      
 141 
     | 
    
         
            +
                res.should.be.ok
         
     | 
| 
      
 142 
     | 
    
         
            +
                res.headers['Cache-Control'].should == 'public, max-age=42'
         
     | 
| 
      
 143 
     | 
    
         
            +
              end
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
       69 
145 
     | 
    
         
             
            end
         
     | 
    
        data/test/spec_urlmap.rb
    CHANGED
    
    | 
         @@ -10,11 +10,11 @@ describe Rack::URLMap do 
     | 
|
| 
       10 
10 
     | 
    
         
             
                    'Content-Type' => 'text/plain'
         
     | 
| 
       11 
11 
     | 
    
         
             
                  }, [""]]
         
     | 
| 
       12 
12 
     | 
    
         
             
                }
         
     | 
| 
       13 
     | 
    
         
            -
                map = Rack::URLMap.new({
         
     | 
| 
      
 13 
     | 
    
         
            +
                map = Rack::Lint.new(Rack::URLMap.new({
         
     | 
| 
       14 
14 
     | 
    
         
             
                  'http://foo.org/bar' => app,
         
     | 
| 
       15 
15 
     | 
    
         
             
                  '/foo' => app,
         
     | 
| 
       16 
16 
     | 
    
         
             
                  '/foo/bar' => app
         
     | 
| 
       17 
     | 
    
         
            -
                })
         
     | 
| 
      
 17 
     | 
    
         
            +
                }))
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                res = Rack::MockRequest.new(map).get("/")
         
     | 
| 
       20 
20 
     | 
    
         
             
                res.should.be.not_found
         
     | 
| 
         @@ -66,7 +66,7 @@ describe Rack::URLMap do 
     | 
|
| 
       66 
66 
     | 
    
         | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
              it "dispatches hosts correctly" do
         
     | 
| 
       69 
     | 
    
         
            -
                map = Rack::URLMap.new("http://foo.org/" => lambda { |env|
         
     | 
| 
      
 69 
     | 
    
         
            +
                map = Rack::Lint.new(Rack::URLMap.new("http://foo.org/" => lambda { |env|
         
     | 
| 
       70 
70 
     | 
    
         
             
                                         [200,
         
     | 
| 
       71 
71 
     | 
    
         
             
                                          { "Content-Type" => "text/plain",
         
     | 
| 
       72 
72 
     | 
    
         
             
                                            "X-Position" => "foo.org",
         
     | 
| 
         @@ -90,7 +90,7 @@ describe Rack::URLMap do 
     | 
|
| 
       90 
90 
     | 
    
         
             
                                            "X-Position" => "default.org",
         
     | 
| 
       91 
91 
     | 
    
         
             
                                            "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
         
     | 
| 
       92 
92 
     | 
    
         
             
                                          }, [""]]}
         
     | 
| 
       93 
     | 
    
         
            -
                                       )
         
     | 
| 
      
 93 
     | 
    
         
            +
                                       ))
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
       95 
95 
     | 
    
         
             
                res = Rack::MockRequest.new(map).get("/")
         
     | 
| 
       96 
96 
     | 
    
         
             
                res.should.be.ok
         
     | 
| 
         @@ -124,7 +124,7 @@ describe Rack::URLMap do 
     | 
|
| 
       124 
124 
     | 
    
         
             
              end
         
     | 
| 
       125 
125 
     | 
    
         | 
| 
       126 
126 
     | 
    
         
             
              should "be nestable" do
         
     | 
| 
       127 
     | 
    
         
            -
                map = Rack::URLMap.new("/foo" =>
         
     | 
| 
      
 127 
     | 
    
         
            +
                map = Rack::Lint.new(Rack::URLMap.new("/foo" =>
         
     | 
| 
       128 
128 
     | 
    
         
             
                  Rack::URLMap.new("/bar" =>
         
     | 
| 
       129 
129 
     | 
    
         
             
                    Rack::URLMap.new("/quux" =>  lambda { |env|
         
     | 
| 
       130 
130 
     | 
    
         
             
                                       [200,
         
     | 
| 
         @@ -133,7 +133,7 @@ describe Rack::URLMap do 
     | 
|
| 
       133 
133 
     | 
    
         
             
                                          "X-PathInfo" => env["PATH_INFO"],
         
     | 
| 
       134 
134 
     | 
    
         
             
                                          "X-ScriptName" => env["SCRIPT_NAME"],
         
     | 
| 
       135 
135 
     | 
    
         
             
                                        }, [""]]}
         
     | 
| 
       136 
     | 
    
         
            -
                                     )))
         
     | 
| 
      
 136 
     | 
    
         
            +
                                     ))))
         
     | 
| 
       137 
137 
     | 
    
         | 
| 
       138 
138 
     | 
    
         
             
                res = Rack::MockRequest.new(map).get("/foo/bar")
         
     | 
| 
       139 
139 
     | 
    
         
             
                res.should.be.not_found
         
     | 
| 
         @@ -146,7 +146,7 @@ describe Rack::URLMap do 
     | 
|
| 
       146 
146 
     | 
    
         
             
              end
         
     | 
| 
       147 
147 
     | 
    
         | 
| 
       148 
148 
     | 
    
         
             
              should "route root apps correctly" do
         
     | 
| 
       149 
     | 
    
         
            -
                map = Rack::URLMap.new("/" => lambda { |env|
         
     | 
| 
      
 149 
     | 
    
         
            +
                map = Rack::Lint.new(Rack::URLMap.new("/" => lambda { |env|
         
     | 
| 
       150 
150 
     | 
    
         
             
                                         [200,
         
     | 
| 
       151 
151 
     | 
    
         
             
                                          { "Content-Type" => "text/plain",
         
     | 
| 
       152 
152 
     | 
    
         
             
                                            "X-Position" => "root",
         
     | 
| 
         @@ -160,7 +160,7 @@ describe Rack::URLMap do 
     | 
|
| 
       160 
160 
     | 
    
         
             
                                            "X-PathInfo" => env["PATH_INFO"],
         
     | 
| 
       161 
161 
     | 
    
         
             
                                            "X-ScriptName" => env["SCRIPT_NAME"]
         
     | 
| 
       162 
162 
     | 
    
         
             
                                          }, [""]]}
         
     | 
| 
       163 
     | 
    
         
            -
                                       )
         
     | 
| 
      
 163 
     | 
    
         
            +
                                       ))
         
     | 
| 
       164 
164 
     | 
    
         | 
| 
       165 
165 
     | 
    
         
             
                res = Rack::MockRequest.new(map).get("/foo/bar")
         
     | 
| 
       166 
166 
     | 
    
         
             
                res.should.be.ok
         
     | 
| 
         @@ -188,7 +188,7 @@ describe Rack::URLMap do 
     | 
|
| 
       188 
188 
     | 
    
         
             
              end
         
     | 
| 
       189 
189 
     | 
    
         | 
| 
       190 
190 
     | 
    
         
             
              should "not squeeze slashes" do
         
     | 
| 
       191 
     | 
    
         
            -
                map = Rack::URLMap.new("/" => lambda { |env|
         
     | 
| 
      
 191 
     | 
    
         
            +
                map = Rack::Lint.new(Rack::URLMap.new("/" => lambda { |env|
         
     | 
| 
       192 
192 
     | 
    
         
             
                                         [200,
         
     | 
| 
       193 
193 
     | 
    
         
             
                                          { "Content-Type" => "text/plain",
         
     | 
| 
       194 
194 
     | 
    
         
             
                                            "X-Position" => "root",
         
     | 
| 
         @@ -202,7 +202,7 @@ describe Rack::URLMap do 
     | 
|
| 
       202 
202 
     | 
    
         
             
                                            "X-PathInfo" => env["PATH_INFO"],
         
     | 
| 
       203 
203 
     | 
    
         
             
                                            "X-ScriptName" => env["SCRIPT_NAME"]
         
     | 
| 
       204 
204 
     | 
    
         
             
                                          }, [""]]}
         
     | 
| 
       205 
     | 
    
         
            -
                                       )
         
     | 
| 
      
 205 
     | 
    
         
            +
                                       ))
         
     | 
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
                res = Rack::MockRequest.new(map).get("/http://example.org/bar")
         
     | 
| 
       208 
208 
     | 
    
         
             
                res.should.be.ok
         
     |