text stringlengths 12 786k |
|---|
module Html = struct module F = struct include Html . F module Arg = struct include Html . F module Svg = Eliom_content_core . Svg . F let uri_of_fun = Eliom_content_core . Xml . uri_of_fun let attrib_of_service s info = Eliom_content_core . ( Html . F . to_attrib ( Xml . internal_event_ha... |
module Xml = struct include Eliom_runtime . RawXML module W = Xml_wrap . NoWrap type ' a wrap = ' a type ' a list_wrap = ' a list type econtent = | Empty | Comment of string | EncodedPCDATA of string | PCDATA of string | Entity of string | Leaf of ename * attrib list | Node of ename * attrib l... |
module Xml_wed = struct module W = Js_of_ocaml_tyxml . Tyxml_js . Wrap type ' a wrap = ' a W . t type ' a list_wrap = ' a W . tlist type uri = Xml . uri let string_of_uri = Xml . string_of_uri let uri_of_string = Xml . uri_of_string type aname = Xml . aname type event_handler = Xml . ... |
module Svg = struct module D = struct module Raw = Svg_f . Make ( struct include Xml let make elt = make_request_node ( make elt ) let empty ( ) = make Empty let comment c = make ( Comment c ) let pcdata d = make ( PCDATA d ) let encodedpcdata d = make ( EncodedPCDATA d ) let entity e =... |
module Html = struct module D = struct module Xml ' = struct include Xml let make elt = make_request_node ( make elt ) let empty ( ) = make Empty let comment c = make ( Comment c ) let pcdata d = make ( PCDATA d ) let encodedpcdata d = make ( EncodedPCDATA d ) let entity e = make ( Enti... |
module Xml = struct include Eliom_runtime . RawXML module W = Xml_wrap . NoWrap type ' a wrap = ' a type ' a list_wrap = ' a list type econtent = | Empty | Comment of string | EncodedPCDATA of string | PCDATA of string | Entity of string | Leaf of ename * attrib list | Node of ename * attrib l... |
module Svg = struct module D = struct module Xml ' = struct include Xml let make elt = make_request_node ( make elt ) let empty ( ) = make Empty let comment c = make ( Comment c ) let pcdata d = make ( PCDATA d ) let encodedpcdata d = make ( EncodedPCDATA d ) let entity e = make ( Entit... |
module Html = struct module D = struct module Xml ' = struct include Xml let make elt = make_request_node ( make elt ) let make_lazy elt = make_request_node ( make_lazy elt ) let empty ( ) = make Empty let comment c = make ( Comment c ) let pcdata d = make ( PCDATA d ) let encodedpcdata d ... |
let page_error_param_type l = let s = match l with | [ ] -> [ txt " Wrong type for parameter " ] | [ ( n , _ ) ] -> [ txt " Wrong type for parameter " ; em [ txt n ] ; txt " . " ] | ( n , _ ) :: ll -> txt " Wrong type for parameters " :: List . fold_le... |
let page_bad_param after_action gl pl = let s = " Wrong parameters " in html ( head ( title ( txt s ) ) [ ] ) ( body ( h1 [ txt s ] :: ( if Ocsigen_config . get_debugmode ( ) then [ h2 [ txt " Debugging information " ] : ; ( if after_action then p [ txt " An act... |
let page_session_expired = let s = " Session expired " in html ( head ( title ( txt s ) ) [ ] ) ( body [ h1 [ txt s ] ] ) |
Eliom_lib_base : module type of Eliom_lib_base with type ' a Int64_map . t = ' a Eliom_lib_base . Int64_map . t with type ' a String_map . t = ' a Eliom_lib_base . String_map . t with type ' a Int_map . t = ' a Eliom_lib_base . Int_map . t ) |
module Url = struct include Url include Url_base let decode = Url . urldecode let encode ? plus s = Url . urlencode ? with_plus : plus s let make_encoded_parameters = Url . encode_arguments let split_path = Url . path_of_path_string let ssl_re = Regexp . regexp " ( ^ https ) " ?:\\/\\/ let ... |
module Lwt_log = struct include Lwt_log_js let raise_error ? inspect ? exn ? section ? location ? logger msg = Lwt . ignore_result ( log ? inspect ? exn ? section ? location ? logger ~ level : Error msg ) ; match exn with Some exn -> raise exn | None -> failwith msg let raise_error_f ? inspect... |
let _ = Lwt_log . default := Lwt_log . console ; Lwt . async_exception_hook := fun exn -> Firebug . console ## error_3 ( Js . string " Lwt . async " ) : ( Js . string ( Printexc . to_string exn ) ) exn |
let debug_exn fmt exn = Lwt_log . ign_info_f ~ exn fmt |
let debug fmt = Lwt_log . ign_info_f fmt |
let error fmt = Lwt_log . raise_error_f fmt |
let error_any any fmt = Lwt_log . raise_error_f ~ inspect : any fmt |
let jsdebug a = Lwt_log . ign_info ~ inspect : a " Jsdebug " |
let trace fmt = if Eliom_config . get_tracing ( ) then Lwt_log . ign_info_f ( " >> " ^^ fmt ) else Printf . ksprintf ignore fmt |
let lwt_ignore ( ? message = " " ) t = Lwt . on_failure t ( fun exn -> Lwt_log . ign_info_f ~ exn " % s " message ) |
let jsalert a = Dom_html . window ## ( alert a ) |
let alert fmt = Printf . ksprintf ( fun s -> jsalert ( Js . string s ) ) fmt |
let confirm = let f s = let s = Js . string s in Dom_html . window ## ( confirm s ) |> Js . to_bool in fun fmt -> Printf . ksprintf f fmt |
let debug_var s v = Js . Unsafe . set Dom_html . window ( Js . string s ) v |
module String = struct include String_base let eol_re = Regexp . regexp " [ \ r \ n ] " let remove_eols s = Regexp . global_replace eol_re s " " end |
let to_json ? typ : _ s = Js . to_string ( Json . output s ) |
let of_json ? typ : _ v = Json . unsafe_input ( Js . string v ) |
let encode_form_value x = to_json x ) * |
let encode_header_value x = String . remove_eols ( to_json x ) |
let unmarshal_js var = Marshal . from_string ( Js . to_bytestring var ) 0 |
type file_info = File . file Js . t |
let make_cryptographic_safe_string ? len : _ ( ) = failwith " make_cryptographic_safe_string not implemented client - side " |
Eliom_lib_base : module type of Eliom_lib_base with type ' a Int64_map . t = ' a Eliom_lib_base . Int64_map . t with type ' a String_map . t = ' a Eliom_lib_base . String_map . t with type ' a Int_map . t = ' a Eliom_lib_base . Int_map . t ) |
let debug f = Printf . ksprintf ( fun s -> Printf . eprintf " % s \ n " %! s ) f |
let to_json ? typ v = match typ with | Some typ -> Deriving_Json . to_string typ v | None -> assert false |
let of_json ? typ s = match typ with | Some typ -> Deriving_Json . from_string typ s | None -> assert false |
module Lwt_log = struct include Lwt_log let eliom = Section . make " eliom " end |
let b = Buffer . create ( 16 * 1024 ) |
let string_escape s = let l = String . length s in Buffer . clear b ; let conv = " 0123456789abcdef " in for i = 0 to l - 1 do let c = s . [ i ] in match c with | ' \ 000 ' when i = l - 1 || s . [ i + 1 ] < ' 0 ' || s . [ i + 1 ] > ' 9 ' -> Buffer . ad... |
let jsmarshal v = string_escape ( Marshal . to_string v [ ] ) |
let make_cryptographic_safe_string ? len ( ) = match len with | None -> Ocsigen_lib . make_cryptographic_safe_string ( ) | Some l -> String . sub ( Ocsigen_lib . make_cryptographic_safe_string ( ) ) 0 l |
module Lwt_ops = struct let ( >>= ) = Lwt . ( >>= ) let ( =<< ) = Lwt . ( =<< ) let ( >|= ) = Lwt . ( >|= ) let ( =|< ) = Lwt . ( =|< ) end |
type pos = Lexing . position * Lexing . position |
let pos_to_string ( ( start , stop ) : pos ) = let open Lexing in let start_col = start . pos_cnum - start . pos_bol in let stop_col = stop . pos_cnum - stop . pos_bol in if start . pos_lnum = stop . pos_lnum then if start_col = stop_col then Printf . sprintf " % s % d :% d " star... |
module type Map_S = sig include Map . S val from_list : ( key * ' a ) list -> ' a t val to_string : ? sep : string -> ( ' a -> string ) -> ' a t -> string end |
module Map_make ( Ord : sig include Map . OrderedType val to_string : t -> string struct include Map . Make ( Ord ) let from_list li = List . fold_right ( uncurry add ) li empty let to_string ( ? sep = " , " ) value_to_string map = String . concat sep ( List . map ( fun ( key ... |
module Int64_map = Map_make ( Int64 ) |
module Int_map = Map_make ( struct type t = int let compare = ( - ) let to_string = string_of_int end ) |
module String_map = Map_make ( struct include String let to_string x = x end ) |
let ( >>= ) = Lwt . ( >>= ) |
let suffix_redir_uri_key = Polytables . make_key ( ) |
type ( ' options , ' page , ' result ) param = { send : ? options ' : options -> ? charset : string -> ? code : int -> ? content_type : string -> ? headers : Ocsigen_header . t -> ' page -> Ocsigen_response . t Lwt . t ; send_appl_content : S . send_appl_content ; resu... |
let check_before name service = match S . send_appl_content service with | S . XSame_appl ( an , _ ) when an = name -> false | S . XAlways -> false | _ -> true |
let check_after name result = match Ocsigen_response . header result ( Ocsigen_header . Name . of_string Eliom_common_base . appl_name_header_name ) with | Some appl_name -> not ( appl_name = name ) | None -> true |
let check_process_redir sp f param = let redir = if Eliom_request_info . expecting_process_page ( ) then match sp . Eliom_common . sp_client_appl_name with | None -> false | Some anr -> f anr param else false in if redir then let ri = Eliom_request_info . get_ri_sp sp in Lwt . fail ( Eliom_common... |
let send_with_cookies sp pages ? options ? charset ? code ? content_type ? headers content = let % lwt result = pages . send ? options ? charset ? code ? content_type ? headers content in let % lwt ( ) = check_process_redir sp check_after result in let % lwt tab_cookies = Eliommod_cookies . com... |
let register_aux pages ? options ? charset ? code ? content_type ? headers table ( type a ) ( ~ service : ( _ , _ , _ , a , _ , _ , _ , _ , _ , _ , _ ) S . t ) ( ? error_handler = fun l -> raise ( Eliom_common . Eliom_Typing_Error l ) ) page_generator = S... |
let send pages ? options ? charset ? code ? content_type ? headers content = let % lwt result = pages . send ? options ? charset ? code ? content_type ? headers content in Lwt . return ( pages . result_of_http_result result ) |
let register pages ? app : _ ? scope ? options ? charset ? code ? content_type ? headers ? secure_session ( type a ) ( ~ service : ( _ , _ , _ , a , _ , _ , S . reg , _ , _ , _ , _ ) S . t ) ? error_handler page_gen = let sp = Eliom_common . get_sp_option ( ... |
let create pages ? scope ? app ? options ? charset ? code ? content_type ? headers ? secure_session ? https ? name ? csrf_safe ? csrf_scope ? csrf_secure ? max_use ? timeout ~ meth ~ path ? error_handler page = let service = S . create_unsafe ? name ? csrf_safe ? csrf_scope ( : csrf_scope :... |
let create_attached_get pages ? scope ? app ? options ? charset ? code ? content_type ? headers ? secure_session ? https ? name ? csrf_safe ? csrf_scope ? csrf_secure ? max_use ? timeout ~ fallback ~ get_params ? error_handler page = let service = S . create_attached_get_unsafe ? name ? csrf_saf... |
let create_attached_post pages ? scope ? app ? options ? charset ? code ? content_type ? headers ? secure_session ? https ? name ? csrf_safe ? csrf_scope ? csrf_secure ? max_use ? timeout ~ fallback ~ post_params ? error_handler page = let service = S . create_attached_post_unsafe ? name ? csrf_... |
module Make ( Pages : Eliom_registration_sigs . PARAM with type frame := Ocsigen_response . t ) = struct type page = Pages . page type options = Pages . options type return = Eliom_service . non_ocaml type result = Pages . result let pages = { send = Pages . send ; send_appl_content = Pa... |
module Make_poly ( Pages : Eliom_registration_sigs . PARAM_POLY with type frame := Ocsigen_response . t ) = struct type ' a page = ' a Pages . page type options = Pages . options type ' a return = ' a Pages . return let pages = { send = Pages . send ; send_appl_content = Pages . s... |
let uptime = let launchtime = Unix . time ( ) in fun ( ) -> Unix . time ( ) . - launchtime |
let pid ( ) = Unix . getpid ( ) |
let fd ~ pid = try let a = Array . length ( Sys . readdir ( Printf . sprintf " / proc /% d / fd " pid ) ) - 2 in ` Ok a with e -> ` Error ( Printexc . to_string e ) |
let ppf fmt = Printf . ksprintf Eliom_content . Html . D . txt fmt |
let format_duration t = let open Unix in let tm = gmtime t in let year = if tm . tm_year > 0 then string_of_int ( tm . tm_year - 70 ) ^ " years , " else " " in let days = string_of_int tm . tm_yday ^ " days , " in let hour = string_of_int tm . tm_hour ^ " hours , " in let m... |
let general_stats ( ) = let pid = pid ( ) in div [ dl [ dt [ ppf " Version of Ocsigen " ] ; dd [ ppf " % s " Ocsigen_config . version_number ] ; dt [ ppf " Uptime " ] ; dd [ ppf " % s " ( format_duration ( uptime ( ) ) ) ] ; dt [ ppf " PID " ] ... |
let gc_stats ( ) = let stat = Gc . quick_stat ( ) in div [ ul [ li [ ppf " % d minor garbage collections . " stat . Gc . minor_collections ] ; li [ ppf " % d major collections . " stat . Gc . major_collections ] ; li [ ppf " % d compactions of the heap . " stat... |
let lwt_stats ( ) = div [ ul [ li [ ppf " % d lwt threads waiting for inputs " ( Lwt_engine . readable_count ( ) ) ] ; li [ ppf " % d lwt threads waiting for outputs " ( Lwt_engine . writable_count ( ) ) ] ; li [ ppf " % d sleeping lwt threads " ( Lwt_engine .... |
let preemptive_thread_stats ( ) = div [ ul [ li [ ppf " % d detached threads ( min % d , max % d ) . " ( Lwt_preemptive . nbthreads ( ) ) ( Ocsigen_config . get_minthreads ( ) ) ( Ocsigen_config . get_maxthreads ( ) ) ] ; li [ ppf " % d are busy threads .... |
let http_stats ( ) = let hosts = Ocsigen_extensions . get_hosts ( ) in div [ ul [ li [ ppf " % d open connection " ( Ocsigen_extensions . get_number_of_connected ( ) ) ] ] ; h3 [ txt " Hosts " ] ; ul ( List . map ( fun ( vhosts , config , _ ) -> let all_v... |
let eliom_stats ( ) = let % lwt persist_nb_of_groups = Eliommod_sessiongroups . Pers . nb_of_groups ( ) in let % lwt number_of_persistent_data_cookies = Eliom_state . number_of_persistent_data_cookies ( ) in Lwt . return ( div [ h3 [ ppf " Sessions " ] ; ul [ li [ ppf " % d... |
let content_div ( ) = let % lwt eliom_stats = eliom_stats ( ) in Lwt . return ( div [ h1 [ ppf " Ocsigen server monitoring " ] ; general_stats ( ) ; h2 [ ppf " HTTP connexions " ] ; http_stats ( ) ; h2 [ ppf " Eliom sessions " ] ; eliom_stats ; h2 [ ppf " ... |
let content_html ( ) = let % lwt content_div = content_div ( ) in Lwt . return ( html ( head ( title ( txt " Server monitoring " ) ) [ link ~ rel [ ` : Stylesheet ] ~ href : ( uri_of_string ( fun ( ) -> " // netdna . bootstrapcdn . com / bootstrap / 3 . 1 .... |
module type S = sig type identity type key type server_notif type client_notif val init : unit -> unit Lwt . t val deinit : unit -> unit val listen : key -> unit val unlisten : key -> unit module Ext : sig val unlisten : ? sitedata : Eliom_common . sitedata -> ( [ < ` Client_process ] , [ ... |
module type ARG = sig type identity type key type server_notif type client_notif val prepare : identity -> server_notif -> client_notif option Lwt . t val equal_key : key -> key -> bool val equal_identity : identity -> identity -> bool val get_identity : unit -> identity Lwt . t val max_resource : int ... |
module Make ( A : ARG ) : S with type identity = A . identity and type key = A . key and type server_notif = A . server_notif and type client_notif = A . client_notif = struct type key = A . key type identity = A . identity type server_notif = A . server_notif type client_notif = A . clie... |
module type ARG_SIMPLE = sig type identity type key type notification val get_identity : unit -> identity Lwt . t end |
module Make_Simple ( A : ARG_SIMPLE ) = Make ( struct type identity = A . identity type key = A . key type server_notif = A . notification type client_notif = A . notification let prepare _ n = Lwt . return_some n let equal_key = ( = ) let equal_identity = ( = ) let get_identity = A... |
module M : sig type ' a t val remove : ' a t -> string -> ( ' a * ' a t ) option val of_assoc_list : ( string * ' a ) list -> ' a t module Raw = Map . Make ( struct type t = string let compare = compare end ) type ' a t = ' a list Raw . t let remove m id = try match Raw . ... |
let reconstruct_atom ~ f m name = try match M . remove m name with | Some ( ` String v , m ) -> let v = f ( Js . to_string v ) in Some ( v , m ) | _ -> None with _ -> None |
let ( >>= ) x f = match x with Some x -> f x | None -> None |
let rec reconstruct_set : type a c . a list * Form . form_elt M . t -> ( a , _ , c ) params_type -> a list * Form . form_elt M . t = fun ( ( acc , m ) as p ) y -> match reconstruct_params_form m y with | Some ( v , m ) -> reconstruct_set ( v :: acc , m ) y | None -> ... |
let user_type ~ of_string ~ to_string n = TUserType ( n , { of_string ; to_string } ) |
let all_suffix_user ~ of_string ~ to_string n = TESuffixu ( n , { of_string ; to_string } ) |
let reconstruct_params_form l y = reconstruct_params_form ( M . of_assoc_list l ) y >>= fun ( v , _ ) -> Some v |
let get_non_localized_get_parameters { name ; param } = try Some ( reconstruct_params_ param ( try Eliom_lib . String . Table . find name ( Eliom_request_info . get_sess_info ( ) ) . si_nl_get_params with Not_found -> [ ] ) [ ] false None ) with Eliom_common . Eliom_Wrong_par... |
let user_type ? client_to_and_of ( ~ of_string : string -> ' a ) ( ~ to_string : ' a -> string ) ( n : string ) = TUserType ( n , Eliom_common . To_and_of_shared . create ? client_to_and_of { of_string ; to_string } ) |
let all_suffix_user ? client_to_and_of ( ~ of_string : string -> ' a ) ( ~ to_string : ' a -> string ) ( n : string ) = TESuffixu ( n , Eliom_common . To_and_of_shared . create ? client_to_and_of { of_string ; to_string } ) |
let regexp reg dest ~ to_string n = user_type ( fun s -> match Pcre . exec ~ rex : reg ~ flags [ ` : ANCHORED ] ~ pos : 0 s with | _ -> ( try Ocsigen_extensions . replace_user_dir reg ( Ocsigen_extensions . parse_user_dir dest ) s with Ocsigen_extensions . NoSuchUser -> raise ( Fai... |
let all_suffix_regexp reg dest ( ~ to_string : ' a -> string ) ( n : string ) : ( string , [ ` Endsuffix ] , [ ` One of string ] param_name ) params_type = all_suffix_user ( fun s -> match Pcre . exec ~ rex : reg ~ flags [ ` : ANCHORED ] ~ pos : 0 s with | _ -> (... |
let get_non_localized_parameters params files ~ getorpost ~ sp { name ; get ; post ; param = paramtype } = let key = match getorpost with ` Get -> get | ` Post -> post in try Polytables . get ~ table : ( Ocsigen_request . request_cache sp . Eliom_common . sp_request . request_info ) ... |
let get_non_localized_get_parameters p = let sp = Eliom_common . get_sp ( ) in get_non_localized_parameters sp . Eliom_common . sp_si . Eliom_common . si_nl_get_params sp . Eliom_common . sp_si . Eliom_common . si_nl_file_params ~ getorpost ` : Get ~ sp p |
let get_non_localized_post_parameters p = let sp = Eliom_common . get_sp ( ) in get_non_localized_parameters sp . Eliom_common . sp_si . Eliom_common . si_nl_post_params sp . Eliom_common . sp_si . Eliom_common . si_nl_file_params ~ getorpost ` : Post ~ sp p |
let section = Lwt_log . Section . make " eliom : parameter " |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.