Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 138 lines (99 sloc) 5.192 kB
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (** HttpTools:
19
20 Just some support routines for handling HTTP requests and responses.
21
22 *)
23
24 val http : NetAddr.protocol
25
26 (** Possible exceptions *)
27
28 exception CallbackAbort
29
30 (** Timing functions. *)
31
32 val rpt : int -> ('a -> 'b) -> 'a -> unit
33 val timefn : int -> ('a -> 'b) -> 'a -> unit
34 val verifyfn : ('a -> 'b) -> ('a -> string) -> ('b -> string) -> ('a * 'b) list -> bool
35
36 (** Basic string functions *)
37
38 val strcom : string -> int -> string * string option
39 val rmldtrsp0 : string -> int -> string
40 val rmldtrsp : string -> string
41 val rmldtrsp2 : string * string -> string * string
42 val rmldtrspl : string list -> string list
43
44 (** String based support for raw parser *)
45
46 val pos_mark : ('a -> int -> 'b) -> 'a -> int -> 'a -> int -> int -> (int * int) option
47 val upto_mark : string -> int -> string -> int -> int -> int * int * string
48 val upto_mark_ci : string -> int -> string -> int -> int -> int * int * string
49
50 (** Streaming parsers *)
51
52 val buf_clean : (Buffer.t * int ref) -> unit
53
54 val upto_mark_stream : ('a -> char) -> 'a -> string -> string
55
56 val get_char_cps : ('a -> ('b * string -> 'c) -> 'c) -> string ref * int ref * 'a -> (char -> 'c) -> 'c
57
58 val upto_mark_stream_cps : ?inclusive:bool -> Buffer.t -> ('a -> (char -> 'b) -> 'b) -> 'a -> string -> (string -> 'b) -> 'b
59 val upto_mark_stream_cps2 :
60 ?inclusive:bool -> (*?oc_opt:out_channel option ->*) Scheduler.t -> Scheduler.connection_info -> (Buffer.t * int ref) -> string ->
61 ?callback:('a -> int -> Buffer.t -> bool) -> 'a -> ?blocksize:int ->
62 ?err_cont:(exn -> unit) -> ?timeout:Time.t -> (Buffer.t * int * int -> unit) -> unit
63 val upto_mark_stream_cps3 :
64 ?inclusive:bool -> (*?oc_opt:out_channel option ->*) Scheduler.t -> Scheduler.connection_info -> (Buffer.t * int ref) -> string ->
65 ?callback:('a -> int -> Buffer.t -> bool) -> 'a -> ?blocksize:int ->
66 ?err_cont:(exn -> unit) -> ?timeout:Time.t -> (string -> unit) -> unit
67
68 val upto_stream_cps :
69 ?inclusive:bool ->
70 Buffer.t ->
71 ('a -> ('b * string -> 'c) -> 'c) ->
72 string ref * int ref * 'a -> string -> (string -> 'c) -> 'c
73
74 val read_upto_stream_cps :
75 ?inclusive:bool ->
76 Buffer.t ->
77 string ref * int ref * Scheduler.connection_info ->
78 string ->
79 Scheduler.t ->
80 ?err_cont:(exn -> unit) -> ?timeout:Time.t -> (string -> unit) -> unit
81
82 val fixed_stream_cps :
83 Buffer.t ->
84 ('a -> ('b * string -> 'c) -> 'c) ->
85 string ref * int ref * 'a -> int -> (string -> 'c) -> 'c
86
87 val read_fixed_stream_cps :
88 Buffer.t ->
89 string ref * int ref * Scheduler.connection_info ->
90 int ->
91 Scheduler.t ->
92 ?err_cont:(exn -> unit) -> ?timeout:Time.t -> (string -> unit) -> unit
93
94 val fixed_stream_cps2 :
95 (*?oc_opt:out_channel option ->*) Scheduler.t -> Scheduler.connection_info -> (Buffer.t * int ref) -> int ->
96 ?callback:('a -> int -> Buffer.t -> bool) -> 'a -> ?blocksize:int ->
97 ?err_cont:(exn -> unit) -> ?timeout:Time.t -> (Buffer.t * int * int -> unit) -> unit
98 val fixed_stream_cps3 :
99 (*?oc_opt:out_channel option ->*) Scheduler.t -> Scheduler.connection_info -> (Buffer.t * int ref) -> int ->
100 ?callback:('a -> int -> Buffer.t -> bool) -> 'a -> ?blocksize:int ->
101 ?err_cont:(exn -> unit) -> ?timeout:Time.t -> (string -> unit) -> unit
102
103 val upto : string -> ('a -> ('b * string -> 'c) -> 'c) -> string ref * int ref * 'a -> (string -> 'c) -> 'c
104
105 (** putback string onto protocol input *)
106
107 val putback : string -> string ref * int ref * 'a -> unit
108 val putback2 : string -> Buffer.t * int ref -> unit
109
110 (** Fast-forward functions *)
111
112 val skip_sptab : string -> int -> int -> int
113 val skip_lws : string -> int -> int -> int
114
115 (** More streaming functions *)
116
117 val upto_mark_lws : string -> int -> string -> int -> int -> int * int * string
118 val upto_mark_lws_ci : string -> int -> string -> int -> int -> int * int * string
119
120 (** Overflow from rcontent *)
121
122 (** content_compress gzip deflate compression_level cache_response content content_len:
123 Compress file content according to gzip/deflate flags (deflate has priority).
124 Does not read file in if file content, writes from/to disc.
125 *)
126 val content_compress : Scheduler.t -> bool -> bool -> int -> bool -> Rcontent.content -> int -> bool * Rcontent.content
127
128 (** Simple buffer management *)
129
130 val collect_bufs : int -> unit
131 val get_buf : ?hint:int -> unit -> Buffer.t
132 val free_buf : Buffer.t -> unit
133
134 (** SSL certificate generation *)
135
136 val make_ssl_cert : string -> string -> string -> SslAS.ssl_certificate option
137 val make_ssl_verify : string -> string -> string -> string -> (Ssl.certificate -> bool) -> bool -> SslAS.ssl_verify_params option
Something went wrong with that request. Please try again.