mirror of
https://github.com/curl/curl.git
synced 2026-07-25 10:47:45 +03:00
tool_paramhlp: refuse --proto remove all protocols
curl is for transfers so disabling all protocols has to be a mistake. Previously it would allow this to get set (even if curl_easy_setopt() returns an error for it) and then let libcurl return error instead. Updated 1474 accordingly. Closes #19388
This commit is contained in:
parent
e108778db3
commit
8e93a74a73
2 changed files with 12 additions and 8 deletions
|
|
@ -397,7 +397,7 @@ ParameterError proto2num(const char * const *val, char **ostr, const char *str)
|
|||
const char **protoset;
|
||||
struct dynbuf obuf;
|
||||
size_t proto;
|
||||
CURLcode result;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
curlx_dyn_init(&obuf, MAX_PROTOSTRING);
|
||||
|
||||
|
|
@ -496,15 +496,19 @@ ParameterError proto2num(const char * const *val, char **ostr, const char *str)
|
|||
qsort((char *) protoset, protoset_index(protoset, NULL), sizeof(*protoset),
|
||||
struplocompare4sort);
|
||||
|
||||
result = curlx_dyn_addn(&obuf, "", 0);
|
||||
for(proto = 0; protoset[proto] && !result; proto++)
|
||||
result = curlx_dyn_addf(&obuf, "%s,", protoset[proto]);
|
||||
result = curlx_dyn_addf(&obuf, "%s%s", curlx_dyn_len(&obuf) ? "," : "",
|
||||
protoset[proto]);
|
||||
free((char *) protoset);
|
||||
curlx_dyn_setlen(&obuf, curlx_dyn_len(&obuf) - 1);
|
||||
if(result)
|
||||
return PARAM_NO_MEM;
|
||||
if(!curlx_dyn_len(&obuf)) {
|
||||
curlx_dyn_free(&obuf);
|
||||
return PARAM_BAD_USE;
|
||||
}
|
||||
free(*ostr);
|
||||
*ostr = curlx_dyn_ptr(&obuf);
|
||||
|
||||
return *ostr ? PARAM_OK : PARAM_NO_MEM;
|
||||
return PARAM_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@ http
|
|||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# 1 - Protocol "http" disabled
|
||||
# 2 failed init, the --proto argument is not accepted
|
||||
<errorcode>
|
||||
1
|
||||
2
|
||||
</errorcode>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue