From 8b0a26ee5218e4c0430b8bd850a3b93169030853 Mon Sep 17 00:00:00 2001 From: totoro Date: Wed, 27 Jan 2016 17:30:04 +0100 Subject: [PATCH] Start to change the behavior of the action name. Now in add of ?a= (which means action =) we defined the ?aws_action= (which means 'Anubis Web Server Action = ') the 'a=' will be deprecated in the future because 'a' can be web argument name too easily. In addition of the new name for action, there is an action which is special for not using session stored in cookie. When ...?aws_action=none this means don't restore session state for this action like action name which starting "ajax_". --- web/CXM_making_a_web_site.anubis | 96 +++++++++++++++++++++++++++++++++--------------------------------------------------------------- 1 file changed, 33 insertions(+), 63 deletions(-) diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 0772967..f392349 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -2238,6 +2238,7 @@ define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State) // // no web arg found => no previous state and no action // + //println("find_cookie(\"state_"+website_name+"\", ..."); if find_cookie("state_"+website_name, server_get_cookies(http_headers(info))) is { failure then swa(not_found,failure,[]), @@ -2263,8 +2264,10 @@ define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State) with name = if substr(n,0,4) = "amp;" then substr(n, 4, length(n) - 4) else n, if name = "a" then swa(ps1,success(value),op1) - else if name = "t" then - swa(ps1,an1,[web_arg("target",value) . op1]) + else if name = "aws_action" then + swa(ps1,success(value),op1) + //else if name = "t" then + // swa(ps1,an1,[web_arg("target",value) . op1]) else swa(ps1,an1,[web_arg(name,value) . op1]), @@ -2424,41 +2427,8 @@ define List(HTTP_header) http_header("Set-Cookie", "state_"+website_name+"="+state_name) ] . - - public define Web_Site - make_web_site_description - ( - List(String) common_names, // for example: ["www.our-business.com", - // "192.168.0.1"] - // the second one is just for testing - String site_directory, // where 'public' and other directories are - // located (should NOT end with '/') - One -> One init, - (HTTP_Info, - List(Web_arg), - Bool is_https) -> $State initial_state, - ($State expired, - HTTP_Info, - List(Web_arg), - Bool is_https) -> $State ticket_expired_state, - (HTTP_Info, - List(Web_arg), - Bool is_https) -> $State ticket_lost_state, - List(Web_Action($State)) actions, - $State -> HTTP_Answer compute_page, - $State -> List(HTTP_header) additional_headers, - Int timeout, // seconds (todo: minutes) - Redirections redirections, - String charset, - List(String) journal_extensions, - List(String) journal_headers, - String authorization_secret, - List(MIME) known_mime_types, - (String action_name, - List(Web_arg) args)-> One before_send_file - ). - + public define Web_Site make_web_site_description ( @@ -2519,31 +2489,29 @@ public define Web_Site List(Web_arg) lwa, Bool is_https) |-> //(Printable_tree) - if separate_web_args(lwa, http_info) is - { - swa(mb_previous_state, mb_action_name, operands) then - with new_state = if mb_previous_state is - { - not_found then - //println("previous state not found"); - if mb_action_name is - { - failure then initial_state(http_info, operands, is_https), - success(_) then - ticket_lost_state(mb_action_name, http_info,operands,is_https) - }, - - out_of_date(state) then - ticket_expired_state(state, mb_action_name, http_info,operands,is_https), - - still_valid(state) then - if mb_action_name is - { - failure then state, - success(action_name) then - apply_action(state,action_name,http_info,operands,is_https) - } - }, + since separate_web_args(lwa, http_info) is swa(mb_previous_state, mb_action_name, operands), + with new_state = if mb_previous_state is + { + not_found then + //println("previous state not found"); + if mb_action_name is + { + failure then initial_state(http_info, operands, is_https), + success(_) then + ticket_lost_state(mb_action_name, http_info,operands,is_https) + }, + + out_of_date(state) then + ticket_expired_state(state, mb_action_name, http_info,operands,is_https), + + still_valid(state) then + if mb_action_name is + { + failure then state, + success(action_name) then + apply_action(state,action_name,http_info,operands,is_https) + } + }, //if state_and_headers is (session_ticket, mb_new_state, headers) then with state_name = save_state(new_state), //println("Cookie new STATE NAME "+state_name); @@ -2551,7 +2519,9 @@ public define Web_Site { failure then [], success(action_name) then - if substr(action_name, 0, 5)="ajax_" then + if action_name = "none" then + [] + else if substr(action_name, 0, 5)="ajax_" then [] else make_state_cookie_headers(website_name, state_name) @@ -2563,7 +2533,7 @@ public define Web_Site compute_page(new_state), is_https, charset) - }), + ), // // make the delete_out_of_date function // -- libgit2 0.21.4