mirror of
https://github.com/curl/curl.git
synced 2026-08-25 00:13:34 +03:00
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.
This commit is contained in:
parent
9d51329047
commit
dd2a024323
10 changed files with 274 additions and 197 deletions
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue