GRAYBYTE WORDPRESS FILE MANAGER1321

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/alt/ruby20/lib64/ruby/gems/2.0.0/gems/rack-1.6.4/test/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/alt/ruby20/lib64/ruby/gems/2.0.0/gems/rack-1.6.4/test//spec_urlmap.rb
require 'rack/urlmap'
require 'rack/mock'

describe Rack::URLMap do
  it "dispatches paths correctly" do
    app = lambda { |env|
      [200, {
        'X-ScriptName' => env['SCRIPT_NAME'],
        'X-PathInfo' => env['PATH_INFO'],
        'Content-Type' => 'text/plain'
      }, [""]]
    }
    map = Rack::Lint.new(Rack::URLMap.new({
      'http://foo.org/bar' => app,
      '/foo' => app,
      '/foo/bar' => app
    }))

    res = Rack::MockRequest.new(map).get("/")
    res.should.be.not_found

    res = Rack::MockRequest.new(map).get("/qux")
    res.should.be.not_found

    res = Rack::MockRequest.new(map).get("/foo")
    res.should.be.ok
    res["X-ScriptName"].should.equal "/foo"
    res["X-PathInfo"].should.equal ""

    res = Rack::MockRequest.new(map).get("/foo/")
    res.should.be.ok
    res["X-ScriptName"].should.equal "/foo"
    res["X-PathInfo"].should.equal "/"

    res = Rack::MockRequest.new(map).get("/foo/bar")
    res.should.be.ok
    res["X-ScriptName"].should.equal "/foo/bar"
    res["X-PathInfo"].should.equal ""

    res = Rack::MockRequest.new(map).get("/foo/bar/")
    res.should.be.ok
    res["X-ScriptName"].should.equal "/foo/bar"
    res["X-PathInfo"].should.equal "/"

    res = Rack::MockRequest.new(map).get("/foo///bar//quux")
    res.status.should.equal 200
    res.should.be.ok
    res["X-ScriptName"].should.equal "/foo/bar"
    res["X-PathInfo"].should.equal "//quux"

    res = Rack::MockRequest.new(map).get("/foo/quux", "SCRIPT_NAME" => "/bleh")
    res.should.be.ok
    res["X-ScriptName"].should.equal "/bleh/foo"
    res["X-PathInfo"].should.equal "/quux"

    res = Rack::MockRequest.new(map).get("/bar", 'HTTP_HOST' => 'foo.org')
    res.should.be.ok
    res["X-ScriptName"].should.equal "/bar"
    res["X-PathInfo"].should.be.empty

    res = Rack::MockRequest.new(map).get("/bar/", 'HTTP_HOST' => 'foo.org')
    res.should.be.ok
    res["X-ScriptName"].should.equal "/bar"
    res["X-PathInfo"].should.equal '/'
  end


  it "dispatches hosts correctly" do
    map = Rack::Lint.new(Rack::URLMap.new("http://foo.org/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "foo.org",
                                "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
                              }, [""]]},
                           "http://subdomain.foo.org/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "subdomain.foo.org",
                                "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
                              }, [""]]},
                           "http://bar.org/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "bar.org",
                                "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
                              }, [""]]},
                           "/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "default.org",
                                "X-Host" => env["HTTP_HOST"] || env["SERVER_NAME"],
                              }, [""]]}
                           ))

    res = Rack::MockRequest.new(map).get("/")
    res.should.be.ok
    res["X-Position"].should.equal "default.org"

    res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "bar.org")
    res.should.be.ok
    res["X-Position"].should.equal "bar.org"

    res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "foo.org")
    res.should.be.ok
    res["X-Position"].should.equal "foo.org"

    res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "subdomain.foo.org", "SERVER_NAME" => "foo.org")
    res.should.be.ok
    res["X-Position"].should.equal "subdomain.foo.org"

    res = Rack::MockRequest.new(map).get("http://foo.org/")
    res.should.be.ok
    res["X-Position"].should.equal "foo.org"

    res = Rack::MockRequest.new(map).get("/", "HTTP_HOST" => "example.org")
    res.should.be.ok
    res["X-Position"].should.equal "default.org"

    res = Rack::MockRequest.new(map).get("/",
                                         "HTTP_HOST" => "example.org:9292",
                                         "SERVER_PORT" => "9292")
    res.should.be.ok
    res["X-Position"].should.equal "default.org"
  end

  should "be nestable" do
    map = Rack::Lint.new(Rack::URLMap.new("/foo" =>
      Rack::URLMap.new("/bar" =>
        Rack::URLMap.new("/quux" =>  lambda { |env|
                           [200,
                            { "Content-Type" => "text/plain",
                              "X-Position" => "/foo/bar/quux",
                              "X-PathInfo" => env["PATH_INFO"],
                              "X-ScriptName" => env["SCRIPT_NAME"],
                            }, [""]]}
                         ))))

    res = Rack::MockRequest.new(map).get("/foo/bar")
    res.should.be.not_found

    res = Rack::MockRequest.new(map).get("/foo/bar/quux")
    res.should.be.ok
    res["X-Position"].should.equal "/foo/bar/quux"
    res["X-PathInfo"].should.equal ""
    res["X-ScriptName"].should.equal "/foo/bar/quux"
  end

  should "route root apps correctly" do
    map = Rack::Lint.new(Rack::URLMap.new("/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "root",
                                "X-PathInfo" => env["PATH_INFO"],
                                "X-ScriptName" => env["SCRIPT_NAME"]
                              }, [""]]},
                           "/foo" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "foo",
                                "X-PathInfo" => env["PATH_INFO"],
                                "X-ScriptName" => env["SCRIPT_NAME"]
                              }, [""]]}
                           ))

    res = Rack::MockRequest.new(map).get("/foo/bar")
    res.should.be.ok
    res["X-Position"].should.equal "foo"
    res["X-PathInfo"].should.equal "/bar"
    res["X-ScriptName"].should.equal "/foo"

    res = Rack::MockRequest.new(map).get("/foo")
    res.should.be.ok
    res["X-Position"].should.equal "foo"
    res["X-PathInfo"].should.equal ""
    res["X-ScriptName"].should.equal "/foo"

    res = Rack::MockRequest.new(map).get("/bar")
    res.should.be.ok
    res["X-Position"].should.equal "root"
    res["X-PathInfo"].should.equal "/bar"
    res["X-ScriptName"].should.equal ""

    res = Rack::MockRequest.new(map).get("")
    res.should.be.ok
    res["X-Position"].should.equal "root"
    res["X-PathInfo"].should.equal "/"
    res["X-ScriptName"].should.equal ""
  end

  should "not squeeze slashes" do
    map = Rack::Lint.new(Rack::URLMap.new("/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "root",
                                "X-PathInfo" => env["PATH_INFO"],
                                "X-ScriptName" => env["SCRIPT_NAME"]
                              }, [""]]},
                           "/foo" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "foo",
                                "X-PathInfo" => env["PATH_INFO"],
                                "X-ScriptName" => env["SCRIPT_NAME"]
                              }, [""]]}
                           ))

    res = Rack::MockRequest.new(map).get("/http://example.org/bar")
    res.should.be.ok
    res["X-Position"].should.equal "root"
    res["X-PathInfo"].should.equal "/http://example.org/bar"
    res["X-ScriptName"].should.equal ""
  end

  should "not be case sensitive with hosts" do
    map = Rack::Lint.new(Rack::URLMap.new("http://example.org/" => lambda { |env|
                             [200,
                              { "Content-Type" => "text/plain",
                                "X-Position" => "root",
                                "X-PathInfo" => env["PATH_INFO"],
                                "X-ScriptName" => env["SCRIPT_NAME"]
                              }, [""]]}
                           ))

    res = Rack::MockRequest.new(map).get("http://example.org/")
    res.should.be.ok
    res["X-Position"].should.equal "root"
    res["X-PathInfo"].should.equal "/"
    res["X-ScriptName"].should.equal ""

    res = Rack::MockRequest.new(map).get("http://EXAMPLE.ORG/")
    res.should.be.ok
    res["X-Position"].should.equal "root"
    res["X-PathInfo"].should.equal "/"
    res["X-ScriptName"].should.equal ""
  end
