lib/nitcorn: http_request_buffer subclass Connection instead of refining it
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 17 Nov 2015 14:22:36 +0000 (09:22 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 17 Nov 2015 16:26:25 +0000 (11:26 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/nitcorn/http_request_buffer.nit
lib/nitcorn/reactor.nit

index 6d50b5f..da80a0a 100644 (file)
@@ -17,7 +17,11 @@ module http_request_buffer
 
 intrude import libevent
 
-redef class Connection
+# Connection rebuilding HTTP requests
+#
+# Subclass should refine `read_full_request` and avoid `read_callback`.
+class HTTPConnection
+       super Connection
 
        private var in_request = false
        private var in_header = false
index 80633b3..ce04385 100644 (file)
@@ -28,16 +28,11 @@ import http_response
 
 # A server handling a single connection
 class HttpServer
-       super Connection
+       super HTTPConnection
 
        # The associated `HttpFactory`
        var factory: HttpFactory
 
-       # Init the server using `HttpFactory`.
-       init(buf_ev: NativeBufferEvent, factory: HttpFactory) is old_style_init do
-               self.factory = factory
-       end
-
        private var parser = new HttpRequestParser is lazy
 
        redef fun read_callback(str)