From c65648e5f6637f6560c3dc4f42cc21c7de9cfaf0 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 24 Jun 2017 21:09:20 +0200 Subject: [PATCH] add forgotten default class in to_HTML_In_Form fix the reading of the web arg. --- unit_test/test.anubis | 24 ++++++++++++++++++++++++ web/CXM_form.anubis | 6 +++--- web/CXM_making_a_web_site.anubis | 16 +++++++--------- web/CXM_multihost_http_server.anubis | 22 +++++++++++++--------- 4 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 unit_test/test.anubis diff --git a/unit_test/test.anubis b/unit_test/test.anubis new file mode 100644 index 0000000..75488ff --- /dev/null +++ b/unit_test/test.anubis @@ -0,0 +1,24 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ aka (David RENÉ) + * Date: 24/06/2017 + * Time: 20:28 + * © Calexium + */ + + +read calexium_lib/web/CXM_multihost_http_server.anubis +read calexium_lib/web/CXM_web_arg_utils.anubis +read calexium_lib/web/CXM_web_dump.anubis +read tools/string.anubis + +global define One + test + ( + List(String) args + ) + = + with body = "%7ERDNS_CHECK=%7Etrue&RDNS_CHECK=true&%7EUSE_GREYLISTING=%7Etrue&USE_GREYLISTING=true&MINIMUM_DELAY=120&MAXIMUM_DELAY=86400&%7ESPF_CHECK=%7Etrue&SPF_CHECK=true", + with lwa = read_www_url_encoded_web_args(body, 0), + println(dump_web_arg_values(lwa)) +. diff --git a/web/CXM_form.anubis b/web/CXM_form.anubis index ce08a55..a0896a9 100644 --- a/web/CXM_form.anubis +++ b/web/CXM_form.anubis @@ -744,7 +744,7 @@ public define HTML_In_Form List(CXM_Form_Field) fields, List(Web_arg) lwa )= - to_HTML_In_Form(fields, lwa, "", true) + to_HTML_In_Form(fields, lwa, "form_field aligned", true) . public define HTML_In_Form @@ -753,7 +753,7 @@ public define HTML_In_Form CXM_Form_Field field, List(Web_arg) lwa )= - to_HTML_In_Form([field], lwa, "", true) + to_HTML_In_Form([field], lwa, "form_field aligned", true) . public define HTML_In_Form @@ -761,7 +761,7 @@ public define HTML_In_Form ( List(CXM_Form_Field) fields )= - to_HTML_In_Form(fields, [], "", true) + to_HTML_In_Form(fields, [], "form_field aligned", true) . public define HTML_Off_Form diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 1e15609..43d457f 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -3256,8 +3256,8 @@ public define Web_Site HTTP_Info http_info, List(Web_arg) lwa, Bool is_https) |-> - //(Printable_tree) - println(dump_web_arg_values(lwa)); + //(Printable_tree) + //println(dump_web_arg_values(lwa)); since separate_web_args(lwa, http_info) is swa(mb_previous_state, mb_action_name, operands), with new_state = if mb_previous_state is { @@ -3265,8 +3265,8 @@ public define Web_Site //println("previous state not found"); if mb_action_name is { - failure then initial_state(http_info, operands, is_https), - success(_) then + failure then initial_state(http_info, operands, is_https), + success(_) then ticket_lost_state(mb_action_name, http_info,operands,is_https) }, @@ -3368,12 +3368,10 @@ define HTTP_Answer // content of page sequence([ - preformated([size(16)], "Anubis Web Server 1.14"), - br, - preformated([size(16)],"Error "+to_String(http_status)), + preformated([size(14)], "Anubis Web Server - Calexium Lib v1.00 - Anubis language v1.14"), + preformated([size(12)],"Error "+to_String(http_status)), + preformated([size(12)],"Internal message :"+message), br, - preformated([size(14)],"Internal message :"+message), - br,br, in_form(html_Id(""),text_area(wan(""), init(dump(_session)), 120, 60)) ]) ) diff --git a/web/CXM_multihost_http_server.anubis b/web/CXM_multihost_http_server.anubis index 5cb71b0..113a57a 100644 --- a/web/CXM_multihost_http_server.anubis +++ b/web/CXM_multihost_http_server.anubis @@ -1529,11 +1529,11 @@ define (String,String) Furthermore, web arguments must be translated from web to ASCII when www-url encoded. define Bool - is_ampersand_or_equal - ( - Word8 c - ) = - if c = '&' then true else c = '='. + is_ampersand_or_equal + ( + Word8 c + ) = + if c = '&' then true else c = '='. @@ -1559,7 +1559,7 @@ define String . -define List(Web_arg) +public define List(Web_arg) read_www_url_encoded_web_args ( String s, //url_encoded string @@ -1573,18 +1573,22 @@ define List(Web_arg) with i = start + length(first), //jump to end of first word if nth(i,s) is { - failure then [web_arg(name, "")], + failure then + //println("failure name=["+name+"]"); + [web_arg(name, "")], success(c) then if c = '&' then + //println("& alone name=["+name+"]"); [web_arg(name, "") . read_www_url_encoded_web_args(s,i+1)] else if c = '=' then with second = read_name_or_value(s, i+1, i+1), - // print("\""+second1+"\"\n"); + //print("\""+second+"\"\n"); with value = web_to_ascii(second, 0, []), //println("first ["+first+"] => name ["+name+"] second ["+second+"] => value ["+value+"]"); + //println("name ["+name+"] => value ["+value+"]"); //here check the name starting with amp; which means it was "&" encoded and it must be removed with _name = if substr(name, 0, 4) = "amp;" then substr(name, 4, length(name) - 4) else name, - [web_arg(_name, value) . read_www_url_encoded_web_args(s, i+length(value)+2)] + [web_arg(_name, value) . read_www_url_encoded_web_args(s, i+length(second)+2)] else print("**** ALERT **** badly formatted argument [" + s + "]!!!\n"); [] -- libgit2 0.21.4