Commit c65648e5f6637f6560c3dc4f42cc21c7de9cfaf0
1 parent
d0edb4a6
add forgotten default class in to_HTML_In_Form
fix the reading of the web arg.
Showing
4 changed files
with
47 additions
and
21 deletions
Show diff stats
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 24/06/2017 | |
| 5 | + * Time: 20:28 | |
| 6 | + * © Calexium | |
| 7 | + */ | |
| 8 | + | |
| 9 | + | |
| 10 | +read calexium_lib/web/CXM_multihost_http_server.anubis | |
| 11 | +read calexium_lib/web/CXM_web_arg_utils.anubis | |
| 12 | +read calexium_lib/web/CXM_web_dump.anubis | |
| 13 | +read tools/string.anubis | |
| 14 | + | |
| 15 | +global define One | |
| 16 | + test | |
| 17 | + ( | |
| 18 | + List(String) args | |
| 19 | + ) | |
| 20 | + = | |
| 21 | + 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", | |
| 22 | + with lwa = read_www_url_encoded_web_args(body, 0), | |
| 23 | + println(dump_web_arg_values(lwa)) | |
| 24 | +. | ... | ... |
web/CXM_form.anubis
| ... | ... | @@ -744,7 +744,7 @@ public define HTML_In_Form |
| 744 | 744 | List(CXM_Form_Field) fields, |
| 745 | 745 | List(Web_arg) lwa |
| 746 | 746 | )= |
| 747 | - to_HTML_In_Form(fields, lwa, "", true) | |
| 747 | + to_HTML_In_Form(fields, lwa, "form_field aligned", true) | |
| 748 | 748 | . |
| 749 | 749 | |
| 750 | 750 | public define HTML_In_Form |
| ... | ... | @@ -753,7 +753,7 @@ public define HTML_In_Form |
| 753 | 753 | CXM_Form_Field field, |
| 754 | 754 | List(Web_arg) lwa |
| 755 | 755 | )= |
| 756 | - to_HTML_In_Form([field], lwa, "", true) | |
| 756 | + to_HTML_In_Form([field], lwa, "form_field aligned", true) | |
| 757 | 757 | . |
| 758 | 758 | |
| 759 | 759 | public define HTML_In_Form |
| ... | ... | @@ -761,7 +761,7 @@ public define HTML_In_Form |
| 761 | 761 | ( |
| 762 | 762 | List(CXM_Form_Field) fields |
| 763 | 763 | )= |
| 764 | - to_HTML_In_Form(fields, [], "", true) | |
| 764 | + to_HTML_In_Form(fields, [], "form_field aligned", true) | |
| 765 | 765 | . |
| 766 | 766 | |
| 767 | 767 | public define HTML_Off_Form | ... | ... |
web/CXM_making_a_web_site.anubis
| ... | ... | @@ -3256,8 +3256,8 @@ public define Web_Site |
| 3256 | 3256 | HTTP_Info http_info, |
| 3257 | 3257 | List(Web_arg) lwa, |
| 3258 | 3258 | Bool is_https) |-> |
| 3259 | - //(Printable_tree) | |
| 3260 | - println(dump_web_arg_values(lwa)); | |
| 3259 | + //(Printable_tree) | |
| 3260 | + //println(dump_web_arg_values(lwa)); | |
| 3261 | 3261 | since separate_web_args(lwa, http_info) is swa(mb_previous_state, mb_action_name, operands), |
| 3262 | 3262 | with new_state = if mb_previous_state is |
| 3263 | 3263 | { |
| ... | ... | @@ -3265,8 +3265,8 @@ public define Web_Site |
| 3265 | 3265 | //println("previous state not found"); |
| 3266 | 3266 | if mb_action_name is |
| 3267 | 3267 | { |
| 3268 | - failure then initial_state(http_info, operands, is_https), | |
| 3269 | - success(_) then | |
| 3268 | + failure then initial_state(http_info, operands, is_https), | |
| 3269 | + success(_) then | |
| 3270 | 3270 | ticket_lost_state(mb_action_name, http_info,operands,is_https) |
| 3271 | 3271 | }, |
| 3272 | 3272 | |
| ... | ... | @@ -3368,12 +3368,10 @@ define HTTP_Answer |
| 3368 | 3368 | |
| 3369 | 3369 | // content of page |
| 3370 | 3370 | sequence([ |
| 3371 | - preformated([size(16)], "Anubis Web Server 1.14"), | |
| 3372 | - br, | |
| 3373 | - preformated([size(16)],"Error "+to_String(http_status)), | |
| 3371 | + preformated([size(14)], "Anubis Web Server - Calexium Lib v1.00 - Anubis language v1.14"), | |
| 3372 | + preformated([size(12)],"Error "+to_String(http_status)), | |
| 3373 | + preformated([size(12)],"Internal message :"+message), | |
| 3374 | 3374 | br, |
| 3375 | - preformated([size(14)],"Internal message :"+message), | |
| 3376 | - br,br, | |
| 3377 | 3375 | in_form(html_Id(""),text_area(wan(""), init(dump(_session)), 120, 60)) |
| 3378 | 3376 | ]) |
| 3379 | 3377 | ) | ... | ... |
web/CXM_multihost_http_server.anubis
| ... | ... | @@ -1529,11 +1529,11 @@ define (String,String) |
| 1529 | 1529 | Furthermore, web arguments must be translated from web to ASCII when www-url encoded. |
| 1530 | 1530 | |
| 1531 | 1531 | define Bool |
| 1532 | - is_ampersand_or_equal | |
| 1533 | - ( | |
| 1534 | - Word8 c | |
| 1535 | - ) = | |
| 1536 | - if c = '&' then true else c = '='. | |
| 1532 | + is_ampersand_or_equal | |
| 1533 | + ( | |
| 1534 | + Word8 c | |
| 1535 | + ) = | |
| 1536 | + if c = '&' then true else c = '='. | |
| 1537 | 1537 | |
| 1538 | 1538 | |
| 1539 | 1539 | |
| ... | ... | @@ -1559,7 +1559,7 @@ define String |
| 1559 | 1559 | . |
| 1560 | 1560 | |
| 1561 | 1561 | |
| 1562 | -define List(Web_arg) | |
| 1562 | +public define List(Web_arg) | |
| 1563 | 1563 | read_www_url_encoded_web_args |
| 1564 | 1564 | ( |
| 1565 | 1565 | String s, //url_encoded string |
| ... | ... | @@ -1573,18 +1573,22 @@ define List(Web_arg) |
| 1573 | 1573 | with i = start + length(first), //jump to end of first word |
| 1574 | 1574 | if nth(i,s) is |
| 1575 | 1575 | { |
| 1576 | - failure then [web_arg(name, "")], | |
| 1576 | + failure then | |
| 1577 | + //println("failure name=["+name+"]"); | |
| 1578 | + [web_arg(name, "")], | |
| 1577 | 1579 | success(c) then |
| 1578 | 1580 | if c = '&' then |
| 1581 | + //println("& alone name=["+name+"]"); | |
| 1579 | 1582 | [web_arg(name, "") . read_www_url_encoded_web_args(s,i+1)] |
| 1580 | 1583 | else if c = '=' then |
| 1581 | 1584 | with second = read_name_or_value(s, i+1, i+1), |
| 1582 | - // print("\""+second1+"\"\n"); | |
| 1585 | + //print("\""+second+"\"\n"); | |
| 1583 | 1586 | with value = web_to_ascii(second, 0, []), |
| 1584 | 1587 | //println("first ["+first+"] => name ["+name+"] second ["+second+"] => value ["+value+"]"); |
| 1588 | + //println("name ["+name+"] => value ["+value+"]"); | |
| 1585 | 1589 | //here check the name starting with amp; which means it was "&" encoded and it must be removed |
| 1586 | 1590 | with _name = if substr(name, 0, 4) = "amp;" then substr(name, 4, length(name) - 4) else name, |
| 1587 | - [web_arg(_name, value) . read_www_url_encoded_web_args(s, i+length(value)+2)] | |
| 1591 | + [web_arg(_name, value) . read_www_url_encoded_web_args(s, i+length(second)+2)] | |
| 1588 | 1592 | else |
| 1589 | 1593 | print("**** ALERT **** badly formatted argument [" + s + "]!!!\n"); |
| 1590 | 1594 | [] | ... | ... |