diff options
Diffstat (limited to 'lib/plum/server')
-rw-r--r-- | lib/plum/server/http_connection.rb | 15 | ||||
-rw-r--r-- | lib/plum/server/ssl_socket_connection.rb (renamed from lib/plum/server/https_connection.rb) | 2 |
2 files changed, 4 insertions, 13 deletions
diff --git a/lib/plum/server/http_connection.rb b/lib/plum/server/http_connection.rb index 1860126..642bcbc 100644 --- a/lib/plum/server/http_connection.rb +++ b/lib/plum/server/http_connection.rb @@ -3,20 +3,11 @@ using Plum::BinaryString module Plum class HTTPServerConnection < ServerConnection - attr_reader :sock - - def initialize(sock, local_settings = {}) + def initialize(writer, local_settings = {}) require "http/parser" - @sock = sock @negobuf = String.new @_http_parser = setup_parser - super(@sock.method(:write), local_settings) - end - - # Closes the socket. - def close - super - @sock.close + super(writer, local_settings) end private @@ -68,7 +59,7 @@ module Plum "Server: plum/#{Plum::VERSION}\r\n" + "\r\n" - @sock.write(resp) + @writer.call(resp) end def process_first_request(parser, headers, body) diff --git a/lib/plum/server/https_connection.rb b/lib/plum/server/ssl_socket_connection.rb index bac1b4b..47e823a 100644 --- a/lib/plum/server/https_connection.rb +++ b/lib/plum/server/ssl_socket_connection.rb @@ -1,6 +1,6 @@ # -*- frozen-string-literal: true -*- module Plum - class HTTPSServerConnection < ServerConnection + class SSLSocketServerConnection < ServerConnection attr_reader :sock def initialize(sock, local_settings = {}) |