this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

more

+19 -11
+9 -8
requests/bin/ocurl.ml
··· 61 61 let doc = "Basic authentication in USER:PASSWORD format" in 62 62 Arg.(value & opt (some string) None & info ["u"; "user"] ~docv:"USER:PASS" ~doc) 63 63 64 - let verify_tls = 65 - let doc = "Verify TLS certificates (default: true)" in 66 - Arg.(value & opt bool true & info ["k"; "insecure"] ~doc:("Don't " ^ doc)) 64 + let insecure = 65 + let doc = "Don't verify TLS certificates" in 66 + Arg.(value & flag & info ["k"; "insecure"] ~doc) 67 67 68 68 let verbose = 69 69 let doc = "Verbose output" in ··· 141 141 142 142 (* Main function *) 143 143 let run_request method_ urls headers data json_data output include_headers 144 - follow_redirects max_redirects timeout auth verify_tls 144 + follow_redirects max_redirects timeout auth insecure 145 145 verbose quiet _show_progress user_agent () = 146 146 147 147 (* Setup logging *) ··· 153 153 Logs.set_level (Some log_level); 154 154 155 155 Eio_main.run @@ fun env -> 156 + Mirage_crypto_rng_unix.use_default (); 156 157 Switch.run @@ fun sw -> 157 158 158 159 (* Create client *) 159 160 let tls_config = 160 - if verify_tls then Requests.Tls.default () 161 - else Requests.Tls.insecure () 161 + if insecure then Requests.Tls.insecure () 162 + else Requests.Tls.default () 162 163 in 163 164 164 165 let client = Requests.create ~clock:env#clock ~tls_config env#net in ··· 198 199 ~follow_redirects 199 200 ~max_redirects 200 201 ?timeout 201 - ~verify_tls 202 + ~verify_tls:(not insecure) 202 203 ?auth:auth_obj 203 204 () 204 205 in ··· 291 292 let info = Cmd.info "ocurl" ~version:"1.0.0" ~doc ~man in 292 293 Cmd.v info Term.(const run_request $ http_method $ urls $ headers $ data $ 293 294 json_data $ output_file $ include_headers $ follow_redirects $ 294 - max_redirects $ timeout $ auth $ verify_tls $ verbose $ 295 + max_redirects $ timeout $ auth $ insecure $ verbose $ 295 296 quiet $ show_progress $ user_agent $ setup_log) 296 297 297 298 let () = exit (Cmd.eval cmd)
+1 -1
requests/lib/dune
··· 1 1 (library 2 2 (public_name requests) 3 3 (name requests) 4 - (libraries eio cohttp-eio tls-eio ca-certs x509 uri yojson logs base64 unix digestif mirage-crypto-rng mirage-crypto-rng.unix)) 4 + (libraries eio cohttp-eio tls-eio ca-certs x509 uri yojson logs base64 unix digestif mirage-crypto-rng mirage-crypto-rng.unix domain-name))
+9 -2
requests/lib/requests.ml
··· 400 400 let to_tls_config : config -> (Tls.Config.client, [> `Msg of string ]) result = function 401 401 | Default -> 402 402 (match Ca_certs.authenticator () with 403 - | Ok authenticator -> Tls.Config.client ~authenticator () 403 + | Ok authenticator -> 404 + Tls.Config.client ~authenticator () 404 405 | Error _ as e -> e) 405 406 | WithCaCerts auth -> 406 407 Tls.Config.client ~authenticator:auth () ··· 427 428 let make_client net tls_config = 428 429 match Tls.to_tls_config tls_config with 429 430 | Ok tls_config -> 430 - let https_fn _uri socket = Tls_eio.client_of_flow tls_config socket in 431 + let https_fn uri socket = 432 + let host = 433 + Uri.host uri 434 + |> Option.map (fun x -> Domain_name.(host_exn (of_string_exn x))) 435 + in 436 + Tls_eio.client_of_flow ?host tls_config socket 437 + in 431 438 Cohttp_eio.Client.make ~https:(Some https_fn) net 432 439 | Error (`Msg msg) -> 433 440 failwith ("TLS configuration error: " ^ msg)