12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970# 1 "src/lib/eliom_lib.server.ml"(* Please put in this file ONLY extensions of the standard OCaml library.
And remove all the Eliom/Ocsigen specific stuff. *)includeOcsigen_libinclude(Eliom_lib_base:moduletypeofEliom_lib_basewithtype'aInt64_map.t='aEliom_lib_base.Int64_map.twithtype'aString_map.t='aEliom_lib_base.String_map.twithtype'aInt_map.t='aEliom_lib_base.Int_map.t)letdebugf=Printf.ksprintf(funs->Printf.eprintf"%s\n%!"s)fletto_json?typv=matchtypwith|Sometyp->Deriving_Json.to_stringtypv|None->assertfalse(* implemented only client side *)letof_json?typs=matchtypwith|Sometyp->Deriving_Json.from_stringtyps|None->assertfalse(* implemented only client side *)moduleLwt_log=structincludeLwt_logleteliom=Section.make"eliom"endtypefile_info=Ocsigen_extensions.file_infoletb=Buffer.create(16*1024)letstring_escapes=letl=String.lengthsinBuffer.clearb;letconv="0123456789abcdef"infori=0tol-1doletc=s.[i]inmatchcwith|'\000'wheni=l-1||s.[i+1]<'0'||s.[i+1]>'9'->Buffer.add_stringb"\\0"|'\b'->Buffer.add_stringb"\\b"|'\t'->Buffer.add_stringb"\\t"|'\n'->Buffer.add_stringb"\\n"(*| '\011' -> (* IE<9 doesn't like vertical tab \v *)
Buffer.add_string b "\\v"*)|'\012'->Buffer.add_stringb"\\f"|'\r'->Buffer.add_stringb"\\r"|'\''->Buffer.add_stringb"\\'"|'\\'->Buffer.add_stringb"\\\\"|'\000'..'\031'|'\127'..'\255'|'&'|'<'|'>'->letc=Char.codecinBuffer.add_stringb"\\x";Buffer.add_charbconv.[clsr4];Buffer.add_charbconv.[cland0xf]|_->Buffer.add_charbcdone;Buffer.contentsbletjsmarshalv=string_escape(Marshal.to_stringv[])letmake_cryptographic_safe_string?len()=matchlenwith|None->Ocsigen_lib.make_cryptographic_safe_string()|Somel->String.sub(Ocsigen_lib.make_cryptographic_safe_string())0l