A batteries included HTTP/1.1 client in OCaml

Merge branch 'main' into http2

+18
+18
lib/one.ml
··· 31 31 | Http1 (** HTTP/1.x (including plain HTTP) *) 32 32 | Http2 (** HTTP/2 negotiated via ALPN *) 33 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 + 34 50 (* Helper to wrap connection with TLS if needed. 35 51 Returns the TLS flow and the negotiated protocol. *) 36 52 let wrap_tls flow ~host ~verify_tls ~tls_config ~min_tls_version = ··· 61 77 in 62 78 63 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 (); 64 82 65 83 (* Check negotiated ALPN protocol *) 66 84 let protocol = match Tls_eio.epoch tls_flow with