[SCM] Lisaac compiler branch, pierre-alex, updated. lisaac-0.12-566-g525f692

ontologiae ontologiae at ordinateur-de-ontologiae.local
Tue Mar 30 16:49:10 UTC 2010


The following commit has been merged in the pierre-alex branch:
commit 525f692ea28cbf8b0f8046867d3b1ec8b1a1e1e0
Author: ontologiae <ontologiae at ordinateur-de-ontologiae.local>
Date:   Thu Feb 4 15:41:30 2010 +0100

    http server post

diff --git a/lib/standard/http/http_server.li b/lib/standard/http/http_server.li
index 6264b11..85c4fad 100644
--- a/lib/standard/http/http_server.li
+++ b/lib/standard/http/http_server.li
@@ -347,13 +347,20 @@ Section Public
     // Pour le post : on reçoit une hash de clé/valeur ainsi qu'un nom de post : on regarde si on a un {HASH(STR,STR);STR} dans le HASH(STR, {HASH(STR,STR);STR}) et on l'exécute
 
 
-    - decode_parameters : HASHED_DICTIONARY(STRING,STRING) <-
+    - decode_parameters param : STRING : HASHED_DICTIONARY(STRING,STRING) <-
     ( + res : HASHED_DICTIONARY(STRING,STRING);
+      + params : ARRAY(STRING);
       res :=  HASHED_DICTIONARY(STRING,STRING).create;
       // On cherche le premier ?
       // Ensuite on split avec le &
       // Chaque morceaux est splité avec le =
 
+      // Algo pas très perf...
+      params := (param.substring  (param.substring_index ("?",1)) to (param.count - 1)).split_str "&";
+      params.foreach { e : STRING;
+        res.put (e.substring  (e.substring_index ("=",0) - 1) to (e.count-1)) to (e.substring 0 to (e.substring_index ("=",0) - 1)); 
+      };
+      res
     );
 
 
@@ -362,6 +369,8 @@ Section Public
     //
 
     
+    // Un pattern d'optim : à l'usage, le serveur recevra des requetes post et ira switcher sur le block correspondant.
+    // Au lieu d'utiliser l'infra de HASHED_DICTIONARY , peut être qu'il y aurait moyen de fire un bête switch sur le nom ?
     - add_post name : ABSTRACT_STRING action blc : {HASHED_DICTIONARY(STRING,STRING); STRING} <-
     ( 
       post_block_list.put blc to name;

-- 
Lisaac compiler



More information about the Lisaac-commits mailing list