Commit 913442162ff6607d3f5c41a58a5ebf1fbf25b7a5

Thomas de Grivel 2024-10-09T22:58:04

fix http_request_buf_parse

diff --git a/.ikc3_history b/.ikc3_history
index c5e2511..64049b5 100644
--- a/.ikc3_history
+++ b/.ikc3_history
@@ -1,45 +1,3 @@
-hd(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
-List.first(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
-first(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
-(Sym) first(Str.split((Str) HTTP.mime_type(File.ext("Plop.html")), "/"))
-SH.run("file -b ${SH.escape(path)}")
-size = 10
-if (size > 1024 * 1024 * 1024 * 1024) do                                    
-if (size > 1024 * 1024 * 1024 * 1024) do
- s = size * 10 / 1024 / 1024 / 1024 / 1024
-"#{s / 10}.#{s % 10}Tb"
-size = 100
-if (size > 1024) do
-s = size * 10 / 1024
-"#{s / 10}.#{s % 10}Kb"
-quote %
-10 % 3
-human_size(1024)
-human_size(1025)
-human_size(1024)
-human_size(2024024)
-human_size(100)
-Str.size("abc")
-human_size(0)
-human_size((Uw) 114)
-type(1024 * 1024 * 1024 * 1024)
-human_size((Uw) 114)
-system(["ls", "-l"])
-puts(system(["ls", "-l"]))
-puts(system(["ls", "-l"])
-)
-1 +
-2
-1 + 2
-1 + 100000000000000000000000000000000000000000000
-1 + 100000000000000000000000000000000000000000000.
-1 + 10000000000000000000000000000000000000000000.
-1 + 10000000000000000000000000000000000000000000
-1 + 10000000000000.0
-1 + 10000000000000/2
-1 + 10000000000000/3
-1 + 2/3
-3 **** 4
 def op = %KC3.Operator{sym: :****, symbol_value: fn (a, b) { a * b * 4 }}
 3 **** 4
 3 * 4 * 4
@@ -97,3 +55,45 @@ quote %HTTP.Request{method: GET, url: "/plop", body: void}
 quote [a: 1, b: 2]
 [a: 1, b: 2]
 AList.to_map([a: 1, b: 2])
+1 + 1
+1 + 100000000000000000000000000000000000000000000000000000000
+type(1 + 100000000000000000000000000000000000000000000000000000000)
+type(1 + 1)
+type(255)
+type(256)
+type(1)
+type(1 + 256)
+1 + 256
+(U8) 256
+(U8) 257
+(U16) 1
+(Str) 1
+(Str) 100000000000000000000000000000000000000000000000000000000
+(Str) 100000
+(Str) %{a: 1, b: 2}
+puts(inspect(%{a: 1, b: 2}))
+puts(inspect(quote if true do 1 else %{a: 1, b: 2} end))
+puts(quote if true do 1 else %{a: 1, b: 2} end)
+quote 1 + 1
+type(quote 1 + 1)
+type(quote plop(1 + 1))
+type(quote quote plop(1 + 1))
+def eval = macro (args) { args }
+eval(quote 1 + 1)
+eval(1 + 1)
+def eval = macro (args) { unquote(args) }
+eval(1 + 1)
+def eval = macro (args) { args }
+eval(1 + 1)
+eval(quote 1 + 1)
+a = %KC3.Operator{sym: :****, symbol_value: fn (a, b) { (a + b) * 4 }}
+def op_muul = %KC3.Operator{sym: :****, symbol_value: fn (a, b) { (a + b) * 4 }}
+3 **** 4
+3 //// 4
+def op_muul = %KC3.Operator{sym: :////, symbol_value: fn (a, b) { (a - b) * 4 }}
+3 //// 4
+{a, b, c} = {1, 2, 3}
+%{a: a, b: b, c: c} = %{a: 1, b: 2, c: 3}
+a
+b
+c
diff --git a/http/http_request.c b/http/http_request.c
index 9417d1d..e4fcfba 100644
--- a/http/http_request.c
+++ b/http/http_request.c
@@ -115,13 +115,12 @@ s_tag * http_request_buf_parse (s_tag *req, s_buf *buf)
         err_inspect_tag(&body);
         err_write_1("\n");
       }
-      if (! alist_get((const s_list * const *) &body.data.list,
-                      &method_key, &method_value))
-        goto restore;
-      if (! http_request_method_from_str(&method_value.data.str,
-                                         &tmp_req.method))
-        goto restore;
-      tag_clean(&method_value);
+      if (alist_get((const s_list * const *) &body.data.list,
+                    &method_key, &method_value)) {
+        http_request_method_from_str(&method_value.data.str,
+                                     &tmp_req.method);
+        tag_clean(&method_value);
+      }
       str_clean(body_str);
       tmp_req.body = body;
     }
diff --git a/httpd/fx/db/fx.facts b/httpd/fx/db/fx.facts
index 11b5f0d..f5ffc63 100644
--- a/httpd/fx/db/fx.facts
+++ b/httpd/fx/db/fx.facts
@@ -1,10 +1,11 @@
 %{module: KC3.Facts.Dump,
   version: 1}
-add {"fx/img/toast.128.png", "0", "1"}
-add {"fx/img/toast.128.png", "123", "456"}
-add {"fx/img/toast.128.png", "reason", "persistence"}
+add {"fx/img/", "hello", "paul"}
+add {"fx/img/flaps.256.png", "is_a", "animation"}
+add {"fx/img/flaps.256.png", "is_a", "motion picture"}
+add {"fx/img/flaps.256.png", "is_missing", "toast"}
+add {"fx/img/flaps.256.png", "tag", "animation"}
 add {"fx/img/toast.128.png", "salut", "raphael"}
+add {"fx/img/toast.128.png", "tag", "picture"}
+add {"fx/img/toast.128.png", "tag", "toast"}
 add {"fx/img/toast.128.png", "why_toast", "because_it_works"}
-remove {"fx/img/toast.128.png", "0", "1"}
-remove {"fx/img/toast.128.png", "123", "456"}
-remove {"fx/img/toast.128.png", "reason", "persistence"}