mirror of
https://github.com/curl/curl.git
synced 2026-08-25 14:03:36 +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
|
|
@ -1209,15 +1209,14 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||
break;
|
||||
case 'D': /* --proto */
|
||||
config->proto_present = TRUE;
|
||||
err = proto2num(config, (unsigned int)CURLPROTO_ALL,
|
||||
&config->proto_str, nextarg);
|
||||
err = proto2num(config, PROTO_ALL, &config->proto_str, nextarg);
|
||||
if(err)
|
||||
return err;
|
||||
break;
|
||||
case 'E': /* --proto-redir */
|
||||
config->proto_redir_present = TRUE;
|
||||
if(proto2num(config, CURLPROTO_HTTP|CURLPROTO_HTTPS|
|
||||
CURLPROTO_FTP|CURLPROTO_FTPS,
|
||||
if(proto2num(config, PROTO_BIT(proto_http) | PROTO_BIT(proto_https) |
|
||||
PROTO_BIT(proto_ftp) | PROTO_BIT(proto_ftps),
|
||||
&config->proto_redir_str, nextarg))
|
||||
return PARAM_BAD_USE;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue