-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathocsigen_lib.mli
112 lines (95 loc) · 3.79 KB
/
ocsigen_lib.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
(* Ocsigen
* Copyright (C) 2005 Vincent Balat
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
(** This module contains some auxiliaries for the Ocsigenserver. In contrast to
{!Ocsigen_lib_base}, the function may also refer to libraries other than the
standard library.
*)
include
module type of Ocsigen_lib_base
with type poly = Ocsigen_lib_base.poly
and type yesnomaybe = Ocsigen_lib_base.yesnomaybe
and type ('a, 'b) leftright = ('a, 'b) Ocsigen_lib_base.leftright
and type 'a Clist.t = 'a Ocsigen_lib_base.Clist.t
and type 'a Clist.node = 'a Ocsigen_lib_base.Clist.node
val make_cryptographic_safe_string : unit -> string
(** Generate an unique and cryptographically safe random string.
It is impossible to guess for other people and
will never return twice the same value (with very good probabilities). *)
module String : module type of String_base
module Ip_address : sig
exception No_such_host
val get_inet_addr : ?v6:bool -> string -> Unix.inet_addr Lwt.t
val of_sockaddr : Unix.sockaddr -> Unix.inet_addr
end
module Filename : sig
include module type of Filename
(* val basename : string -> string *)
(* val extension : string -> string *)
val extension_no_directory : string -> string
end
module Url : sig
include module type of Url_base with type t = Url_base.t
val fixup_url_string : t -> t
val encode : ?plus:bool -> string -> string
val decode : ?plus:bool -> string -> string
val make_encoded_parameters : (string * string) list -> string
val string_of_url_path : encode:bool -> path -> uri
val parse :
t
-> bool option
* string option
* int option
* string
* string list
* string option
* (string * string) list Lazy.t
(** [parse url] returns a tuple containing information about [url]
{ul
{- If url contains scheme 'https'}
{- host of url (ex: http://www.ocsigen.org/ -> www.ocsigen.org)}
{- port of url}
{- path as [string] without first '/'}
{- path as [string list]}
{- GET query of url}
{- lazy value to decode GET query }
}
*)
val prefix_and_path_of_t : string -> string * string list
(** [prefix_and_path_of_t url] splits [url] in a couple [(prefix, path)] where
[prefix] is ["http(s)://host:port"] and [path] is the path as [string list]
Example: [prefix_and_path_of_t "http://ocsigen.org:80/tuto/manual"]
returns [("http://ocsigen.org:80", ["tuto", "manual"])].
*)
end
(**/**)
(* This exists to facilitate transition away from Ocamlnet. Do not use
for new code! *)
module Netstring_pcre : sig
open Re
val regexp : string -> Pcre.regexp
val matched_group : Pcre.groups -> int -> string -> string
val matched_string : Pcre.groups -> string -> string
val global_replace : Pcre.regexp -> string -> string -> string
val search_forward : Pcre.regexp -> string -> int -> int * Pcre.groups
val split : Pcre.regexp -> string -> string list
val string_match : Pcre.regexp -> string -> int -> Pcre.groups option
end
module Date : sig
val to_string : float -> string
(** Converts Unix GMT date to string *)
end