diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 82b704f..e0f4a1c 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -1836,6 +1836,7 @@ define (String state_name) -> PreviousState($State) ) = (String state_name) |-> with file_path = state_directory+"/s"+state_name, + //println("Retreive state ["+file_path+"]"); if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d) then ( if d is (time_stamp,s) then @@ -2098,7 +2099,7 @@ define (List(Web_arg) lwa, HTTP_Info info) -> Separated_Web_Args($State) // // no web arg found => no previous state and no action // - if find_cookie("s", server_get_cookies(http_headers(info))) is + if find_cookie("state", server_get_cookies(http_headers(info))) is { failure then swa(not_found,failure,[]), success(cookie) then swa(retrieve_state(value(cookie)),failure,[]) @@ -2163,7 +2164,8 @@ define ($State previous, HTTP_Info http_info, List(Web_arg) lwa, Bool is_https, - List(Web_Action($State)) actions) |-f-> + List(Web_Action($State)) actions) |-f-> + //println("Looking for action ["+action_name+"]"); if actions is { [ ] then print("action '"+action_name+ @@ -2194,7 +2196,9 @@ define ($State previous, http_https_action(an,allow,do_it) then if an = action_name - then if allow(previous) + then + //println("Action ["+action_name+"] found"); + if allow(previous) then do_it(http_info,lwa,previous) else previous else f(previous,action_name,http_info,lwa,is_https,others), @@ -2277,7 +2281,7 @@ define List(HTTP_header) ) = [ - http_header("Set-Cookie", "s="+state_name) + http_header("Set-Cookie", "state="+state_name) ] . @@ -2361,9 +2365,9 @@ public define Web_Site // // construct tool functions // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true - with save_state = make_save_state_function(timeout,state_directory), + with save_state = make_save_state_function(timeout, state_directory), retrieve_state = make_retrieve_state_function(state_directory), - separate_web_args = make_separate_web_args_function(state_directory,retrieve_state), + separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), apply_action = make_apply_action_function(actions), // // construct the site handler @@ -2376,10 +2380,11 @@ public define Web_Site //(Printable_tree) if separate_web_args(lwa, http_info) is { - swa(mb_previous_state,mb_action_name,operands) then + 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), @@ -2400,6 +2405,7 @@ public define Web_Site }, //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); with cookie_headers = /* if using_state_cookies then */ make_state_cookie_headers(state_name) /*else [] */, format(info(host_name, http_port, https_port, site_directory, secret), state_name, @@ -4391,15 +4397,15 @@ define Printable_tree meta(meta) then [format(meta) . _format_html_head(t, so_far)], title(title) then - ["