diff options
author | Azul <azul@riseup.net> | 2016-06-30 11:23:45 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-06-30 12:04:07 +0200 |
commit | 0491e79c4e5f16d38cf87e53290394e1eccfa2e9 (patch) | |
tree | 56d0aff1fc8ca1bbd11b09bc6929f00132467898 /lib/nickserver/em_server.rb | |
parent | 4132d6e6db3755334ace352165991487802c6b82 (diff) |
Trying to replace EM base server with reel
some tests are still broken. But at least they are running now.
Diffstat (limited to 'lib/nickserver/em_server.rb')
-rw-r--r-- | lib/nickserver/em_server.rb | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/nickserver/em_server.rb b/lib/nickserver/em_server.rb deleted file mode 100644 index a983249..0000000 --- a/lib/nickserver/em_server.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'eventmachine' -silence_warnings do - require 'evma_httpserver' -end -require 'nickserver/request_handler' - -module Nickserver - class EmServer < EM::Connection - include EM::HttpServer - - def self.start(options = {}) - EventMachine.run do - EM.start_server options[:host], options[:port], self - end - end - - def post_init - super - no_environment_strings - end - - def process_http_request - handler.respond_to params, @http_headers - end - - def respond(status, content) - response = EM::DelegatedHttpResponse.new(self) - response.status = status - response.content_type 'text/plain' - response.content = content - silence_warnings do - response.send_response - end - end - - private - - def handler - @handler ||= RequestHandler.new(self, Nickserver::Adapters::EmHttp.new) - end - - def params - if @http_query_string - CGI.parse(@http_query_string) - elsif @http_post_content - CGI.parse(@http_post_content) - end - end - - end -end |