A batteries included HTTP/1.1 client in OCaml

Default to http:// for URLs without a scheme in ocurl

When users provide a URL like "anil.recoil.org" without a scheme,
normalize it to "http://anil.recoil.org" to avoid invalid redirect
URLs being formed (e.g., "///anil.recoil.org").

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+10
+10
bin/ocurl.ml
··· 116 116 117 117 Fmt.pf ppf "@." 118 118 119 + (* Normalize URL to ensure it has a scheme, defaulting to http:// *) 120 + let normalize_url url_str = 121 + let uri = Uri.of_string url_str in 122 + match Uri.scheme uri with 123 + | Some _ -> url_str (* Already has a scheme *) 124 + | None -> 125 + (* No scheme - prepend http:// *) 126 + "http://" ^ url_str 127 + 119 128 (* Process a single URL and return result *) 120 129 let process_url env req method_ headers body include_headers head output url_str = 130 + let url_str = normalize_url url_str in 121 131 let quiet = match Logs.level () with Some (Logs.Error | Logs.Warning) -> true | _ -> false in 122 132 let uri = Uri.of_string url_str in 123 133