summaryrefslogtreecommitdiff
path: root/src/tool_help.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2022-09-15 14:31:36 +0200
committerDaniel Stenberg <daniel@haxx.se>2022-09-16 23:29:08 +0200
commitdd2a024323dccd6b813adc4ec7673ab8625f0904 (patch)
tree6ccf6be761008a4b7a4f273c8312a564d663c5ce /src/tool_help.c
parent9d51329047952ebfc2b944b7448b8f87f9e6ed51 (diff)
downloadcurl-dd2a024323dccd6b813adc4ec7673ab8625f0904.tar.gz
cli tool: do not use disabled protocols
As they are now rejected by the library, take care of not passing disabled protocol names to CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR. Rather than using the CURLPROTO_* constants, dynamically assign protocol numbers based on the order they are listed by curl_version_info(). New type proto_set_t implements prototype bit masks: it should therefore be large enough to accomodate all library-enabled protocols. If not, protocol numbers beyond the bit count of proto_set_t are recognized but "inaccessible": when used, a warning is displayed and the value is ignored. Should proto_set_t overflows, enabled protocols are reordered to force those having a public CURLPROTO_* representation to be accessible. Code has been added to subordinate RTMP?* protocols to the presence of RTMP in the enabled protocol list, being returned by curl_version_info() or not.
Diffstat (limited to 'src/tool_help.c')
-rw-r--r--src/tool_help.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tool_help.c b/src/tool_help.c
index 75400d94c..f24a5f2ed 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -221,7 +221,10 @@ void tool_version_info(void)
if(curlinfo->protocols) {
printf("Protocols: ");
for(proto = curlinfo->protocols; *proto; ++proto) {
- printf("%s ", *proto);
+ /* Special case: do not list rtmp?* protocols.
+ They may only appear together with "rtmp" */
+ if(!curl_strnequal(*proto, "rtmp", 4) || !proto[0][4])
+ printf("%s ", *proto);
}
puts(""); /* newline */
}