parent
1396a6c01f
commit
f402c181e3
@ -730,8 +730,6 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
|||||||
static CURLcode socket_connect_result(struct Curl_easy *data,
|
static CURLcode socket_connect_result(struct Curl_easy *data,
|
||||||
const char *ipaddress, int error)
|
const char *ipaddress, int error)
|
||||||
{
|
{
|
||||||
char buffer[STRERROR_LEN];
|
|
||||||
|
|
||||||
switch(error) {
|
switch(error) {
|
||||||
case EINPROGRESS:
|
case EINPROGRESS:
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
@ -748,8 +746,15 @@ static CURLcode socket_connect_result(struct Curl_easy *data,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
/* unknown error, fallthrough and try another address! */
|
/* unknown error, fallthrough and try another address! */
|
||||||
infof(data, "Immediate connect fail for %s: %s",
|
#ifdef CURL_DISABLE_VERBOSE_STRINGS
|
||||||
ipaddress, Curl_strerror(error, buffer, sizeof(buffer)));
|
(void)ipaddress;
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
char buffer[STRERROR_LEN];
|
||||||
|
infof(data, "Immediate connect fail for %s: %s",
|
||||||
|
ipaddress, Curl_strerror(error, buffer, sizeof(buffer)));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
data->state.os_errno = error;
|
data->state.os_errno = error;
|
||||||
/* connect failed */
|
/* connect failed */
|
||||||
return CURLE_COULDNT_CONNECT;
|
return CURLE_COULDNT_CONNECT;
|
||||||
@ -960,7 +965,6 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
|
|||||||
bool isconnected = FALSE;
|
bool isconnected = FALSE;
|
||||||
CURLcode result = CURLE_COULDNT_CONNECT;
|
CURLcode result = CURLE_COULDNT_CONNECT;
|
||||||
bool is_tcp;
|
bool is_tcp;
|
||||||
const char *ipmsg;
|
|
||||||
|
|
||||||
(void)data;
|
(void)data;
|
||||||
DEBUGASSERT(ctx->sock == CURL_SOCKET_BAD);
|
DEBUGASSERT(ctx->sock == CURL_SOCKET_BAD);
|
||||||
@ -973,15 +977,20 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
|
|||||||
if(result)
|
if(result)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
#ifndef CURL_DISABLE_VERBOSE_STRINGS
|
||||||
|
{
|
||||||
|
const char *ipmsg;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
if(ctx->addr.family == AF_INET6) {
|
if(ctx->addr.family == AF_INET6) {
|
||||||
set_ipv6_v6only(ctx->sock, 0);
|
set_ipv6_v6only(ctx->sock, 0);
|
||||||
ipmsg = " Trying [%s]:%d...";
|
ipmsg = " Trying [%s]:%d...";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
ipmsg = " Trying %s:%d...";
|
||||||
|
infof(data, ipmsg, ctx->r_ip, ctx->r_port);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
ipmsg = " Trying %s:%d...";
|
|
||||||
infof(data, ipmsg, ctx->r_ip, ctx->r_port);
|
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
is_tcp = (ctx->addr.family == AF_INET
|
is_tcp = (ctx->addr.family == AF_INET
|
||||||
@ -1931,4 +1940,3 @@ CURLcode Curl_cf_socket_peek(struct Curl_cfilter *cf,
|
|||||||
}
|
}
|
||||||
return CURLE_FAILED_INIT;
|
return CURLE_FAILED_INIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
lib/hostip.c
26
lib/hostip.c
@ -121,19 +121,6 @@
|
|||||||
|
|
||||||
static void freednsentry(void *freethis);
|
static void freednsentry(void *freethis);
|
||||||
|
|
||||||
/*
|
|
||||||
* Return # of addresses in a Curl_addrinfo struct
|
|
||||||
*/
|
|
||||||
static int num_addresses(const struct Curl_addrinfo *addr)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while(addr) {
|
|
||||||
addr = addr->ai_next;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_printable_address() stores a printable version of the 1st address
|
* Curl_printable_address() stores a printable version of the 1st address
|
||||||
* given in the 'ai' argument. The result will be stored in the buf that is
|
* given in the 'ai' argument. The result will be stored in the buf that is
|
||||||
@ -388,6 +375,19 @@ Curl_fetch_addr(struct Curl_easy *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CURL_DISABLE_SHUFFLE_DNS
|
#ifndef CURL_DISABLE_SHUFFLE_DNS
|
||||||
|
/*
|
||||||
|
* Return # of addresses in a Curl_addrinfo struct
|
||||||
|
*/
|
||||||
|
static int num_addresses(const struct Curl_addrinfo *addr)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while(addr) {
|
||||||
|
addr = addr->ai_next;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
|
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
|
||||||
struct Curl_addrinfo **addr);
|
struct Curl_addrinfo **addr);
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -459,7 +459,7 @@ struct Curl_multi *curl_multi_init(void)
|
|||||||
CURL_DNS_HASH_SIZE);
|
CURL_DNS_HASH_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUGBUILD
|
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
|
||||||
static void multi_warn_debug(struct Curl_multi *multi, struct Curl_easy *data)
|
static void multi_warn_debug(struct Curl_multi *multi, struct Curl_easy *data)
|
||||||
{
|
{
|
||||||
if(!multi->warned) {
|
if(!multi->warned) {
|
||||||
|
|||||||
@ -1237,6 +1237,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||||||
data->set.out = va_arg(param, void *);
|
data->set.out = va_arg(param, void *);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef CURL_LIST_ONLY_PROTOCOL
|
||||||
case CURLOPT_DIRLISTONLY:
|
case CURLOPT_DIRLISTONLY:
|
||||||
/*
|
/*
|
||||||
* An option that changes the command to one that asks for a list only, no
|
* An option that changes the command to one that asks for a list only, no
|
||||||
@ -1244,7 +1245,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
|||||||
*/
|
*/
|
||||||
data->set.list_only = (0 != va_arg(param, long)) ? TRUE : FALSE;
|
data->set.list_only = (0 != va_arg(param, long)) ? TRUE : FALSE;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case CURLOPT_APPEND:
|
case CURLOPT_APPEND:
|
||||||
/*
|
/*
|
||||||
* We want to upload and append to an existing file. Used for FTP and
|
* We want to upload and append to an existing file. Used for FTP and
|
||||||
|
|||||||
@ -1335,7 +1335,9 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
data->state.prefer_ascii = data->set.prefer_ascii;
|
data->state.prefer_ascii = data->set.prefer_ascii;
|
||||||
|
#ifdef CURL_LIST_ONLY_PROTOCOL
|
||||||
data->state.list_only = data->set.list_only;
|
data->state.list_only = data->set.list_only;
|
||||||
|
#endif
|
||||||
data->state.httpreq = data->set.method;
|
data->state.httpreq = data->set.method;
|
||||||
data->state.url = data->set.str[STRING_SET_URL];
|
data->state.url = data->set.str[STRING_SET_URL];
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,12 @@ typedef unsigned int curl_prot_t;
|
|||||||
#define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
|
#define PROTO_FAMILY_SMTP (CURLPROTO_SMTP|CURLPROTO_SMTPS)
|
||||||
#define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP)
|
#define PROTO_FAMILY_SSH (CURLPROTO_SCP|CURLPROTO_SFTP)
|
||||||
|
|
||||||
|
#if !defined(CURL_DISABLE_FTP) || defined(USE_SSH) || \
|
||||||
|
!defined(CURL_DISABLE_POP3)
|
||||||
|
/* these protocols support CURLOPT_DIRLISTONLY */
|
||||||
|
#define CURL_LIST_ONLY_PROTOCOL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_CONNCACHE_SIZE 5
|
#define DEFAULT_CONNCACHE_SIZE 5
|
||||||
|
|
||||||
/* length of longest IPv6 address string including the trailing null */
|
/* length of longest IPv6 address string including the trailing null */
|
||||||
@ -702,7 +708,9 @@ struct SingleRequest {
|
|||||||
struct curltime last_sndbuf_update; /* last time readwrite_upload called
|
struct curltime last_sndbuf_update; /* last time readwrite_upload called
|
||||||
win_update_buffer_size */
|
win_update_buffer_size */
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef CURL_DISABLE_COOKIES
|
||||||
unsigned char setcookies;
|
unsigned char setcookies;
|
||||||
|
#endif
|
||||||
unsigned char writer_stack_depth; /* Unencoding stack depth. */
|
unsigned char writer_stack_depth; /* Unencoding stack depth. */
|
||||||
BIT(header); /* incoming data has HTTP header */
|
BIT(header); /* incoming data has HTTP header */
|
||||||
BIT(content_range); /* set TRUE if Content-Range: was found */
|
BIT(content_range); /* set TRUE if Content-Range: was found */
|
||||||
@ -1025,14 +1033,19 @@ struct connectdata {
|
|||||||
#ifndef CURL_DISABLE_SMB
|
#ifndef CURL_DISABLE_SMB
|
||||||
struct smb_conn smbc;
|
struct smb_conn smbc;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_LIBRTMP
|
||||||
void *rtmp;
|
void *rtmp;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_OPENLDAP
|
||||||
struct ldapconninfo *ldapc;
|
struct ldapconninfo *ldapc;
|
||||||
|
#endif
|
||||||
#ifndef CURL_DISABLE_MQTT
|
#ifndef CURL_DISABLE_MQTT
|
||||||
struct mqtt_conn mqtt;
|
struct mqtt_conn mqtt;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WEBSOCKETS
|
#ifdef USE_WEBSOCKETS
|
||||||
struct websocket *ws;
|
struct websocket *ws;
|
||||||
#endif
|
#endif
|
||||||
|
unsigned int unused:1; /* avoids empty union */
|
||||||
} proto;
|
} proto;
|
||||||
|
|
||||||
struct connectbundle *bundle; /* The bundle we are member of */
|
struct connectbundle *bundle; /* The bundle we are member of */
|
||||||
@ -1455,9 +1468,13 @@ struct UrlState {
|
|||||||
when multi_done() is called, to prevent multi_done() to get
|
when multi_done() is called, to prevent multi_done() to get
|
||||||
invoked twice when the multi interface is used. */
|
invoked twice when the multi interface is used. */
|
||||||
BIT(previouslypending); /* this transfer WAS in the multi->pending queue */
|
BIT(previouslypending); /* this transfer WAS in the multi->pending queue */
|
||||||
|
#ifndef CURL_DISABLE_COOKIES
|
||||||
BIT(cookie_engine);
|
BIT(cookie_engine);
|
||||||
|
#endif
|
||||||
BIT(prefer_ascii); /* ASCII rather than binary */
|
BIT(prefer_ascii); /* ASCII rather than binary */
|
||||||
|
#ifdef CURL_LIST_ONLY_PROTOCOL
|
||||||
BIT(list_only); /* list directory contents */
|
BIT(list_only); /* list directory contents */
|
||||||
|
#endif
|
||||||
BIT(url_alloc); /* URL string is malloc()'ed */
|
BIT(url_alloc); /* URL string is malloc()'ed */
|
||||||
BIT(referer_alloc); /* referer string is malloc()ed */
|
BIT(referer_alloc); /* referer string is malloc()ed */
|
||||||
BIT(wildcard_resolve); /* Set to true if any resolve change is a wildcard */
|
BIT(wildcard_resolve); /* Set to true if any resolve change is a wildcard */
|
||||||
@ -1805,7 +1822,9 @@ struct UserDefined {
|
|||||||
BIT(tftp_no_options); /* do not send TFTP options requests */
|
BIT(tftp_no_options); /* do not send TFTP options requests */
|
||||||
#endif
|
#endif
|
||||||
BIT(sep_headers); /* handle host and proxy headers separately */
|
BIT(sep_headers); /* handle host and proxy headers separately */
|
||||||
|
#ifndef CURL_DISABLE_COOKIES
|
||||||
BIT(cookiesession); /* new cookie session? */
|
BIT(cookiesession); /* new cookie session? */
|
||||||
|
#endif
|
||||||
BIT(crlf); /* convert crlf on ftp upload(?) */
|
BIT(crlf); /* convert crlf on ftp upload(?) */
|
||||||
BIT(ssh_compression); /* enable SSH compression */
|
BIT(ssh_compression); /* enable SSH compression */
|
||||||
|
|
||||||
@ -1820,7 +1839,9 @@ struct UserDefined {
|
|||||||
BIT(tunnel_thru_httpproxy); /* use CONNECT through an HTTP proxy */
|
BIT(tunnel_thru_httpproxy); /* use CONNECT through an HTTP proxy */
|
||||||
BIT(prefer_ascii); /* ASCII rather than binary */
|
BIT(prefer_ascii); /* ASCII rather than binary */
|
||||||
BIT(remote_append); /* append, not overwrite, on upload */
|
BIT(remote_append); /* append, not overwrite, on upload */
|
||||||
|
#ifdef CURL_LIST_ONLY_PROTOCOL
|
||||||
BIT(list_only); /* list directory */
|
BIT(list_only); /* list directory */
|
||||||
|
#endif
|
||||||
#ifndef CURL_DISABLE_FTP
|
#ifndef CURL_DISABLE_FTP
|
||||||
BIT(ftp_use_port); /* use the FTP PORT command */
|
BIT(ftp_use_port); /* use the FTP PORT command */
|
||||||
BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */
|
BIT(ftp_use_epsv); /* if EPSV is to be attempted or not */
|
||||||
|
|||||||
@ -883,6 +883,9 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
unsigned char *buf = NULL, *pem_ptr = NULL;
|
unsigned char *buf = NULL, *pem_ptr = NULL;
|
||||||
CURLcode result = CURLE_SSL_PINNEDPUBKEYNOTMATCH;
|
CURLcode result = CURLE_SSL_PINNEDPUBKEYNOTMATCH;
|
||||||
|
#ifdef CURL_DISABLE_VERBOSE_STRINGS
|
||||||
|
(void)data;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if a path wasn't specified, don't pin */
|
/* if a path wasn't specified, don't pin */
|
||||||
if(!pinnedpubkey)
|
if(!pinnedpubkey)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user