OCaml HTML5 parser/serialiser based on Python's JustHTML

Squashed 'ocaml-requests/' changes from 8a67320..2b94312

2b94312 Suppress TLS tracing debug output, improve Zulip request logging

git-subtree-dir: ocaml-requests
git-subtree-split: 2b943124f5e271b88315bfdb443ad33ec8163d67

+20 -1
+20 -1
lib/one.ml
··· 26 26 | TLS_1_2 (** TLS 1.2 minimum (default, widely compatible) *) 27 27 | TLS_1_3 (** TLS 1.3 minimum (most secure, may not work with older servers) *) 28 28 29 + (* Track whether TLS tracing has been suppressed *) 30 + let tls_tracing_suppressed = ref false 31 + 32 + (* Suppress TLS tracing debug output (hexdumps) unless explicitly enabled *) 33 + let suppress_tls_tracing () = 34 + if not !tls_tracing_suppressed then begin 35 + tls_tracing_suppressed := true; 36 + match List.find_opt (fun s -> Logs.Src.name s = "tls.tracing") (Logs.Src.list ()) with 37 + | Some tls_src -> 38 + (* Only suppress if currently at Debug level *) 39 + (match Logs.Src.level tls_src with 40 + | Some Logs.Debug -> Logs.Src.set_level tls_src (Some Logs.Warning) 41 + | _ -> ()) 42 + | None -> () 43 + end 44 + 29 45 (* Helper to wrap connection with TLS if needed *) 30 46 let wrap_tls flow ~host ~verify_tls ~tls_config ~min_tls_version = 31 47 Log.debug (fun m -> m "Wrapping connection with TLS for %s (verify=%b)" host verify_tls); ··· 54 70 })) 55 71 in 56 72 57 - (Tls_eio.client_of_flow ~host:domain tls_cfg flow :> [`Close | `Flow | `R | `Shutdown | `W] Eio.Resource.t) 73 + let tls_flow = Tls_eio.client_of_flow ~host:domain tls_cfg flow in 74 + (* Suppress TLS tracing after first connection creates the tls.tracing source *) 75 + suppress_tls_tracing (); 76 + (tls_flow :> [`Close | `Flow | `R | `Shutdown | `W] Eio.Resource.t) 58 77 59 78 (* Parse URL and connect directly (no pooling) *) 60 79 let connect_to_url ~sw ~clock ~net ~url ~timeout ~verify_tls ~tls_config ~min_tls_version =