curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Feature request: HTTPS first

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 6 Nov 2020 17:22:00 -0500

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
Received on 2020-11-06