On 11/6/2020 11:32 AM, Emil Engler via curl-library wrote:
Hello, as most websites use HTTPS nowadays I would suggest to let curl use HTTPS if no protocol was specified rather than HTTP and use HTTP as a fallback if HTTPS is not available. However, I am not certainly sure if that can be done easily (as I am not into the TLS protocol).
I assume you mean a user supplied URL and not the server Location header because the latter is treated as a relative path if there's no scheme. We have CURLOPT_DEFAULT_PROTOCOL [1] (tool: --proto-default [2]) to set the default protocol, but there is no secondary fallback. In other words if you pass URL example.com/foo (note no scheme) and set default proto to https then curl is going to change it to https://example.com/foo and if that fails then that's it.
[1]: https://curl.haxx.se/libcurl/c/CURLOPT_DEFAULT_PROTOCOL.html [2]: https://curl.haxx.se/docs/manpage.html#--proto-default ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html