tangled
alpha
login
or
join now
anil.recoil.org
/
ocaml-requests
1
fork
atom
A batteries included HTTP/1.1 client in OCaml
1
fork
atom
overview
issues
pulls
pipelines
Merge branch 'main' into http2
anil.recoil.org
1 month ago
230002ba
5ef99436
0/1
build.yml
failed
3min 48s
+18
1 changed file
expand all
collapse all
unified
split
lib
one.ml
+18
lib/one.ml
···
31
| Http1 (** HTTP/1.x (including plain HTTP) *)
32
| Http2 (** HTTP/2 negotiated via ALPN *)
33
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
34
(* Helper to wrap connection with TLS if needed.
35
Returns the TLS flow and the negotiated protocol. *)
36
let wrap_tls flow ~host ~verify_tls ~tls_config ~min_tls_version =
···
61
in
62
63
let tls_flow = Tls_eio.client_of_flow ~host:domain tls_cfg flow in
0
0
64
65
(* Check negotiated ALPN protocol *)
66
let protocol = match Tls_eio.epoch tls_flow with
···
31
| Http1 (** HTTP/1.x (including plain HTTP) *)
32
| Http2 (** HTTP/2 negotiated via ALPN *)
33
34
+
(* Track whether TLS tracing has been suppressed *)
35
+
let tls_tracing_suppressed = ref false
36
+
37
+
(* Suppress TLS tracing debug output (hexdumps) unless explicitly enabled *)
38
+
let suppress_tls_tracing () =
39
+
if not !tls_tracing_suppressed then begin
40
+
tls_tracing_suppressed := true;
41
+
match List.find_opt (fun s -> Logs.Src.name s = "tls.tracing") (Logs.Src.list ()) with
42
+
| Some tls_src ->
43
+
(* Only suppress if currently at Debug level *)
44
+
(match Logs.Src.level tls_src with
45
+
| Some Logs.Debug -> Logs.Src.set_level tls_src (Some Logs.Warning)
46
+
| _ -> ())
47
+
| None -> ()
48
+
end
49
+
50
(* Helper to wrap connection with TLS if needed.
51
Returns the TLS flow and the negotiated protocol. *)
52
let wrap_tls flow ~host ~verify_tls ~tls_config ~min_tls_version =
···
77
in
78
79
let tls_flow = Tls_eio.client_of_flow ~host:domain tls_cfg flow in
80
+
(* Suppress TLS tracing after first connection creates the tls.tracing source *)
81
+
suppress_tls_tracing ();
82
83
(* Check negotiated ALPN protocol *)
84
let protocol = match Tls_eio.epoch tls_flow with