end

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 03 2024 22:43:39
root / root
0755
builder
--
March 03 2024 22:43:39
root / root
0755
cgi
--
March 03 2024 22:43:39
root / root
0755
multipart
--
March 03 2024 22:43:39
root / root
0755
rackup
--
March 03 2024 22:43:39
root / root
0755
registering_handler
--
March 03 2024 22:43:39
root / root
0755
static
--
March 03 2024 22:43:39
root / root
0755
unregistered_handler
--
March 03 2024 22:43:39
root / root
0755
gemloader.rb
0.291 KB
December 05 2019 22:59:18
root / root
0644
spec_auth_basic.rb
2.261 KB
December 05 2019 22:59:18
root / root
0644
spec_auth_digest.rb
8.079 KB
December 05 2019 22:59:18
root / root
0644
spec_body_proxy.rb
2.198 KB
December 05 2019 22:59:18
root / root
0644
spec_builder.rb
6.202 KB
December 05 2019 22:59:18
root / root
0644
spec_cascade.rb
2.11 KB
December 05 2019 22:59:18
root / root
0644
spec_cgi.rb
2.925 KB
December 05 2019 22:59:18
root / root
0644
spec_chunked.rb
3.868 KB
December 05 2019 22:59:18
root / root
0644
spec_commonlogger.rb
2.373 KB
December 05 2019 22:59:18
root / root
0644
spec_conditionalget.rb
3.281 KB
December 05 2019 22:59:18
root / root
0644
spec_config.rb
0.531 KB
December 05 2019 22:59:18
root / root
0644
spec_content_length.rb
2.801 KB
December 05 2019 22:59:18
root / root
0644
spec_content_type.rb
1.475 KB
December 05 2019 22:59:18
root / root
0644
spec_deflater.rb
10.041 KB
December 05 2019 22:59:18
root / root
0644
spec_directory.rb
2.194 KB
December 05 2019 22:59:18
root / root
0644
spec_etag.rb
3.836 KB
December 05 2019 22:59:18
root / root
0644
spec_fastcgi.rb
3.08 KB
December 05 2019 22:59:18
root / root
0644
spec_file.rb
6.321 KB
December 05 2019 22:59:18
root / root
0644
spec_handler.rb
1.874 KB
December 05 2019 22:59:18
root / root
0644
spec_head.rb
1.355 KB
December 05 2019 22:59:18
root / root
0644
spec_lint.rb
19.226 KB
December 05 2019 22:59:18
root / root
0644
spec_lobster.rb
1.232 KB
December 05 2019 22:59:18
root / root
0644
spec_lock.rb
4.333 KB
December 05 2019 22:59:18
root / root
0644
spec_logger.rb
0.607 KB
December 05 2019 22:59:18
root / root
0644
spec_methodoverride.rb
2.381 KB
December 05 2019 22:59:18
root / root
0644
spec_mime.rb
1.806 KB
December 05 2019 22:59:18
root / root
0644
spec_mock.rb
9.343 KB
December 05 2019 22:59:18
root / root
0644
spec_mongrel.rb
5.728 KB
December 05 2019 22:59:18
root / root
0644
spec_multipart.rb
23.624 KB
December 05 2019 22:59:18
root / root
0644
spec_nulllogger.rb
0.502 KB
December 05 2019 22:59:18
root / root
0644
spec_recursive.rb
1.828 KB
December 05 2019 22:59:18
root / root
0644
spec_request.rb
42.524 KB
December 05 2019 22:59:18
root / root
0644
spec_response.rb
10.076 KB
December 05 2019 22:59:18
root / root
0644
spec_rewindable_input.rb
2.776 KB
December 05 2019 22:59:18
root / root
0644
spec_runtime.rb
1.533 KB
December 05 2019 22:59:18
root / root
0644
spec_sendfile.rb
4.123 KB
December 05 2019 22:59:18
root / root
0644
spec_server.rb
5.568 KB
December 05 2019 22:59:18
root / root
0644
spec_session_abstract_id.rb
1.293 KB
December 05 2019 22:59:18
root / root
0644
spec_session_cookie.rb
12.937 KB
December 05 2019 22:59:18
root / root
0644
spec_session_memcache.rb
11.116 KB
December 05 2019 22:59:18
root / root
0644
spec_session_pool.rb
6.534 KB
December 05 2019 22:59:18
root / root
0644
spec_showexceptions.rb
2.013 KB
December 05 2019 22:59:18
root / root
0644
spec_showstatus.rb
2.737 KB
December 05 2019 22:59:18
root / root
0644
spec_static.rb
4.603 KB
December 05 2019 22:59:18
root / root
0644
spec_tempfile_reaper.rb
1.574 KB
December 05 2019 22:59:18
root / root
0644
spec_thin.rb
2.548 KB
December 05 2019 22:59:18
root / root
0644
spec_urlmap.rb
8.82 KB
December 05 2019 22:59:18
root / root
0644
spec_utils.rb
24.895 KB
December 05 2019 22:59:18
root / root
0644
spec_version.rb
0.492 KB
December 05 2019 22:59:18
root / root
0644
spec_webrick.rb
5.505 KB
December 05 2019 22:59:18
root / root
0644
testrequest.rb
1.965 KB
December 05 2019 22:59:18
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF