diff options
-rw-r--r-- | lib/rack/handler.rb | 6 | ||||
-rw-r--r-- | lib/rack/handler/webrick.rb | 3 | ||||
-rw-r--r-- | test/spec_webrick.rb | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/rack/handler.rb b/lib/rack/handler.rb index 3d99b85d..e5843d3c 100644 --- a/lib/rack/handler.rb +++ b/lib/rack/handler.rb @@ -9,6 +9,8 @@ module Rack # A second optional hash can be passed to include server-specific # configuration. module Handler + @handlers = {} + def self.get(server) return unless server server = server.to_s @@ -79,11 +81,7 @@ module Rack end def self.register(server, klass) - @handlers ||= {} @handlers[server.to_s] = klass.to_s end - - autoload :WEBrick, "rack/handler/webrick" - register 'webrick', 'Rack::Handler::WEBrick' end end diff --git a/lib/rack/handler/webrick.rb b/lib/rack/handler/webrick.rb index 9044ab78..a82dd585 100644 --- a/lib/rack/handler/webrick.rb +++ b/lib/rack/handler/webrick.rb @@ -4,6 +4,7 @@ require 'webrick' require 'stringio' require_relative '../constants' +require_relative '../handler' require_relative '../version' # This monkey patch allows for applications to perform their own chunking @@ -124,5 +125,7 @@ module Rack end end end + + register 'webrick', WEBrick end end diff --git a/test/spec_webrick.rb b/test/spec_webrick.rb index 948f69f8..322672ac 100644 --- a/test/spec_webrick.rb +++ b/test/spec_webrick.rb @@ -3,6 +3,7 @@ require_relative 'helper' require 'thread' require 'webrick' +require 'rack/handler/webrick' require_relative 'test_request' separate_testing do |