From 57ac78bcdd2ad9d7e3c18469a6fcd7176beb06bd Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Tue, 14 Jun 2022 18:43:09 +0200 Subject: [PATCH] [protocol] Added option protocol.default_protocol . Refs #174 --- src/protocol/protocol.c | 4 ++++ src/protocol/uri.c | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/protocol/protocol.c b/src/protocol/protocol.c index a319aa1b6..95fafcd7b 100644 --- a/src/protocol/protocol.c +++ b/src/protocol/protocol.c @@ -280,6 +280,10 @@ static union option_info protocol_options[] = { "protocol", OPT_SORT, N_("Protocol specific options.")), + INIT_OPT_STRING("protocol", N_("Default protocol prefix"), + "default_protocol", OPT_ZERO, "https://", + N_("Default protocol prefix when none protocol was entered.")), + INIT_OPT_STRING("protocol", N_("No-proxy domains"), "no_proxy", OPT_ZERO, "", N_("Comma separated list of domains for which the proxy " diff --git a/src/protocol/uri.c b/src/protocol/uri.c index 573c63ffb..9d8435039 100644 --- a/src/protocol/uri.c +++ b/src/protocol/uri.c @@ -1276,11 +1276,9 @@ parse_uri: break; case PROTOCOL_UNKNOWN: - /* We default to file:// even though we already - * tested if the file existed since it will give - * a "No such file or directory" error. which - * might better hint the user that there was - * problem figuring out the URI. */ + add_to_string(&str, get_opt_str("protocol.default_protocol", NULL)); + add_to_string(&str, newurl); + break; case PROTOCOL_FILE: default: add_to_string(&str, "file://");