Commits

Dmitry Grebeniuk  committed 284f16d

.

  • Participants
  • Parent commits 066f0ae

Comments (0)

Files changed (1)

File amall_http_service.ml

     ;
 
 
-    value find_handler disp_level segpath : (segpath * http_service_func) =
-      (ignore disp_level; ignore segpath; failwith "kva")
+    value rec find_handler disp_level segpath : (segpath * http_service_func) =
+      match segpath with
+      [ [] -> (segpath, disp_level.fallback)
+      | [seg :: segs] ->
+          match disp_level.seg_map#get_opt seg with
+          [ None -> (segpath, disp_level.fallback)
+          | Some (Level disp_level) -> find_handler disp_level segs
+          | Some (Service f) -> (segs, f)
+          ]
+      ]
     ;
 
+
     value (server_func : disp_level -> http_server_func)
       root_disp_level
     = fun rq ->