urldata: make set.http200aliases conditional on HTTP being present

And make a few SSH-only fields depend on SSH

Closes #10140
This commit is contained in:
Daniel Stenberg 2022-12-22 17:08:38 +01:00
parent aef4dc892d
commit f4883ba966
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 20 additions and 13 deletions

View File

@ -732,13 +732,6 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.sep_headers = (bool)((arg & CURLHEADER_SEPARATE)? TRUE: FALSE); data->set.sep_headers = (bool)((arg & CURLHEADER_SEPARATE)? TRUE: FALSE);
break; break;
case CURLOPT_HTTP200ALIASES:
/*
* Set a list of aliases for HTTP 200 in response header
*/
data->set.http200aliases = va_arg(param, struct curl_slist *);
break;
#if !defined(CURL_DISABLE_COOKIES) #if !defined(CURL_DISABLE_COOKIES)
case CURLOPT_COOKIE: case CURLOPT_COOKIE:
/* /*
@ -944,6 +937,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.http09_allowed = arg ? TRUE : FALSE; data->set.http09_allowed = arg ? TRUE : FALSE;
#endif #endif
break; break;
case CURLOPT_HTTP200ALIASES:
/*
* Set a list of aliases for HTTP 200 in response header
*/
data->set.http200aliases = va_arg(param, struct curl_slist *);
break;
#endif /* CURL_DISABLE_HTTP */ #endif /* CURL_DISABLE_HTTP */
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_SMTP) || \ #if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_SMTP) || \
@ -2546,6 +2546,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
data->set.ssh_hostkeyfunc_userp = va_arg(param, void *); data->set.ssh_hostkeyfunc_userp = va_arg(param, void *);
break; break;
#endif #endif
case CURLOPT_SSH_KEYFUNCTION: case CURLOPT_SSH_KEYFUNCTION:
/* setting to NULL is fine since the ssh.c functions themselves will /* setting to NULL is fine since the ssh.c functions themselves will
then revert to use the internal default */ then revert to use the internal default */
@ -2592,7 +2593,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_BAD_FUNCTION_ARGUMENT;
data->set.new_file_perms = (unsigned int)arg; data->set.new_file_perms = (unsigned int)arg;
break; break;
#endif
#ifdef USE_SSH
case CURLOPT_NEW_DIRECTORY_PERMS: case CURLOPT_NEW_DIRECTORY_PERMS:
/* /*
* Uses these permissions instead of 0755 * Uses these permissions instead of 0755

View File

@ -560,8 +560,11 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
#ifdef USE_TLS_SRP #ifdef USE_TLS_SRP
set->ssl.primary.authtype = CURL_TLSAUTH_NONE; set->ssl.primary.authtype = CURL_TLSAUTH_NONE;
#endif #endif
/* defaults to any auth type */ #ifdef USE_SSH
/* defaults to any auth type */
set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; set->ssh_auth_types = CURLSSH_AUTH_DEFAULT;
set->new_directory_perms = 0755; /* Default permissions */
#endif
set->ssl.primary.sessionid = TRUE; /* session ID caching enabled by set->ssl.primary.sessionid = TRUE; /* session ID caching enabled by
default */ default */
#ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_PROXY
@ -569,7 +572,6 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
#endif #endif
set->new_file_perms = 0644; /* Default permissions */ set->new_file_perms = 0644; /* Default permissions */
set->new_directory_perms = 0755; /* Default permissions */
set->allowed_protocols = (curl_prot_t) CURLPROTO_ALL; set->allowed_protocols = (curl_prot_t) CURLPROTO_ALL;
set->redir_protocols = CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP | set->redir_protocols = CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FTP |
CURLPROTO_FTPS; CURLPROTO_FTPS;

View File

@ -1722,7 +1722,9 @@ struct UserDefined {
unsigned int upload_buffer_size; /* size of upload buffer to use, unsigned int upload_buffer_size; /* size of upload buffer to use,
keep it >= CURL_MAX_WRITE_SIZE */ keep it >= CURL_MAX_WRITE_SIZE */
void *private_data; /* application-private data */ void *private_data; /* application-private data */
#ifndef CURL_DISABLE_HTTP
struct curl_slist *http200aliases; /* linked list of aliases for http200 */ struct curl_slist *http200aliases; /* linked list of aliases for http200 */
#endif
unsigned char ipver; /* the CURL_IPRESOLVE_* defines in the public header unsigned char ipver; /* the CURL_IPRESOLVE_* defines in the public header
file 0 - whatever, 1 - v2, 2 - v6 */ file 0 - whatever, 1 - v2, 2 - v6 */
curl_off_t max_filesize; /* Maximum file size to download */ curl_off_t max_filesize; /* Maximum file size to download */
@ -1743,17 +1745,18 @@ struct UserDefined {
curl_sshhostkeycallback ssh_hostkeyfunc; /* hostkey check callback */ curl_sshhostkeycallback ssh_hostkeyfunc; /* hostkey check callback */
void *ssh_hostkeyfunc_userp; /* custom pointer to callback */ void *ssh_hostkeyfunc_userp; /* custom pointer to callback */
#endif #endif
#ifdef USE_SSH
curl_sshkeycallback ssh_keyfunc; /* key matching callback */ curl_sshkeycallback ssh_keyfunc; /* key matching callback */
void *ssh_keyfunc_userp; /* custom pointer to callback */ void *ssh_keyfunc_userp; /* custom pointer to callback */
int ssh_auth_types; /* allowed SSH auth types */
unsigned int new_directory_perms; /* when creating remote dirs */
#endif
#ifndef CURL_DISABLE_NETRC #ifndef CURL_DISABLE_NETRC
unsigned char use_netrc; /* enum CURL_NETRC_OPTION values */ unsigned char use_netrc; /* enum CURL_NETRC_OPTION values */
#endif #endif
curl_usessl use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or curl_usessl use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
IMAP or POP3 or others! */ IMAP or POP3 or others! */
unsigned int new_file_perms; /* when creating remote files */ unsigned int new_file_perms; /* when creating remote files */
unsigned int new_directory_perms; /* when creating remote dirs */
int ssh_auth_types; /* allowed SSH auth types */
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */ char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
struct curl_blob *blobs[BLOB_LAST]; struct curl_blob *blobs[BLOB_LAST];
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6