diff --git a/Gemfile b/Gemfile index 8a7ce4e..b0bcff4 100644 --- a/Gemfile +++ b/Gemfile @@ -15,11 +15,6 @@ group :test do gem "websocket_parser", "~>1.0" end -group :webservers do - gem 'http', '~> 0.6.0' - gem 'httpkit', :platform => [:mri, :rbx] -end - group :guard do gem 'guard-rspec', '~> 4.7' case RbConfig::CONFIG['host_os'] diff --git a/README.md b/README.md index 147df85..c418533 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,7 @@ are up to you. requests, and response codes for you. * Provides a base resource with points of extension to let you describe what is relevant about your particular resource. -* Supports WEBrick, Reel, HTTPkit, and a Rack shim. Other host - servers are being investigated. +* Supports WEBrick and a Rack shim. Other host servers are being investigated. * Streaming/chunked response bodies are permitted as Enumerables, Procs, or Fibers! * Unlike the Erlang original, it does real Language negotiation. diff --git a/documentation/adapters.md b/documentation/adapters.md index b64a412..3bba691 100644 --- a/documentation/adapters.md +++ b/documentation/adapters.md @@ -1,7 +1,7 @@ ### Adapters -Webmachine includes adapters for [WEBrick][webrick], and -[HTTPkit][httpkit]. Additionally, the [Rack][rack] adapter lets it +Webmachine includes an adapter for [WEBrick][webrick]. +Additionally, the [Rack][rack] adapter lets it run on any webserver that provides a Rack interface. It also lets it run on [Shotgun][shotgun] ([example][shotgun_example]). @@ -24,15 +24,7 @@ For an example of using Webmachine with Rack middleware, see the [Pact Broker][m See the [Rack Adapter API docs][rack-adapter-api-docs] for more information. -#### A Note about MRI 1.9 - -The [HTTPkit][httpkit] -adapter might crash with a `SystemStackError` on MRI 1.9 due to its -limited fiber stack size. If your application is affected by this, the -only known solution is to switch to JRuby, Rubinius or MRI 2.0. - [webrick]: http://rubydoc.info/stdlib/webrick -[httpkit]: https://github.com/lgierth/httpkit [rack]: https://github.com/rack/rack [shotgun]: https://github.com/rtomayko/shotgun [shotgun_example]: https://gist.github.com/4389220 diff --git a/lib/webmachine/adapters.rb b/lib/webmachine/adapters.rb index 6db2c8d..ab6dc23 100644 --- a/lib/webmachine/adapters.rb +++ b/lib/webmachine/adapters.rb @@ -5,6 +5,5 @@ module Webmachine # Contains classes and modules that connect Webmachine to Ruby # application servers. module Adapters - autoload :HTTPkit, 'webmachine/adapters/httpkit' end end diff --git a/lib/webmachine/adapters/httpkit.rb b/lib/webmachine/adapters/httpkit.rb deleted file mode 100644 index 2198e8f..0000000 --- a/lib/webmachine/adapters/httpkit.rb +++ /dev/null @@ -1,74 +0,0 @@ -require 'webmachine/adapter' -require 'webmachine/constants' -require 'webmachine/version' -require 'httpkit' -require 'webmachine/version' -require 'webmachine/response' -require 'webmachine/request' -require 'webmachine/headers' - -module Webmachine - module Adapters - class HTTPkit < Adapter - VERSION_STRING = "#{Webmachine::SERVER_STRING} HTTPkit/#{::HTTPkit::VERSION}".freeze - - def options - @options ||= { - :address => application.configuration.ip, - :port => application.configuration.port, - :handlers => [ - ::HTTPkit::Server::TimeoutsHandler.new, - ::HTTPkit::Server::KeepAliveHandler.new, - self - ] - } - end - - def run - ::HTTPkit.start do - ::HTTPkit::Server.start(options) - end - end - - # Called by HTTPkit::Server for every request - def serve(request, served) - response = Webmachine::Response.new - application.dispatcher.dispatch(convert_request(request), response) - - served.fulfill(convert_response(response)) - end - - private - - # Converts HTTPkit::Request to Webmachine::Request - def convert_request(request) - Webmachine::Request.new( - request.http_method.to_s.upcase, - request.uri, - Webmachine::Headers[request.headers.dup], - request.body) - end - - # Converts Webmachine::Response to HTTPkit::Response - def convert_response(response) - response.headers[SERVER] = VERSION_STRING - - - ::HTTPkit::Response.new( - response.code.to_i, - response.headers, - convert_body(response.body)) - end - - # HTTPkit::Body accepts strings and enumerables, i.e. Webmachine's - # Callable, Enumerable, IO, and Fiber encoders are supported. - def convert_body(body) - if body.respond_to?(:call) - [body.call] - else - body || '' - end - end - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 20a161a..00eaf7c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ require "bundler/setup" -Bundler.require :default, :test, :webservers +Bundler.require :default, :test require 'logger' class NullLogger < Logger diff --git a/spec/webmachine/adapters/httpkit_spec.rb b/spec/webmachine/adapters/httpkit_spec.rb deleted file mode 100644 index f2ee7dd..0000000 --- a/spec/webmachine/adapters/httpkit_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "spec_helper" -require "webmachine/spec/adapter_lint" - -begin - describe Webmachine::Adapters::HTTPkit do - it_should_behave_like :adapter_lint - end -rescue LoadError - warn "Platform is #{RUBY_PLATFORM}: skipping httpkit adapter spec." -end