text stringlengths 12 786k |
|---|
let section = Lwt_log . Section . make " eliom : admin " |
let iter_persistent_sessions f = ) * |
let close_all_service_states2 full_st_name sitedata = Eliom_common . SessionCookies . fold ( fun _ { Eliom_common . Service_cookie . full_state_name ; timeout ; session_group_node } thr -> let % lwt ( ) = thr in if full_st_name = full_state_name && ! timeout = Eliom_common . TGlobal the... |
let close_all_service_states ~ scope ~ secure sitedata = let full_st_name = Eliom_common . make_full_state_name2 sitedata . Eliom_common . site_dir_string secure ~ scope in close_all_service_states2 full_st_name sitedata |
let close_all_data_states2 full_st_name sitedata = Eliom_common . SessionCookies . fold ( fun _ { Eliom_common . Data_cookie . full_state_name ; timeout ; session_group_node } thr -> thr >>= fun ( ) -> if full_st_name = full_state_name && ! timeout = Eliom_common . TGlobal then Eliommod... |
let close_all_data_states ~ scope ~ secure sitedata = let full_st_name = Eliom_common . make_full_state_name2 sitedata . Eliom_common . site_dir_string secure ~ scope in close_all_data_states2 full_st_name sitedata |
let close_all_persistent_states2 full_st_name sitedata = Eliommod_cookies . Persistent_cookies . Cookies . iter ( fun k { Eliommod_cookies . full_state_name ; timeout = old_t ; session_group } -> let scope = full_state_name . Eliom_common . user_scope in if full_st_name = full_state_name && ... |
let close_all_persistent_states ~ scope ~ secure sitedata = let full_st_name = Eliom_common . make_full_state_name2 sitedata . Eliom_common . site_dir_string secure ~ scope in close_all_persistent_states2 full_st_name sitedata |
let update_serv_exp full_st_name sitedata old_glob_timeout new_glob_timeout = Lwt_log . ign_notice ~ section " Updating expiration date for all service sessions " ; match new_glob_timeout with | Some t when t <= 0 . -> close_all_service_states2 full_st_name sitedata | _ -> let now = Unix . time ( ... |
let update_data_exp full_st_name sitedata old_glob_timeout new_glob_timeout = Lwt_log . ign_notice ~ section " Updating expiration date for all data sessions " ; match new_glob_timeout with | Some t when t <= 0 . -> close_all_data_states2 full_st_name sitedata | _ -> let now = Unix . time ( ) ... |
let update_pers_exp full_st_name sitedata old_glob_timeout new_glob_timeout = Lwt_log . ign_notice ~ section " Updating expiration date for all persistent sessions " ; match new_glob_timeout with | Some t when t <= 0 . -> close_all_persistent_states2 full_st_name sitedata | _ -> let now = Unix . t... |
let iter_service_cookies f = let sitedata = Eliom_request_info . find_sitedata " Eliommod_sessexpl . iter_service_cookies " in Eliom_common . SessionCookies . fold ( fun k v thr -> thr >>= fun ( ) -> f ( k , v ) >>= Lwt . pause ) sitedata . Eliom_common . session_services return_un... |
let iter_data_cookies f = let sitedata = Eliom_request_info . find_sitedata " Eliommod_sessexpl . iter_data_cookies " in Eliom_common . SessionCookies . fold ( fun k v thr -> thr >>= fun ( ) -> f ( k , v ) >>= Lwt . pause ) sitedata . Eliom_common . session_data return_unit |
let iter_persistent_cookies f = Eliommod_cookies . Persistent_cookies . Cookies . iter ( fun k v -> f ( k , v ) >>= Lwt . pause ) |
let fold_service_cookies f beg = let sitedata = Eliom_request_info . find_sitedata " Eliommod_sessexpl . fold_service_cookies " in Eliom_common . SessionCookies . fold ( fun k v thr -> thr >>= fun res1 -> f ( k , v ) res1 >>= fun res -> Lwt . pause ( ) >>= fun ( ) -> return res ) ... |
let fold_data_cookies f beg = let sitedata = Eliom_request_info . find_sitedata " Eliommod_sessexpl . fold_data_cookies " in Eliom_common . SessionCookies . fold ( fun k v thr -> thr >>= fun res1 -> f ( k , v ) res1 >>= fun res -> Lwt . pause ( ) >>= fun ( ) -> return res ) site... |
let fold_persistent_cookies f beg = Eliommod_cookies . Persistent_cookies . Cookies . fold ( fun k v beg -> f ( k , v ) beg >>= fun res -> Lwt . pause ( ) >>= fun ( ) -> return res ) beg |
let number_of_service_cookies ( ) = Eliom_common . SessionCookies . length ( Eliom_request_info . get_sitedata ( ) ) . Eliom_common . session_services |
let number_of_data_cookies ( ) = Eliom_common . SessionCookies . length ( Eliom_request_info . get_sitedata ( ) ) . Eliom_common . session_data |
let number_of_tables ( ) = List . length ! Eliommod_datasess . counttableelements |
let number_of_table_elements ( ) = List . map ( fun f -> f ( ) ) ! Eliommod_datasess . counttableelements |
let number_of_persistent_cookies ( ) = Eliommod_cookies . Persistent_cookies . Cookies . length ( ) |
let make_full_named_group_name_ ~ cookie_level sitedata g = sitedata . Eliom_common . site_dir_string , cookie_level , Left g |
let make_full_group_name ~ cookie_level ri site_dir_string ipv4mask ipv6mask = function | None -> ( site_dir_string , cookie_level , Right ( Eliom_common . network_of_ip ( Ocsigen_request . remote_ip_parsed ri ) ipv4mask ipv6mask ) ) | Some g -> site_dir_string , cookie_level , Left g |
let getsessgrp a = a |
module type MEMTAB = sig type group_of_group_data val add : ? set_max : int -> Eliom_common . sitedata -> string -> Eliom_common . cookie_level Eliom_common . sessgrp -> string Ocsigen_cache . Dlist . node val remove : ' a Ocsigen_cache . Dlist . node -> unit val remove_group : Eliom_common .... |
module GroupTable = Hashtbl . Make ( struct type t = Eliom_common . cookie_level Eliom_common . sessgrp let equal = ( = ) let hash = Hashtbl . hash end ) |
module Make ( A : sig type group_of_group_data val table : ( group_of_group_data option * string Ocsigen_cache . Dlist . t ) GroupTable . t val close_session : Eliom_common . sitedata -> string -> unit val max_tab_per_session : Eliom_common . sitedata -> int val max_session_per_group : Eliom_co... |
module Data = Make ( struct type group_of_group_data = [ ` Session ] Eliom_common . sessgrp Ocsigen_cache . Dlist . node let table : ( group_of_group_data option * string Ocsigen_cache . Dlist . t ) GroupTable . t = GroupTable . create 100 let close_session sitedata sess_id = Eliom_comm... |
module Serv = Make ( struct type group_of_group_data = Eliom_common . tables ref * [ ` Session ] Eliom_common . sessgrp Ocsigen_cache . Dlist . node let table : ( group_of_group_data option * string Ocsigen_cache . Dlist . t ) GroupTable . t = GroupTable . create 100 let close_session... |
type nbmax = Val of int | Default | Nolimit |
let cut n l = let rec aux n = function | [ ] -> [ ] , [ ] | l when n <= 1 -> [ ] , l | a :: l -> let l1 , l2 = aux ( n - 1 ) l in a :: l1 , l2 in match n with None -> l , [ ] | Some n -> aux n l |
module Pers = struct module Ocsipersist = Eliom_common . Ocsipersist . Polymorphic let grouptable : ( nbmax * string list ) Ocsipersist . table Lwt . t Lazy . t = lazy ( Ocsipersist . open_table " __eliom_session_group_table " ) let find g = match g with | None -> Lwt . return_nil | ... |
type kind = [ ` Service | ` Data | ` Persistent ] |
let default_timeouts : ( kind * Eliom_common . cookie_level * Eliom_common . scope_hierarchy option , float ) Hashtbl . t = let t = Hashtbl . create 9 in Hashtbl . add t ( ` Service , ` Session , None ) 3600 . ; Hashtbl . add t ( ` Data , ` Session , None ) 3600 . ... |
let set_default ? scope_hierarchy kind level = function | Some t -> Hashtbl . replace default_timeouts ( ( kind :> kind ) , ( level :> Eliom_common . cookie_level ) , scope_hierarchy ) t | None -> Hashtbl . remove default_timeouts ( ( kind :> kind ) , ( level :> Eliom_common . ... |
let get_default kind user_scope = let level = Eliom_common . cookie_level_of_user_scope user_scope and scope_hierarchy = Eliom_common . scope_hierarchy_of_user_scope user_scope in try Some ( Hashtbl . find default_timeouts ( ( kind :> kind ) , ( level :> Eliom_common . cookie_level ) , Some... |
let set_timeout_ get set get_default update ? full_st_name ? cookie_level ~ recompute_expdates override_configfile fromconfigfile sitedata t = let def_bro , def_tab , tl = get sitedata in match full_st_name with | None -> ( match def_bro , def_tab , cookie_level with | Some ( _ , true ) , _ ... |
let sitedata_timeout kind sitedata = match kind with | ` Service -> sitedata . Eliom_common . servtimeout | ` Data -> sitedata . Eliom_common . datatimeout | ` Persistent -> sitedata . Eliom_common . perstimeout |
let set_sitedata_timeout kind sitedata v = match kind with | ` Service -> sitedata . Eliom_common . servtimeout <- v | ` Data -> sitedata . Eliom_common . datatimeout <- v | ` Persistent -> sitedata . Eliom_common . perstimeout <- v |
let find_global kind full_st_name sitedata = let def_bro , def_tab , tl = sitedata_timeout kind sitedata in try fst ( List . assoc full_st_name tl ) with Not_found -> ( match def_bro , def_tab , full_st_name . Eliom_common . user_scope with | Some ( t , _ ) , _ , ` Session _ -> t... |
let set_global_ ? full_st_name ? cookie_level ~ kind ~ recompute_expdates a = set_timeout_ ( sitedata_timeout kind ) ( set_sitedata_timeout kind ) ( get_default kind ) Eliommod_sessadmin . update_serv_exp ? full_st_name ? cookie_level ~ recompute_expdates a |
let get_global ~ kind ~ cookie_scope ~ secure sitedata = let full_st_name = Eliom_common . make_full_state_name2 sitedata . Eliom_common . site_dir_string secure ~ scope : cookie_scope in find_global kind full_st_name sitedata |
let set_global ~ kind ~ cookie_scope ~ secure ~ recompute_expdates override_configfile sitedata timeout = let full_st_name = Eliom_common . make_full_state_name2 sitedata . Eliom_common . site_dir_string secure ~ scope : cookie_scope in set_global_ ~ kind ~ full_st_name ~ recompute_expdates override_co... |
let set_default_global kind cookie_level override_configfile fromconfigfile sitedata timeout = set_global_ ~ kind ~ cookie_level ~ recompute_expdates : false override_configfile fromconfigfile sitedata timeout |
let kind : [ ` Server | ` Client ] ref = ref ` Server |
let usage ( ) = Printf . eprintf " Usage : % s - server < files >\ n " ( Filename . basename Sys . argv . ( 0 ) ) ; Printf . eprintf " Usage : % s - client < files >\ n " ( Filename . basename Sys . argv . ( 0 ) ) ; exit 1 |
let debug = ref false |
let process_kind ( ) = if Array . length Sys . argv < 2 then usage ( ) ; match Sys . argv . ( 1 ) with | " - server " -> ` Server | " - client " -> ` Client | _ -> usage ( ) |
let print_debug lexbuf = let print_token = printf " %%% s :% s %%\ n " in let print_token_c = printf " %%% s :% c %%\ n " in match Eliompp_lexer . token lexbuf with | Eliompp_lexer . RAW s -> print_token " RAW " s | Eliompp_lexer . CHAR c -> print_token_c " CHAR " c | Eliompp_lexer .... |
let pretty_print_header filename = let print = printf " # % d " \% s " \\ n " in print 1 filename ; print 1 " < command - line " ; > print 1 filename |
let current_section ( ) = ! Eliompp_lexer . section_idt |
let we_are_ppx ( ) = ! Eliompp_lexer . we_are_ppx |
let for_server ( ) = match current_section ( ) with ` Server | ` Shared -> true | ` Client -> false |
let for_client ( ) = match current_section ( ) with ` Client | ` Shared -> true | ` Server -> false |
let pretty_print filename lexbuf = ( if ! kind = ` Client then match Eliompp_lexer . token lexbuf with | Eliompp_lexer . RAW s -> if we_are_ppx ( ) && for_client ( ) then printf " % s " s | Eliompp_lexer . CHAR c -> if we_are_ppx ( ) && for_client ( ) then printf " % c " c ... |
let preprocess filename = try let file = open_in filename in let lexbuf = Lexing . from_channel file in pretty_print_header filename ; while true do if ! debug then print_debug lexbuf else pretty_print filename lexbuf done with | End_of_file -> ( ) | Parsing . Parse_error -> Printf . eprintf " [ ... |
let process ( ) = kind := process_kind ( ) ; let i = ref 2 in while ! i < Array . length Sys . argv do ( match Sys . argv . ( ! i ) with | " - debug " -> debug := true | _ as filename -> preprocess filename ) ; incr i done |
let ( ) = process ( ) |
let section = Lwt_log . Section . make " eliom : bus " |
type ( ' a , ' b ) t = { channel : ' b Ecb . wrapped_channel ; stream : ' b Lwt_stream . t Lazy . t ; queue : ' a Queue . t ; mutable max_size : int ; write : ' a list -> unit Lwt . t ; mutable waiter : unit -> unit Lwt . t ; mutable last_wait : unit Lwt . t ; m... |
let consume ( t , u ) s = let t ' = try % lwt Lwt_stream . iter ( fun _ -> ( ) ) s with e -> ( match Lwt . state t with Lwt . Sleep -> Lwt . wakeup_exn u e | _ -> ( ) ) ; Lwt . fail e in Lwt . choose [ Lwt . bind t ( fun _ -> Lwt . return_unit ) ; t ' ] |
let clone_exn ( t , u ) s = let s ' = Lwt_stream . clone s in Lwt_stream . from ( fun ( ) -> try % lwt Lwt . choose [ Lwt_stream . get s ' ; t ] with e -> ( match Lwt . state t with Lwt . Sleep -> Lwt . wakeup_exn u e | _ -> ( ) ) ; Lwt . fail e ) |
type ( ' a , ' att , ' co , ' ext , ' reg ) callable_bus_service = ( unit , ' a list , Eliom_service . post , ' att , ' co , ' ext , ' reg , [ ` WithoutSuffix ] , unit , [ ` One of ' a list Eliom_parameter . ocaml ] Eliom_parameter . param_name , ... |
let create service channel waiter = let write x = try % lwt let % lwt _ = Eliom_client . call_service ~ service ( : service :> ( ' a , _ , _ , _ , _ ) callable_bus_service ) ( ) x in Lwt . return_unit with Eliom_request . Failed_request 204 -> Lwt . return_unit in let error_... |
let internal_unwrap ( ( wrapped_bus : ( ' a , ' b ) Ecb . wrapped_bus ) , _unwrapper ) = let waiter ( ) = Js_of_ocaml_lwt . Lwt_js . sleep 0 . 05 in let channel , Eliom_comet_base . Bus_send_service service = wrapped_bus in create service channel waiter |
let ( ) = Eliom_unwrap . register_unwrapper Eliom_common . bus_unwrap_id internal_unwrap |
let stream t = clone_exn t . error_h ( Lazy . force t . stream ) |
let original_stream t = if Eliom_client_core . in_onload ( ) && t . original_stream_available then stream t else Lwt_log . raise_error ~ section " original_stream : the original stream is not available anymore " |
let flush t = let l = List . rev ( Queue . fold ( fun l v -> v :: l ) [ ] t . queue ) in Queue . clear t . queue ; t . write l |
let try_flush t = Lwt . cancel t . last_wait ; if Queue . length t . queue >= t . max_size then flush t else let th = Lwt . protected ( t . waiter ( ) ) in t . last_wait <- th ; let _ = th >>= fun ( ) -> flush t in Lwt . return_unit |
let write t v = Queue . add v t . queue ; try_flush t |
let close { channel } = Eliom_comet . close channel |
let set_queue_size b s = b . max_size <- s |
let set_time_before_flush b t = b . waiter <- ( if t <= 0 . then Lwt . pause else fun ( ) -> Js_of_ocaml_lwt . Lwt_js . sleep t ) |
type ( ' a , ' b ) t = { stream : ' b Lwt_stream . t ; scope : Eliom_comet . Channel . comet_scope ; name : string option ; channel : ' b Eliom_comet . Channel . t option ; write : ' a -> unit Lwt . t ; service : ' a Ecb . bus_send_service ; service_registered : bo... |
let register_sender scope service write = Eliom_registration . Action . register ~ scope ~ options ` : NoReload ~ service ( fun ( ) x -> Lwt_list . iter_s write x ) |
let internal_wrap ( bus : ( ' a , ' b ) t ) : ( ' a , ' b ) Ecb . wrapped_bus * Eliom_common . unwrapper = let channel = match bus . channel with | None -> Eliom_comet . Channel . create ~ scope : bus . scope ? name : bus . name ? size : bus . size ( Lwt_stream . ... |
let bus_mark ( ) = Eliom_common . make_wrapper internal_wrap |
let deriving_to_list : ' a Deriving_Json . t -> ' a list Deriving_Json . t = fun ( type typ ) typ -> let ( typ_list : typ list Deriving_Json . t ) = let module M = Deriving_Json . Json_list ( Deriving_Json . Defaults ' ' ( struct type a = typ let t = typ end ) ) in M . t in ... |
let create_filtered ? scope ? name ? size ~ filter typ = let stream , push = Lwt_stream . create ( ) in let push x = let % lwt y = filter x in push ( Some y ) ; Lwt . return_unit in let scope = match scope with | None | Some ` Site -> ` Site | Some ( ` Client_process n ) -> ` ... |
let create ? scope ? name ? size typ = create_filtered ~ filter : Lwt . return ? scope ? name ? size typ |
let stream bus = match bus . scope with ` Site -> bus . stream | ` Client_process _ -> bus . stream |
let write bus x = bus . write x |
let run_callbacks handlers = List . iter ( fun f -> f ( ) ) handlers |
type changepage_event = { in_cache : bool ; origin_uri : string ; target_uri : string ; origin_id : int ; target_id : int option } |
let run_lwt_callbacks : ' a -> ( ' a -> unit Lwt . t ) list -> unit Lwt . t = fun ev handlers -> Lwt_list . iter_s ( fun h -> h ev ) handlers |
let ( onload , _ , flush_onload , _push_onload ) : ( ( unit -> unit ) -> unit ) * ( unit -> ( unit -> unit ) list ) * ( unit -> ( unit -> unit ) list ) * ( unit -> unit ) = Eliom_client_core . create_buffer ( ) |
let ( ( onchangepage : ( changepage_event -> unit Lwt . t ) -> unit ) , _ , ( flush_onchangepage : unit -> ( changepage_event -> unit Lwt . t ) list ) , _ ) = Eliom_client_core . create_buffer ( ) |
let onunload , _ , flush_onunload , _ = Eliom_client_core . create_buffer ( ) |
let onbeforeunload , run_onbeforeunload , flush_onbeforeunload = let add , get , flush , _ = Eliom_client_core . create_buffer ( ) in let rec run lst = match lst with | [ ] -> None | f :: rem -> ( match f ( ) with None -> run rem | Some s -> Some s ) in add , ( fun ( ) -... |
let run_onunload_wrapper set_content cancel = match run_onbeforeunload ( ) with | Some s when not ( confirm " % s " s ) -> cancel ( ) | _ -> ignore ( flush_onbeforeunload ( ) ) ; run_callbacks ( flush_onunload ( ) ) ; set_content ( ) |
let lwt_onload ( ) = let t , u = Lwt . wait ( ) in onload ( Lwt . wakeup u ) ; t |
let check_global_data global_data = let missing_client_values = ref [ ] in let missing_injections = ref [ ] in String_map . iter ( fun compilation_unit_id { Eliom_client_core . server_section ; client_section } -> List . iter ( fun data -> missing_client_values := List . rev_append ( L... |
let do_request_data request_data = Lwt_log . ign_debug_f ~ section " Do request data ( % a ) " ( fun ( ) l -> string_of_int ( Array . length l ) ) request_data ; check_global_data ! Eliom_client_core . global_data ; Eliom_client_core . global_data := String_map . empty ; Array ... |
let get_element_cookies_info elt = Js . Opt . to_option ( Js . Opt . map elt ## ( getAttribute ( Js . string Eliom_runtime . RawXML . ce_call_service_attrib ) ) ( fun s -> of_json ( Js . to_string s ) ) ) |
let get_element_template elt = Js . Opt . to_option ( Js . Opt . map elt ## ( getAttribute ( Js . string Eliom_runtime . RawXML . ce_template_attrib ) ) ( fun s -> Js . to_string s ) ) |
let a_handler = Dom_html . full_handler ( fun node ev -> let node = Js . Opt . get ( Dom_html . CoerceTo . a node ) ( fun ( ) -> Lwt_log . raise_error_f ~ section " not an anchor element " ) in Js . bool ( Eliom_client_core . raw_a_handler node ( get_element_cookies_info node ... |
let form_handler : ( Dom_html . element Js . t , # Dom_html . event Js . t ) Dom_html . event_listener = Dom_html . full_handler ( fun node ev -> let form = Js . Opt . get ( Dom_html . CoerceTo . form node ) ( fun ( ) -> Lwt_log . raise_error_f ~ section " not a form ele... |
let relink_process_node ( node : Dom_html . element Js . t ) = let id = Js . Opt . get node ## ( getAttribute ( Js . string Eliom_runtime . RawXML . node_id_attrib ) ) ( fun ( ) -> Lwt_log . raise_error_f ~ section " unique node without id attribute " ) in Js . Optdef . ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.