interpreter&vm: handle multi-iterator
[nit.git] / lib / nitcorn / reactor.nit
index 1a56ee8..8124f97 100644 (file)
@@ -2,6 +2,7 @@
 #
 # Copyright 2013 Jean-Philippe Caissy <jpcaissy@piji.ca>
 # Copyright 2014 Alexis Laferrière <alexis.laf@xymus.net>
+# Copyright 2014 Alexandre Terrasa <alexandre@moz-code.org>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -19,9 +20,9 @@
 module reactor
 
 import more_collections
-import libevent
+import http_request_parser
 
-import server_config
+import vararg_routes
 import http_request
 import http_response
 
@@ -41,10 +42,7 @@ class HttpServer
 
        redef fun read_callback(str)
        do
-               # TODO support bigger inputs (such as big forms and file upload)
-
                var request_object = parser.parse_http_request(str.to_s)
-
                if request_object != null then delegate_answer request_object
        end
 
@@ -72,6 +70,9 @@ class HttpServer
                if virtual_host != null then
                        var route = virtual_host.routes[request.uri]
                        if route != null then
+                               # include uri parameters in request
+                               request.uri_params = route.parse_params(request.uri)
+
                                var handler = route.handler
                                var root = route.path
                                var turi