Commit 7e2e5b9d390dc1ff1e77ba23526e3ff40eb474a9

Thomas de Grivel 2024-11-19T22:19:39

httpd: remove puts

diff --git a/lib/kc3/0.1/httpd.kc3 b/lib/kc3/0.1/httpd.kc3
index fd07d7d..14d62fb 100644
--- a/lib/kc3/0.1/httpd.kc3
+++ b/lib/kc3/0.1/httpd.kc3
@@ -109,6 +109,7 @@ defmodule HTTPd do
     if event_base = Event.base_new() do
       if socket = Socket.listen(host, port) do
         puts("KC3 HTTPd: listening on #{host}:#{port}")
+        load_app()
         acceptor_ev = Event.new(event_base, socket.fd, [:read, :persist],
           acceptor, void)
         r = Event.add(acceptor_ev, time_zero)
@@ -127,12 +128,10 @@ defmodule HTTPd do
       host = getenv("KC3_HTTPD_HOST")
       port = getenv("KC3_HTTPD_PORT")
       event_base = Event.base_new()
-      load_app()
       server(host, port)
     }
     (host, port) {
       event_base = Event.base_new()
-      load_app()
       server(host, port)
     }
   }
@@ -285,7 +284,7 @@ defmodule HTTPd do
   }
     
   def def_static_route = fn (prefix, root_dir, url_skip) {
-    puts("def_static_route: #{inspect(prefix)}, #{inspect(root_dir)}, #{url_skip}")
+    #puts("def_static_route: #{inspect(prefix)}, #{inspect(root_dir)}, #{url_skip}")
     directory_page = HTTPd.fn (request) {
       url = URL.eat(request.url, url_skip)
       files = List.sort(File.list(root_dir + url))
@@ -340,15 +339,15 @@ defmodule HTTPd do
       end
     }
     route = HTTPd.fn (request) {
-      puts("def_static_route: route: request.url: #{inspect(request.url)}")
-      puts("def_static_route: route: url_skip: #{url_skip}")
+      #puts("def_static_route: route: request.url: #{inspect(request.url)}")
+      #puts("def_static_route: route: url_skip: #{url_skip}")
       url = URL.eat(request.url, url_skip)
-      puts("def_static_route: route: url: #{inspect(url)}")
+      #puts("def_static_route: route: url: #{inspect(url)}")
       render = if (Str.starts_with?(url, "/") &&
                    ! Str.has_str?(url, "/../") &&
                    ! Str.ends_with?(url, "/..")) do
         path = root_dir + url
-        puts("def_static_route: route: path: #{inspect(path)}")
+        #puts("def_static_route: route: path: #{inspect(path)}")
         if File.exists?(path) do
           if File.is_directory?(path) do
             directory_page