mirror of
https://github.com/curl/curl.git
synced 2026-07-25 18:47:15 +03:00
setopt: allow CURLOPT_INTERFACE to be set to NULL
Ref: https://github.com/curl/curl/discussions/14299#discussioncomment-10393909
Regression from 3060557af7 (shipped in 8.9.0)
Closes #14629
This commit is contained in:
parent
3065f106e3
commit
b0b4b481b5
4 changed files with 19 additions and 21 deletions
|
|
@ -511,32 +511,37 @@ void Curl_sndbuf_init(curl_socket_t sockfd)
|
|||
*
|
||||
* Returns CURLE_OK on success.
|
||||
*/
|
||||
CURLcode Curl_parse_interface(const char *input, size_t len,
|
||||
CURLcode Curl_parse_interface(const char *input,
|
||||
char **dev, char **iface, char **host)
|
||||
{
|
||||
static const char if_prefix[] = "if!";
|
||||
static const char host_prefix[] = "host!";
|
||||
static const char if_host_prefix[] = "ifhost!";
|
||||
size_t len;
|
||||
|
||||
DEBUGASSERT(dev);
|
||||
DEBUGASSERT(iface);
|
||||
DEBUGASSERT(host);
|
||||
|
||||
if(strncmp(if_prefix, input, strlen(if_prefix)) == 0) {
|
||||
len = strlen(input);
|
||||
if(len > 512)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
if(!strncmp(if_prefix, input, strlen(if_prefix))) {
|
||||
input += strlen(if_prefix);
|
||||
if(!*input)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
*iface = Curl_memdup0(input, len - strlen(if_prefix));
|
||||
return *iface ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
if(strncmp(host_prefix, input, strlen(host_prefix)) == 0) {
|
||||
else if(!strncmp(host_prefix, input, strlen(host_prefix))) {
|
||||
input += strlen(host_prefix);
|
||||
if(!*input)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
*host = Curl_memdup0(input, len - strlen(host_prefix));
|
||||
return *host ? CURLE_OK : CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
if(strncmp(if_host_prefix, input, strlen(if_host_prefix)) == 0) {
|
||||
else if(!strncmp(if_host_prefix, input, strlen(if_host_prefix))) {
|
||||
const char *host_part;
|
||||
input += strlen(if_host_prefix);
|
||||
len -= strlen(if_host_prefix);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue