mirror of
https://github.com/curl/curl.git
synced 2026-07-27 06:37:16 +03:00
tidy-up: miscellaneous
- examples: sync debug output printf masks. - INSTALL-CMAKE.md: tidy up section for some options. - curl_sha512_256: delete comment suggesting an optimization. - vtls/keylog: scope a variable. - vtls/openssl: make a source code URL a permalink. - vtls/schannel: drop redundant parentheses. - test1119.pl: robustify `$1` -> `$s`. - sync arg names in comments to match the code. - tidy up and minor fixes to comments. - fix formatting/indenting/comment/newline/include nits. - move `UNITTEST` protos next to definitions, sync their argument names. - make variables static. - add parentheses to Perl `open()` calls. - drop unnecessary double quotes in Perl. - clang-format. Closes #21000
This commit is contained in:
parent
3512b673dd
commit
e0dd6eb4a4
148 changed files with 612 additions and 684 deletions
|
|
@ -208,7 +208,7 @@ static void async_ares_cleanup(struct Curl_resolv_async *async)
|
|||
}
|
||||
|
||||
void Curl_async_ares_shutdown(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async)
|
||||
struct Curl_resolv_async *async)
|
||||
{
|
||||
/* c-ares has a method to "cancel" operations on a channel, but
|
||||
* as reported in #18216, this does not totally reset the channel
|
||||
|
|
@ -330,10 +330,10 @@ static timediff_t async_ares_poll_timeout(struct async_ares_ctx *ares,
|
|||
int itimeout_ms;
|
||||
|
||||
#if TIMEDIFF_T_MAX > INT_MAX
|
||||
itimeout_ms = (timeout_ms > INT_MAX) ? INT_MAX :
|
||||
((timeout_ms < 0) ? -1 : (int)timeout_ms);
|
||||
itimeout_ms = (timeout_ms > INT_MAX) ? INT_MAX :
|
||||
((timeout_ms < 0) ? -1 : (int)timeout_ms);
|
||||
#else
|
||||
itimeout_ms = (int)timeout_ms;
|
||||
itimeout_ms = (int)timeout_ms;
|
||||
#endif
|
||||
max_timeout.tv_sec = itimeout_ms / 1000;
|
||||
max_timeout.tv_usec = (itimeout_ms % 1000) * 1000;
|
||||
|
|
@ -349,9 +349,10 @@ static timediff_t async_ares_poll_timeout(struct async_ares_ctx *ares,
|
|||
return 1000;
|
||||
}
|
||||
|
||||
static const struct Curl_addrinfo *
|
||||
async_ares_get_ai(const struct Curl_addrinfo *ai,
|
||||
int ai_family, unsigned int index)
|
||||
static const struct Curl_addrinfo *async_ares_get_ai(
|
||||
const struct Curl_addrinfo *ai,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
for(i = 0; ai; ai = ai->ai_next) {
|
||||
|
|
@ -364,10 +365,10 @@ async_ares_get_ai(const struct Curl_addrinfo *ai,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_async_get_ai(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
int ai_family, unsigned int index)
|
||||
const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
{
|
||||
struct async_ares_ctx *ares = &async->ares;
|
||||
|
||||
|
|
@ -388,9 +389,9 @@ Curl_async_get_ai(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
const struct Curl_https_rrinfo *
|
||||
Curl_async_get_https(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async)
|
||||
const struct Curl_https_rrinfo *Curl_async_get_https(
|
||||
struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async)
|
||||
{
|
||||
if(Curl_async_knows_https(data, async))
|
||||
return &async->ares.hinfo;
|
||||
|
|
@ -415,7 +416,7 @@ bool Curl_async_knows_https(struct Curl_easy *data,
|
|||
* Waits for a resolve to finish. This function should be avoided since using
|
||||
* this risk getting the multi interface to "hang".
|
||||
*
|
||||
* 'entry' MUST be non-NULL.
|
||||
* 'pdns' MUST be non-NULL.
|
||||
*
|
||||
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
|
||||
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
|
||||
|
|
@ -479,8 +480,8 @@ CURLcode Curl_async_await(struct Curl_easy *data, uint32_t resolv_id,
|
|||
* async_ares_node2addr() converts an address list provided by c-ares
|
||||
* to an internal libcurl compatible list.
|
||||
*/
|
||||
static struct Curl_addrinfo *
|
||||
async_ares_node2addr(struct ares_addrinfo_node *node)
|
||||
static struct Curl_addrinfo *async_ares_node2addr(
|
||||
struct ares_addrinfo_node *node)
|
||||
{
|
||||
/* traverse the ares_addrinfo_node list */
|
||||
struct ares_addrinfo_node *ai;
|
||||
|
|
|
|||
|
|
@ -135,11 +135,11 @@ static void async_thrdd_item_destroy(struct async_thrdd_item *item)
|
|||
}
|
||||
|
||||
/* Initialize context for threaded resolver */
|
||||
static struct async_thrdd_item *
|
||||
async_thrdd_item_create(struct Curl_easy *data,
|
||||
uint32_t resolv_id, uint8_t dns_queries,
|
||||
const char *hostname, uint16_t port,
|
||||
uint8_t transport)
|
||||
static struct async_thrdd_item *async_thrdd_item_create(
|
||||
struct Curl_easy *data,
|
||||
uint32_t resolv_id, uint8_t dns_queries,
|
||||
const char *hostname, uint16_t port,
|
||||
uint8_t transport)
|
||||
{
|
||||
size_t hostlen = strlen(hostname);
|
||||
struct async_thrdd_item *item;
|
||||
|
|
@ -252,7 +252,7 @@ static CURLcode async_rr_start(struct Curl_easy *data,
|
|||
#endif
|
||||
|
||||
void Curl_async_thrdd_shutdown(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async)
|
||||
struct Curl_resolv_async *async)
|
||||
{
|
||||
Curl_async_thrdd_destroy(data, async);
|
||||
}
|
||||
|
|
@ -389,13 +389,13 @@ static void async_thrdd_item_process(void *item)
|
|||
struct async_thrdd_item *item = arg;
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
if(item->delay_ms) {
|
||||
curlx_wait_ms(item->delay_ms);
|
||||
}
|
||||
if(item->delay_fail_ms) {
|
||||
curlx_wait_ms(item->delay_fail_ms);
|
||||
return;
|
||||
}
|
||||
if(item->delay_ms) {
|
||||
curlx_wait_ms(item->delay_ms);
|
||||
}
|
||||
if(item->delay_fail_ms) {
|
||||
curlx_wait_ms(item->delay_fail_ms);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
item->res = Curl_ipv4_resolve_r(item->hostname, item->port);
|
||||
if(!item->res) {
|
||||
|
|
@ -496,10 +496,9 @@ static void async_thrdd_report_item(struct Curl_easy *data,
|
|||
}
|
||||
}
|
||||
|
||||
infof(data, "Host %s:%u resolved IPv%c: %s",
|
||||
item->hostname, item->port,
|
||||
(item->dns_queries & CURL_DNSQ_AAAA) ? '6' : '4',
|
||||
(curlx_dyn_len(&tmp) ? curlx_dyn_ptr(&tmp) : "(none)"));
|
||||
infof(data, "Host %s:%u resolved IPv%c: %s", item->hostname, item->port,
|
||||
(item->dns_queries & CURL_DNSQ_AAAA) ? '6' : '4',
|
||||
(curlx_dyn_len(&tmp) ? curlx_dyn_ptr(&tmp) : "(none)"));
|
||||
out:
|
||||
curlx_dyn_free(&tmp);
|
||||
}
|
||||
|
|
@ -758,9 +757,9 @@ out:
|
|||
return result;
|
||||
}
|
||||
|
||||
static const struct Curl_addrinfo *
|
||||
async_thrdd_get_ai(const struct Curl_addrinfo *ai,
|
||||
int ai_family, unsigned int index)
|
||||
static const struct Curl_addrinfo *async_thrdd_get_ai(
|
||||
const struct Curl_addrinfo *ai,
|
||||
int ai_family, unsigned int index)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
for(i = 0; ai; ai = ai->ai_next) {
|
||||
|
|
@ -773,10 +772,10 @@ async_thrdd_get_ai(const struct Curl_addrinfo *ai,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_async_get_ai(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
int ai_family, unsigned int index)
|
||||
const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
{
|
||||
struct async_thrdd_ctx *thrdd = &async->thrdd;
|
||||
|
||||
|
|
@ -797,9 +796,9 @@ Curl_async_get_ai(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
const struct Curl_https_rrinfo *
|
||||
Curl_async_get_https(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async)
|
||||
const struct Curl_https_rrinfo *Curl_async_get_https(
|
||||
struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async)
|
||||
{
|
||||
#ifdef USE_HTTPSRR_ARES
|
||||
if(Curl_async_knows_https(data, async))
|
||||
|
|
|
|||
24
lib/asyn.h
24
lib/asyn.h
|
|
@ -82,15 +82,15 @@ void Curl_async_global_cleanup(void);
|
|||
CURLcode Curl_async_getaddrinfo(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_async_get_ai(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
int ai_family, unsigned int index);
|
||||
const struct Curl_addrinfo *Curl_async_get_ai(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async,
|
||||
int ai_family,
|
||||
unsigned int index);
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
const struct Curl_https_rrinfo *
|
||||
Curl_async_get_https(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
const struct Curl_https_rrinfo *Curl_async_get_https(
|
||||
struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
bool Curl_async_knows_https(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
#endif /* USE_HTTPSRR */
|
||||
|
|
@ -125,7 +125,7 @@ struct async_ares_ctx {
|
|||
};
|
||||
|
||||
void Curl_async_ares_shutdown(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
struct Curl_resolv_async *async);
|
||||
void Curl_async_ares_destroy(struct Curl_easy *data,
|
||||
struct Curl_resolv_async *async);
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ struct doh_probes;
|
|||
* Waits for a resolve to finish. This function should be avoided since using
|
||||
* this risk getting the multi interface to "hang".
|
||||
*
|
||||
* On return 'entry' is assigned the resolved dns (CURLE_OK or NULL otherwise.
|
||||
* On return 'dns' is assigned the resolved dns (CURLE_OK or NULL otherwise.
|
||||
*
|
||||
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
|
||||
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
|
||||
|
|
@ -210,8 +210,8 @@ CURLcode Curl_async_pollset(struct Curl_easy *data,
|
|||
/* convert these functions if an asynch resolver is not used */
|
||||
#define Curl_async_global_init() CURLE_OK
|
||||
#define Curl_async_global_cleanup() Curl_nop_stmt
|
||||
#define Curl_async_get_ai(a,b,c,d) NULL
|
||||
#define Curl_async_await(a,b,c) CURLE_COULDNT_RESOLVE_HOST
|
||||
#define Curl_async_get_ai(a, b, c, d) NULL
|
||||
#define Curl_async_await(a, b, c) CURLE_COULDNT_RESOLVE_HOST
|
||||
#define Curl_async_take_result(x, y, z) CURLE_COULDNT_RESOLVE_HOST
|
||||
#define Curl_async_pollset(x, y, z) CURLE_OK
|
||||
#endif /* !CURLRES_ASYNCH */
|
||||
|
|
@ -263,7 +263,7 @@ void Curl_async_destroy(struct Curl_easy *data,
|
|||
struct Curl_resolv_async *async);
|
||||
|
||||
#else /* !USE_CURL_ASYNC */
|
||||
#define Curl_async_shutdown(x,y) Curl_nop_stmt
|
||||
#define Curl_async_shutdown(x, y) Curl_nop_stmt
|
||||
#endif /* USE_CURL_ASYNC */
|
||||
|
||||
/********** end of generic resolver interface functions *****************/
|
||||
|
|
|
|||
44
lib/cf-dns.c
44
lib/cf-dns.c
|
|
@ -47,11 +47,12 @@ struct cf_dns_ctx {
|
|||
char hostname[1];
|
||||
};
|
||||
|
||||
static struct cf_dns_ctx *
|
||||
cf_dns_ctx_create(struct Curl_easy *data, uint8_t dns_queries,
|
||||
const char *hostname, uint16_t port, uint8_t transport,
|
||||
bool abstract_unix_socket,
|
||||
struct Curl_dns_entry *dns)
|
||||
static struct cf_dns_ctx *cf_dns_ctx_create(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
const char *hostname,
|
||||
uint16_t port, uint8_t transport,
|
||||
bool abstract_unix_socket,
|
||||
struct Curl_dns_entry *dns)
|
||||
{
|
||||
struct cf_dns_ctx *ctx;
|
||||
size_t hlen = strlen(hostname);
|
||||
|
|
@ -399,7 +400,7 @@ static CURLcode cf_dns_conn_create(struct Curl_cfilter **pcf,
|
|||
* there, thus overriding any defaults that might have been set above. */
|
||||
hostname = ehost->name;
|
||||
port = conn->bits.conn_to_port ?
|
||||
conn->conn_to_port : (uint16_t)conn->remote_port;
|
||||
conn->conn_to_port : (uint16_t)conn->remote_port;
|
||||
}
|
||||
|
||||
if(!hostname) {
|
||||
|
|
@ -500,9 +501,10 @@ CURLcode Curl_conn_dns_result(struct connectdata *conn, int sockindex)
|
|||
return Curl_cf_dns_result(conn->cfilter[sockindex]);
|
||||
}
|
||||
|
||||
static const struct Curl_addrinfo *
|
||||
cf_dns_get_nth_ai(struct Curl_cfilter *cf, const struct Curl_addrinfo *ai,
|
||||
int ai_family, unsigned int index)
|
||||
static const struct Curl_addrinfo *cf_dns_get_nth_ai(
|
||||
struct Curl_cfilter *cf,
|
||||
const struct Curl_addrinfo *ai,
|
||||
int ai_family, unsigned int index)
|
||||
{
|
||||
struct cf_dns_ctx *ctx = cf->ctx;
|
||||
unsigned int i = 0;
|
||||
|
|
@ -551,11 +553,10 @@ bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex)
|
|||
* first "resolve" filter underneath `cf`. If the DNS resolving is
|
||||
* not done yet or if no address for the family exists, returns NULL.
|
||||
*/
|
||||
const struct Curl_addrinfo *
|
||||
Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
const struct Curl_addrinfo *Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
{
|
||||
(void)data;
|
||||
for(; cf; cf = cf->next) {
|
||||
|
|
@ -576,15 +577,12 @@ Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
|
|||
* first "resolve" filter at the connection. If the DNS resolving is
|
||||
* not done yet or if no address for the family exists, returns NULL.
|
||||
*/
|
||||
const struct Curl_addrinfo *
|
||||
Curl_conn_dns_get_ai(struct Curl_easy *data,
|
||||
int sockindex,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
const struct Curl_addrinfo *Curl_conn_dns_get_ai(struct Curl_easy *data,
|
||||
int sockindex, int ai_family,
|
||||
unsigned int index)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
return Curl_cf_dns_get_ai(conn->cfilter[sockindex], data,
|
||||
ai_family, index);
|
||||
return Curl_cf_dns_get_ai(conn->cfilter[sockindex], data, ai_family, index);
|
||||
}
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
|
|
@ -592,8 +590,8 @@ Curl_conn_dns_get_ai(struct Curl_easy *data,
|
|||
* connection. If the DNS resolving is not done yet or if there
|
||||
* is no HTTPS-RR info, returns NULL.
|
||||
*/
|
||||
const struct Curl_https_rrinfo *
|
||||
Curl_conn_dns_get_https(struct Curl_easy *data, int sockindex)
|
||||
const struct Curl_https_rrinfo *Curl_conn_dns_get_https(struct Curl_easy *data,
|
||||
int sockindex)
|
||||
{
|
||||
struct Curl_cfilter *cf = data->conn->cfilter[sockindex];
|
||||
for(; cf; cf = cf->next) {
|
||||
|
|
|
|||
27
lib/cf-dns.h
27
lib/cf-dns.h
|
|
@ -51,28 +51,25 @@ CURLcode Curl_cf_dns_result(struct Curl_cfilter *cf);
|
|||
* `Curl_conn_dns_get_ai()`. */
|
||||
bool Curl_conn_dns_has_any_ai(struct Curl_easy *data, int sockindex);
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_conn_dns_get_ai(struct Curl_easy *data,
|
||||
int sockindex,
|
||||
int ai_family,
|
||||
unsigned int index);
|
||||
const struct Curl_addrinfo *Curl_conn_dns_get_ai(struct Curl_easy *data,
|
||||
int sockindex,
|
||||
int ai_family,
|
||||
unsigned int index);
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
int ai_family,
|
||||
unsigned int index);
|
||||
const struct Curl_addrinfo *Curl_cf_dns_get_ai(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
int ai_family,
|
||||
unsigned int index);
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
const struct Curl_https_rrinfo *
|
||||
Curl_conn_dns_get_https(struct Curl_easy *data, int sockindex);
|
||||
const struct Curl_https_rrinfo *Curl_conn_dns_get_https(struct Curl_easy *data,
|
||||
int sockindex);
|
||||
bool Curl_conn_dns_resolved_https(struct Curl_easy *data, int sockindex);
|
||||
#else
|
||||
#define Curl_conn_dns_get_https(a,b) NULL
|
||||
#define Curl_conn_dns_resolved_https(a,b) TRUE
|
||||
#define Curl_conn_dns_get_https(a, b) NULL
|
||||
#define Curl_conn_dns_resolved_https(a, b) TRUE
|
||||
#endif
|
||||
|
||||
|
||||
extern struct Curl_cftype Curl_cft_dns;
|
||||
|
||||
#endif /* HEADER_CURL_CF_DNS_H */
|
||||
|
|
|
|||
|
|
@ -685,15 +685,16 @@ static int proxy_h2_on_stream_close(nghttp2_session *session,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static CURLcode proxy_h2_submit(int32_t *pstream_id,
|
||||
struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
nghttp2_session *h2,
|
||||
struct httpreq *req,
|
||||
const nghttp2_priority_spec *pri_spec,
|
||||
void *stream_user_data,
|
||||
nghttp2_data_source_read_callback read_callback,
|
||||
void *read_ctx)
|
||||
static CURLcode proxy_h2_submit(
|
||||
int32_t *pstream_id,
|
||||
struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
nghttp2_session *h2,
|
||||
struct httpreq *req,
|
||||
const nghttp2_priority_spec *pri_spec,
|
||||
void *stream_user_data,
|
||||
nghttp2_data_source_read_callback read_callback,
|
||||
void *read_ctx)
|
||||
{
|
||||
struct dynhds h2_headers;
|
||||
nghttp2_nv *nva = NULL;
|
||||
|
|
|
|||
|
|
@ -123,9 +123,8 @@ static void cf_ai_iter_init(struct cf_ai_iter *iter,
|
|||
iter->n = 0;
|
||||
}
|
||||
|
||||
static const struct Curl_addrinfo *
|
||||
cf_ai_iter_next(struct cf_ai_iter *iter,
|
||||
struct Curl_easy *data)
|
||||
static const struct Curl_addrinfo *cf_ai_iter_next(struct cf_ai_iter *iter,
|
||||
struct Curl_easy *data)
|
||||
{
|
||||
const struct Curl_addrinfo *addr;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,9 +100,9 @@ static void tcpnodelay(struct Curl_cfilter *cf,
|
|||
defined(TCP_KEEPALIVE) || defined(TCP_KEEPALIVE_THRESHOLD) || \
|
||||
defined(TCP_KEEPINTVL) || defined(TCP_KEEPALIVE_ABORT_THRESHOLD)
|
||||
#if defined(USE_WINSOCK) || \
|
||||
(defined(__sun) && !defined(TCP_KEEPIDLE)) || \
|
||||
(defined(__DragonFly__) && __DragonFly_version < 500702) || \
|
||||
(defined(_WIN32) && !defined(TCP_KEEPIDLE))
|
||||
(defined(__sun) && !defined(TCP_KEEPIDLE)) || \
|
||||
(defined(__DragonFly__) && __DragonFly_version < 500702) || \
|
||||
(defined(_WIN32) && !defined(TCP_KEEPIDLE))
|
||||
/* Solaris < 11.4, DragonFlyBSD < 500702 and Windows < 10.0.16299
|
||||
* use millisecond units. */
|
||||
#define KEEPALIVE_FACTOR(x) ((x) *= 1000)
|
||||
|
|
@ -638,7 +638,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn,
|
|||
* to take a type parameter instead.
|
||||
*/
|
||||
uint8_t dns_queries = (af == AF_INET) ?
|
||||
CURL_DNSQ_A : (CURL_DNSQ_A|CURL_DNSQ_AAAA);
|
||||
CURL_DNSQ_A : (CURL_DNSQ_A | CURL_DNSQ_AAAA);
|
||||
#ifdef USE_IPV6
|
||||
if(af == AF_INET6)
|
||||
dns_queries = CURL_DNSQ_AAAA;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#pragma enum(int)
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Global configuration parameters: normally generated by autoconf. */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@
|
|||
|
||||
/* Default define to enable threaded asynchronous DNS lookups. */
|
||||
#if !defined(USE_SYNC_DNS) && !defined(USE_ARES) && \
|
||||
!defined(USE_RESOLV_THREADED)
|
||||
!defined(USE_RESOLV_THREADED)
|
||||
# define USE_RESOLV_THREADED 1
|
||||
#endif
|
||||
|
||||
|
|
@ -275,7 +275,7 @@
|
|||
/* ---------------------------------------------------------------- */
|
||||
|
||||
#ifndef CURL_WINDOWS_UWP
|
||||
#define HAVE_LDAP_SSL 1
|
||||
#define HAVE_LDAP_SSL 1
|
||||
#define USE_WIN32_LDAP 1
|
||||
|
||||
/* Define to use the Windows crypto library. */
|
||||
|
|
|
|||
44
lib/cookie.c
44
lib/cookie.c
|
|
@ -423,18 +423,17 @@ static CURLcode storecookie(struct Cookie *co, struct Curl_str *cp,
|
|||
|
||||
/* this function return errors on OOM etc, not on plain cookie format
|
||||
problems */
|
||||
static CURLcode
|
||||
parse_cookie_header(struct Curl_easy *data,
|
||||
struct Cookie *co,
|
||||
struct CookieInfo *ci,
|
||||
bool *okay, /* if the cookie was fine */
|
||||
const char *ptr,
|
||||
const char *domain, /* default domain */
|
||||
const char *path, /* full path used when this cookie is
|
||||
set, used to get default path for
|
||||
the cookie unless set */
|
||||
bool secure) /* TRUE if connection is over secure
|
||||
origin */
|
||||
static CURLcode parse_cookie_header(
|
||||
struct Curl_easy *data,
|
||||
struct Cookie *co,
|
||||
struct CookieInfo *ci,
|
||||
bool *okay, /* if the cookie was fine */
|
||||
const char *ptr,
|
||||
const char *domain, /* default domain */
|
||||
const char *path, /* full path used when this cookie is
|
||||
set, used to get default path for
|
||||
the cookie unless set */
|
||||
bool secure) /* TRUE if connection is over secure origin */
|
||||
{
|
||||
/* This line was read off an HTTP-header */
|
||||
time_t now = 0;
|
||||
|
|
@ -930,17 +929,16 @@ static bool replace_existing(struct Curl_easy *data,
|
|||
* IPv6 address.
|
||||
*
|
||||
*/
|
||||
CURLcode
|
||||
Curl_cookie_add(struct Curl_easy *data,
|
||||
struct CookieInfo *ci,
|
||||
bool httpheader, /* TRUE if HTTP header-style line */
|
||||
bool noexpire, /* if TRUE, skip remove_expired() */
|
||||
const char *lineptr, /* first character of the line */
|
||||
const char *domain, /* default domain */
|
||||
const char *path, /* full path used when this cookie is set,
|
||||
used to get default path for the cookie
|
||||
unless set */
|
||||
bool secure) /* TRUE if connection is over secure origin */
|
||||
CURLcode Curl_cookie_add(
|
||||
struct Curl_easy *data,
|
||||
struct CookieInfo *ci,
|
||||
bool httpheader, /* TRUE if HTTP header-style line */
|
||||
bool noexpire, /* if TRUE, skip remove_expired() */
|
||||
const char *lineptr, /* first character of the line */
|
||||
const char *domain, /* default domain */
|
||||
const char *path, /* full path used when this cookie is set, used
|
||||
to get default path for the cookie unless set */
|
||||
bool secure) /* TRUE if connection is over secure origin */
|
||||
{
|
||||
struct Cookie comem;
|
||||
struct Cookie *co;
|
||||
|
|
|
|||
|
|
@ -125,11 +125,11 @@ void Curl_cookie_clearall(struct CookieInfo *ci);
|
|||
void Curl_cookie_clearsess(struct CookieInfo *ci);
|
||||
|
||||
#if defined(CURL_DISABLE_HTTP) || defined(CURL_DISABLE_COOKIES)
|
||||
#define Curl_cookie_list(x) NULL
|
||||
#define Curl_cookie_list(x) NULL
|
||||
#define Curl_cookie_loadfiles(x) CURLE_OK
|
||||
#define Curl_cookie_init() NULL
|
||||
#define Curl_cookie_run(x) Curl_nop_stmt
|
||||
#define Curl_cookie_cleanup(x) Curl_nop_stmt
|
||||
#define Curl_cookie_init() NULL
|
||||
#define Curl_cookie_run(x) Curl_nop_stmt
|
||||
#define Curl_cookie_cleanup(x) Curl_nop_stmt
|
||||
#define Curl_flush_cookies(x, y) Curl_nop_stmt
|
||||
#else
|
||||
void Curl_flush_cookies(struct Curl_easy *data, bool cleanup);
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@
|
|||
#define ISDIGIT(x) (((x) >= '0') && ((x) <= '9'))
|
||||
#define ISBLANK(x) (((x) == ' ') || ((x) == '\t'))
|
||||
#define ISSPACE(x) (ISBLANK(x) || (((x) >= 0xa) && ((x) <= 0x0d)))
|
||||
#define ISURLPUNTCS(x) (((x) == '-') || ((x) == '.') || ((x) == '_') || \
|
||||
((x) == '~'))
|
||||
#define ISURLPUNTCS(x) \
|
||||
(((x) == '-') || ((x) == '.') || ((x) == '_') || ((x) == '~'))
|
||||
#define ISUNRESERVED(x) (ISALNUM(x) || ISURLPUNTCS(x))
|
||||
#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
|
||||
#define ISNEWLINE(x) (((x) == '\n') || (x) == '\r')
|
||||
|
||||
#endif /* HEADER_CURL_CTYPE_H */
|
||||
|
|
|
|||
|
|
@ -93,20 +93,20 @@ struct stub_gss_ctx_id_t_desc {
|
|||
char creds[250];
|
||||
};
|
||||
|
||||
static OM_uint32
|
||||
stub_gss_init_sec_context(OM_uint32 *min,
|
||||
gss_cred_id_t initiator_cred_handle,
|
||||
struct stub_gss_ctx_id_t_desc **context,
|
||||
gss_name_t target_name,
|
||||
const gss_OID mech_type,
|
||||
OM_uint32 req_flags,
|
||||
OM_uint32 time_req,
|
||||
const gss_channel_bindings_t input_chan_bindings,
|
||||
gss_buffer_desc *input_token,
|
||||
gss_OID *actual_mech_type,
|
||||
gss_buffer_desc *output_token,
|
||||
OM_uint32 *ret_flags,
|
||||
OM_uint32 *time_rec)
|
||||
static OM_uint32 stub_gss_init_sec_context(
|
||||
OM_uint32 *min,
|
||||
gss_cred_id_t initiator_cred_handle,
|
||||
struct stub_gss_ctx_id_t_desc **context,
|
||||
gss_name_t target_name,
|
||||
const gss_OID mech_type,
|
||||
OM_uint32 req_flags,
|
||||
OM_uint32 time_req,
|
||||
const gss_channel_bindings_t input_chan_bindings,
|
||||
gss_buffer_desc *input_token,
|
||||
gss_OID *actual_mech_type,
|
||||
gss_buffer_desc *output_token,
|
||||
OM_uint32 *ret_flags,
|
||||
OM_uint32 *time_rec)
|
||||
{
|
||||
struct stub_gss_ctx_id_t_desc *ctx = NULL;
|
||||
|
||||
|
|
@ -283,10 +283,10 @@ stub_gss_init_sec_context(OM_uint32 *min,
|
|||
return GSS_S_CONTINUE_NEEDED;
|
||||
}
|
||||
|
||||
static OM_uint32
|
||||
stub_gss_delete_sec_context(OM_uint32 *min,
|
||||
struct stub_gss_ctx_id_t_desc **context,
|
||||
gss_buffer_t output_token)
|
||||
static OM_uint32 stub_gss_delete_sec_context(
|
||||
OM_uint32 *min,
|
||||
struct stub_gss_ctx_id_t_desc **context,
|
||||
gss_buffer_t output_token)
|
||||
{
|
||||
(void)output_token;
|
||||
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ static void extend_key_56_to_64(const unsigned char *key_56, char *key)
|
|||
key[4] = (char)(((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4));
|
||||
key[5] = (char)(((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5));
|
||||
key[6] = (char)(((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6));
|
||||
key[7] = (char) ((key_56[6] << 1) & 0xFF);
|
||||
key[7] = (char)((key_56[6] << 1) & 0xFF);
|
||||
}
|
||||
|
||||
#ifdef USE_OPENSSL_DES
|
||||
|
|
|
|||
|
|
@ -365,16 +365,14 @@
|
|||
#endif
|
||||
|
||||
/* based on logic in "curl/mprintf.h" */
|
||||
#if (defined(__GNUC__) || defined(__clang__) || \
|
||||
defined(__IAR_SYSTEMS_ICC__)) && \
|
||||
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
|
||||
#if (defined(__GNUC__) || defined(__clang__) || \
|
||||
defined(__IAR_SYSTEMS_ICC__)) && \
|
||||
defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
|
||||
!defined(CURL_NO_FMT_CHECKS)
|
||||
#if defined(__MINGW32__) && !defined(__clang__)
|
||||
#define CURL_PRINTF(fmt, arg) \
|
||||
__attribute__((format(gnu_printf, fmt, arg)))
|
||||
#define CURL_PRINTF(fmt, arg) __attribute__((format(gnu_printf, fmt, arg)))
|
||||
#else
|
||||
#define CURL_PRINTF(fmt, arg) \
|
||||
__attribute__((format(__printf__, fmt, arg)))
|
||||
#define CURL_PRINTF(fmt, arg) __attribute__((format(__printf__, fmt, arg)))
|
||||
#endif
|
||||
#else
|
||||
#define CURL_PRINTF(fmt, arg)
|
||||
|
|
@ -392,7 +390,7 @@
|
|||
(defined(__GNUC__) && __GNUC__ <= 14)) && \
|
||||
defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
||||
!defined(__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__)
|
||||
#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \
|
||||
#define __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ \
|
||||
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||
#endif
|
||||
|
||||
|
|
@ -733,8 +731,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(USE_GNUTLS) || defined(USE_OPENSSL) || defined(USE_MBEDTLS) || \
|
||||
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || \
|
||||
defined(USE_RUSTLS)
|
||||
defined(USE_WOLFSSL) || defined(USE_SCHANNEL) || defined(USE_RUSTLS)
|
||||
#define USE_SSL /* SSL support has been enabled */
|
||||
#endif
|
||||
|
||||
|
|
@ -750,23 +747,23 @@
|
|||
#endif
|
||||
|
||||
/* Single point where USE_SPNEGO definition might be defined */
|
||||
#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \
|
||||
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
|
||||
#if !defined(CURL_DISABLE_NEGOTIATE_AUTH) && \
|
||||
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
|
||||
#define USE_SPNEGO
|
||||
#endif
|
||||
|
||||
/* Single point where USE_KERBEROS5 definition might be defined */
|
||||
#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \
|
||||
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
|
||||
#if !defined(CURL_DISABLE_KERBEROS_AUTH) && \
|
||||
(defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI))
|
||||
#define USE_KERBEROS5
|
||||
#endif
|
||||
|
||||
/* Single point where USE_NTLM definition might be defined */
|
||||
#ifdef CURL_ENABLE_NTLM
|
||||
# if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \
|
||||
defined(USE_GNUTLS) || \
|
||||
(defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \
|
||||
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
|
||||
# if (defined(USE_OPENSSL) && defined(HAVE_DES_ECB_ENCRYPT)) || \
|
||||
defined(USE_GNUTLS) || \
|
||||
(defined(USE_MBEDTLS) && defined(HAVE_MBEDTLS_DES_CRYPT_ECB)) || \
|
||||
defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) || \
|
||||
(defined(USE_WOLFSSL) && defined(HAVE_WC_DES_ECBENCRYPT))
|
||||
# define USE_CURL_NTLM_CORE
|
||||
# endif
|
||||
|
|
@ -819,8 +816,8 @@
|
|||
/* fallthrough attribute */
|
||||
|
||||
#ifndef FALLTHROUGH
|
||||
#if (defined(__GNUC__) && __GNUC__ >= 7) || \
|
||||
(defined(__clang__) && __clang_major__ >= 10)
|
||||
#if (defined(__GNUC__) && __GNUC__ >= 7) || \
|
||||
(defined(__clang__) && __clang_major__ >= 10)
|
||||
# define FALLTHROUGH() __attribute__((fallthrough))
|
||||
#else
|
||||
# define FALLTHROUGH() do {} while(0)
|
||||
|
|
@ -1015,7 +1012,7 @@ struct timeval {
|
|||
* 'bool' stuff compatible with HP-UX headers.
|
||||
*/
|
||||
#if defined(__hpux) && !defined(HAVE_BOOL_T)
|
||||
typedef int bool;
|
||||
typedef int bool;
|
||||
# define false 0
|
||||
# define true 1
|
||||
# define HAVE_BOOL_T
|
||||
|
|
@ -1028,10 +1025,10 @@ struct timeval {
|
|||
* global namespace though, so use bool_false and bool_true.
|
||||
*/
|
||||
#ifndef HAVE_BOOL_T
|
||||
typedef enum {
|
||||
bool_false = 0,
|
||||
bool_true = 1
|
||||
} bool;
|
||||
typedef enum {
|
||||
bool_false = 0,
|
||||
bool_true = 1
|
||||
} bool;
|
||||
|
||||
/*
|
||||
* Use a define to let 'true' and 'false' use those enums. There
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ static CURLcode Curl_sha512_256_update(void *ctx,
|
|||
size_t length)
|
||||
{
|
||||
do {
|
||||
word32 ilen = (word32) CURLMIN(length, UINT_MAX);
|
||||
word32 ilen = (word32)CURLMIN(length, UINT_MAX);
|
||||
if(wc_Sha512_256Update(ctx, data, ilen))
|
||||
return CURLE_SSL_CIPHER;
|
||||
length -= ilen;
|
||||
|
|
@ -291,10 +291,7 @@ static CURLcode Curl_sha512_256_finish(unsigned char *digest, void *context)
|
|||
/* ** This implementation of SHA-512/256 hash calculation was originally ** *
|
||||
* ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** *
|
||||
* ** The author ported the code to libcurl. The ported code is provided ** *
|
||||
* ** under curl license. ** *
|
||||
* ** This is a minimal version with minimal optimizations. Performance ** *
|
||||
* ** can be significantly improved. Big-endian store and load macros ** *
|
||||
* ** are obvious targets for optimization. ** */
|
||||
* ** under curl license. ** */
|
||||
|
||||
#ifdef __GNUC__
|
||||
# if defined(__has_attribute) && defined(__STDC_VERSION__)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ static void *curl_thread_create_thunk(void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T
|
||||
(CURL_STDCALL *func) (void *), void *arg)
|
||||
curl_thread_t Curl_thread_create(
|
||||
CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg)
|
||||
{
|
||||
curl_thread_t t = curlx_malloc(sizeof(pthread_t));
|
||||
struct Curl_actual_call *ac = NULL;
|
||||
|
|
@ -97,8 +97,8 @@ int Curl_thread_join(curl_thread_t *hnd)
|
|||
|
||||
#elif defined(_WIN32)
|
||||
|
||||
curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T
|
||||
(CURL_STDCALL *func) (void *), void *arg)
|
||||
curl_thread_t Curl_thread_create(
|
||||
CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg)
|
||||
{
|
||||
curl_thread_t t = CreateThread(NULL, 0, func, arg, 0, NULL);
|
||||
if(!t) {
|
||||
|
|
@ -163,13 +163,13 @@ CURLcode Curl_cond_timedwait(pthread_cond_t *c, pthread_mutex_t *m,
|
|||
* that will be most likely in the past, as far as POSIX abstime is
|
||||
* concerned. */
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
struct timeval tv;
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
now.tv_sec = tv.tv_sec;
|
||||
now.tv_usec = (int)tv.tv_usec;
|
||||
struct timeval tv;
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
now.tv_sec = tv.tv_sec;
|
||||
now.tv_usec = (int)tv.tv_usec;
|
||||
#else
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
#endif
|
||||
|
||||
ts.tv_sec = now.tv_sec + (timeout_ms / 1000);
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ CURLcode Curl_cond_timedwait(curl_cond_t *c, curl_mutex_t *m,
|
|||
|
||||
#ifdef USE_THREADS
|
||||
|
||||
curl_thread_t Curl_thread_create(CURL_THREAD_RETURN_T
|
||||
(CURL_STDCALL *func) (void *), void *arg);
|
||||
curl_thread_t Curl_thread_create(
|
||||
CURL_THREAD_RETURN_T(CURL_STDCALL *func)(void *), void *arg);
|
||||
|
||||
void Curl_thread_destroy(curl_thread_t *hnd);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@
|
|||
#define DICT_DEFINE2 "/D:"
|
||||
#define DICT_DEFINE3 "/LOOKUP:"
|
||||
|
||||
|
||||
#define DYN_DICT_WORD 10000
|
||||
static char *unescape_word(const char *input)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -329,8 +329,6 @@ static int num_addresses(const struct Curl_addrinfo *addr)
|
|||
return i;
|
||||
}
|
||||
|
||||
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
|
||||
struct Curl_addrinfo **addr);
|
||||
/*
|
||||
* Curl_shuffle_addr() shuffles the order of addresses in a 'Curl_addrinfo'
|
||||
* struct by re-linking its linked list.
|
||||
|
|
@ -343,6 +341,8 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
|
|||
*
|
||||
* @unittest: 1608
|
||||
*/
|
||||
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
|
||||
struct Curl_addrinfo **addr);
|
||||
UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
|
||||
struct Curl_addrinfo **addr)
|
||||
{
|
||||
|
|
@ -407,15 +407,15 @@ static bool dnscache_ai_has_family(struct Curl_addrinfo *ai,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static struct Curl_dns_entry *
|
||||
dnscache_entry_create(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr1,
|
||||
struct Curl_addrinfo **paddr2,
|
||||
const char *hostname,
|
||||
size_t hostlen,
|
||||
uint16_t port,
|
||||
bool permanent)
|
||||
static struct Curl_dns_entry *dnscache_entry_create(
|
||||
struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr1,
|
||||
struct Curl_addrinfo **paddr2,
|
||||
const char *hostname,
|
||||
size_t hostlen,
|
||||
uint16_t port,
|
||||
bool permanent)
|
||||
{
|
||||
struct Curl_dns_entry *dns = NULL;
|
||||
|
||||
|
|
@ -488,25 +488,23 @@ out:
|
|||
return dns;
|
||||
}
|
||||
|
||||
struct Curl_dns_entry *
|
||||
Curl_dnscache_mk_entry(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr,
|
||||
const char *hostname,
|
||||
uint16_t port)
|
||||
struct Curl_dns_entry *Curl_dnscache_mk_entry(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr,
|
||||
const char *hostname,
|
||||
uint16_t port)
|
||||
{
|
||||
return dnscache_entry_create(data, dns_queries, paddr, NULL, hostname,
|
||||
hostname ? strlen(hostname) : 0,
|
||||
port, FALSE);
|
||||
}
|
||||
|
||||
struct Curl_dns_entry *
|
||||
Curl_dnscache_mk_entry2(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr1,
|
||||
struct Curl_addrinfo **paddr2,
|
||||
const char *hostname,
|
||||
uint16_t port)
|
||||
struct Curl_dns_entry *Curl_dnscache_mk_entry2(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr1,
|
||||
struct Curl_addrinfo **paddr2,
|
||||
const char *hostname,
|
||||
uint16_t port)
|
||||
{
|
||||
return dnscache_entry_create(data, dns_queries, paddr1, paddr2, hostname,
|
||||
hostname ? strlen(hostname) : 0,
|
||||
|
|
@ -530,15 +528,14 @@ void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns,
|
|||
}
|
||||
#endif /* USE_HTTPSRR */
|
||||
|
||||
static struct Curl_dns_entry *
|
||||
dnscache_add_addr(struct Curl_easy *data,
|
||||
struct Curl_dnscache *dnscache,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr,
|
||||
const char *hostname,
|
||||
size_t hlen,
|
||||
uint16_t port,
|
||||
bool permanent)
|
||||
static struct Curl_dns_entry *dnscache_add_addr(struct Curl_easy *data,
|
||||
struct Curl_dnscache *dnscache,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr,
|
||||
const char *hostname,
|
||||
size_t hlen,
|
||||
uint16_t port,
|
||||
bool permanent)
|
||||
{
|
||||
char entry_id[MAX_HOSTCACHE_LEN];
|
||||
size_t entry_len;
|
||||
|
|
|
|||
|
|
@ -57,25 +57,23 @@ struct Curl_dns_entry {
|
|||
* Create a `Curl_dns_entry` with a reference count of 1.
|
||||
* Use `Curl_dns_entry_unlink()` to release your hold on it.
|
||||
*
|
||||
* The call takes ownership of `addr`, even in case of failure, and always
|
||||
* The call takes ownership of `paddr`, even in case of failure, and always
|
||||
* clears `*paddr`. It makes a copy of `hostname`.
|
||||
*
|
||||
* Returns entry or NULL on OOM.
|
||||
*/
|
||||
struct Curl_dns_entry *
|
||||
Curl_dnscache_mk_entry(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr,
|
||||
const char *hostname,
|
||||
uint16_t port);
|
||||
struct Curl_dns_entry *Curl_dnscache_mk_entry(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr,
|
||||
const char *hostname,
|
||||
uint16_t port);
|
||||
|
||||
struct Curl_dns_entry *
|
||||
Curl_dnscache_mk_entry2(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr1,
|
||||
struct Curl_addrinfo **paddr2,
|
||||
const char *hostname,
|
||||
uint16_t port);
|
||||
struct Curl_dns_entry *Curl_dnscache_mk_entry2(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
struct Curl_addrinfo **paddr1,
|
||||
struct Curl_addrinfo **paddr2,
|
||||
const char *hostname,
|
||||
uint16_t port);
|
||||
|
||||
#ifdef USE_HTTPSRR
|
||||
void Curl_dns_entry_set_https_rr(struct Curl_dns_entry *dns,
|
||||
|
|
@ -92,7 +90,6 @@ struct Curl_dns_entry *Curl_dns_entry_link(struct Curl_easy *data,
|
|||
void Curl_dns_entry_unlink(struct Curl_easy *data,
|
||||
struct Curl_dns_entry **pdns);
|
||||
|
||||
|
||||
struct Curl_dnscache {
|
||||
struct Curl_hash entries;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ static DOHcode doh_rdata(const unsigned char *doh,
|
|||
return DOH_OK;
|
||||
}
|
||||
|
||||
UNITTEST void de_init(struct dohentry *d);
|
||||
UNITTEST void de_init(struct dohentry *de);
|
||||
UNITTEST void de_init(struct dohentry *de)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -1117,11 +1117,10 @@ static CURLcode doh_decode_rdata_name(const unsigned char **buf,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/* @unittest 1658 */
|
||||
UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data,
|
||||
const unsigned char *cp, size_t len,
|
||||
struct Curl_https_rrinfo **hrr);
|
||||
|
||||
/* @unittest 1658 */
|
||||
UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data,
|
||||
const unsigned char *cp, size_t len,
|
||||
struct Curl_https_rrinfo **hrr)
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@
|
|||
__has_builtin() function, so override it. */
|
||||
|
||||
/* if GCC on i386/x86_64 or if the built-in is present */
|
||||
#if (defined(__GNUC__) && !defined(__clang__)) && \
|
||||
(defined(__i386__) || defined(__x86_64__))
|
||||
#if (defined(__GNUC__) && !defined(__clang__)) && \
|
||||
(defined(__i386__) || defined(__x86_64__))
|
||||
#define HAVE_BUILTIN_IA32_PAUSE
|
||||
#elif defined(__has_builtin) /* Keep this PP check separate from others */
|
||||
#if __has_builtin(__builtin_ia32_pause)
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
|
|||
}
|
||||
|
||||
/* Iterates over available options */
|
||||
const struct curl_easyoption *
|
||||
curl_easy_option_next(const struct curl_easyoption *prev)
|
||||
const struct curl_easyoption *curl_easy_option_next(
|
||||
const struct curl_easyoption *prev)
|
||||
{
|
||||
if(prev && prev->name) {
|
||||
prev++;
|
||||
|
|
@ -88,8 +88,8 @@ const struct curl_easyoption *curl_easy_option_by_id(CURLoption id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const struct curl_easyoption *
|
||||
curl_easy_option_next(const struct curl_easyoption *prev)
|
||||
const struct curl_easyoption *curl_easy_option_next(
|
||||
const struct curl_easyoption *prev)
|
||||
{
|
||||
(void)prev;
|
||||
return NULL;
|
||||
|
|
|
|||
33
lib/ftp.c
33
lib/ftp.c
|
|
@ -307,7 +307,7 @@ static CURLcode ftp_parse_url_path(struct Curl_easy *data,
|
|||
ftpc->file = fileName;
|
||||
else
|
||||
ftpc->file = NULL; /* instead of point to a zero byte,
|
||||
we make it a NULL pointer */
|
||||
we make it a NULL pointer */
|
||||
|
||||
if(data->state.upload && !ftpc->file && (ftp->transfer == PPTRANSFER_BODY)) {
|
||||
/* We need a filename when uploading. Return error! */
|
||||
|
|
@ -1686,17 +1686,17 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
|
|||
|
||||
if((data->state.resume_from && !sizechecked) ||
|
||||
((data->state.resume_from > 0) && sizechecked)) {
|
||||
/* we are about to continue the uploading of a file */
|
||||
/* 1. get already existing file's size. We use the SIZE command for this
|
||||
which may not exist in the server! The SIZE command is not in
|
||||
RFC959. */
|
||||
/* we are about to continue the uploading of a file
|
||||
1. get already existing file's size. We use the SIZE command for this
|
||||
which may not exist in the server! The SIZE command is not in
|
||||
RFC959.
|
||||
|
||||
/* 2. This used to set REST, but since we can do append, we issue no
|
||||
another ftp command. Skip the source file offset and APPEND the rest on
|
||||
the file instead */
|
||||
2. This used to set REST, but since we can do append, we issue no
|
||||
another ftp command. Skip the source file offset and APPEND the rest
|
||||
on the file instead
|
||||
|
||||
/* 3. pass file-size number of bytes in the source file */
|
||||
/* 4. lower the infilesize counter */
|
||||
3. pass file-size number of bytes in the source file
|
||||
4. lower the infilesize counter */
|
||||
/* => transfer as usual */
|
||||
int seekerr = CURL_SEEKFUNC_OK;
|
||||
|
||||
|
|
@ -2507,7 +2507,6 @@ static bool twodigit(const char *p, int *val)
|
|||
/*
|
||||
* Unittest @1668
|
||||
*/
|
||||
|
||||
UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day,
|
||||
int *hour, int *minute, int *second);
|
||||
UNITTEST bool ftp_213_date(const char *p, int *year, int *month, int *day,
|
||||
|
|
@ -3888,12 +3887,12 @@ static CURLcode ftp_nb_type(struct Curl_easy *data,
|
|||
* This is the actual DO function for FTP. Get a file/directory according to
|
||||
* the options previously setup.
|
||||
*/
|
||||
static
|
||||
CURLcode ftp_perform(struct Curl_easy *data,
|
||||
struct ftp_conn *ftpc,
|
||||
struct FTP *ftp,
|
||||
bool *connected, /* connect status after PASV / PORT */
|
||||
bool *dophase_done)
|
||||
static CURLcode ftp_perform(
|
||||
struct Curl_easy *data,
|
||||
struct ftp_conn *ftpc,
|
||||
struct FTP *ftp,
|
||||
bool *connected, /* connect status after PASV / PORT */
|
||||
bool *dophase_done)
|
||||
{
|
||||
/* this is FTP and no proxy */
|
||||
CURLcode result = CURLE_OK;
|
||||
|
|
|
|||
|
|
@ -325,8 +325,7 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data,
|
|||
|
||||
/* filter pattern-corresponding filenames */
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
if(compare(data->set.fnmatch_data, wc->pattern,
|
||||
finfo->filename) == 0) {
|
||||
if(compare(data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) {
|
||||
/* discard symlink which is containing multiple " -> " */
|
||||
if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target &&
|
||||
(strstr(finfo->strings.target, " -> "))) {
|
||||
|
|
|
|||
|
|
@ -359,8 +359,8 @@ void Curl_hash_start_iterate(struct Curl_hash *hash,
|
|||
#endif
|
||||
}
|
||||
|
||||
struct Curl_hash_element *
|
||||
Curl_hash_next_element(struct Curl_hash_iterator *iter)
|
||||
struct Curl_hash_element *Curl_hash_next_element(
|
||||
struct Curl_hash_iterator *iter)
|
||||
{
|
||||
struct Curl_hash *h;
|
||||
DEBUGASSERT(iter->init == ITERINIT);
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ size_t curlx_str_key_compare(void *k1, size_t key1_len, void *k2,
|
|||
size_t key2_len);
|
||||
void Curl_hash_start_iterate(struct Curl_hash *hash,
|
||||
struct Curl_hash_iterator *iter);
|
||||
struct Curl_hash_element *
|
||||
Curl_hash_next_element(struct Curl_hash_iterator *iter);
|
||||
struct Curl_hash_element *Curl_hash_next_element(
|
||||
struct Curl_hash_iterator *iter);
|
||||
|
||||
void Curl_hash_print(struct Curl_hash *h, void (*func)(void *));
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
***************************************************************************/
|
||||
#include "curl_setup.h"
|
||||
|
||||
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \
|
||||
!defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \
|
||||
#if (defined(USE_CURL_NTLM_CORE) && !defined(USE_WINDOWS_SSPI)) || \
|
||||
!defined(CURL_DISABLE_AWS) || !defined(CURL_DISABLE_DIGEST_AUTH) || \
|
||||
defined(USE_SSL)
|
||||
|
||||
#include "curl_hmac.h"
|
||||
|
|
@ -155,7 +155,7 @@ CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
|
|||
|
||||
/* Update the digest with the given challenge */
|
||||
do {
|
||||
unsigned int ilen = (unsigned int) CURLMIN(datalen, UINT_MAX);
|
||||
unsigned int ilen = (unsigned int)CURLMIN(datalen, UINT_MAX);
|
||||
Curl_HMAC_update(ctxt, data, ilen);
|
||||
datalen -= ilen;
|
||||
data += ilen;
|
||||
|
|
|
|||
46
lib/hostip.c
46
lib/hostip.c
|
|
@ -111,14 +111,6 @@
|
|||
* CURLRES_* defines based on the config*.h and curl_setup.h defines.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
* bufsize bytes big.
|
||||
*
|
||||
* If the conversion fails, the target buffer is empty.
|
||||
*/
|
||||
|
||||
uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version)
|
||||
{
|
||||
(void)data;
|
||||
|
|
@ -129,7 +121,7 @@ uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version)
|
|||
return CURL_DNSQ_A;
|
||||
default:
|
||||
if(Curl_ipv6works(data))
|
||||
return (CURL_DNSQ_A|CURL_DNSQ_AAAA);
|
||||
return (CURL_DNSQ_A | CURL_DNSQ_AAAA);
|
||||
else
|
||||
return CURL_DNSQ_A;
|
||||
}
|
||||
|
|
@ -139,15 +131,15 @@ uint8_t Curl_resolv_dns_queries(struct Curl_easy *data, uint8_t ip_version)
|
|||
const char *Curl_resolv_query_str(uint8_t dns_queries)
|
||||
{
|
||||
switch(dns_queries) {
|
||||
case (CURL_DNSQ_A|CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS):
|
||||
case (CURL_DNSQ_A | CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS):
|
||||
return "A+AAAA+HTTPS";
|
||||
case (CURL_DNSQ_A|CURL_DNSQ_AAAA):
|
||||
case (CURL_DNSQ_A | CURL_DNSQ_AAAA):
|
||||
return "A+AAAA";
|
||||
case (CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS):
|
||||
case (CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS):
|
||||
return "AAAA+HTTPS";
|
||||
case (CURL_DNSQ_AAAA):
|
||||
return "AAAA";
|
||||
case (CURL_DNSQ_A|CURL_DNSQ_HTTPS):
|
||||
case (CURL_DNSQ_A | CURL_DNSQ_HTTPS):
|
||||
return "A+HTTPS";
|
||||
case (CURL_DNSQ_A):
|
||||
return "A";
|
||||
|
|
@ -162,6 +154,13 @@ const char *Curl_resolv_query_str(uint8_t dns_queries)
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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
|
||||
* bufsize bytes big.
|
||||
*
|
||||
* If the conversion fails, the target buffer is empty.
|
||||
*/
|
||||
void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf,
|
||||
size_t bufsize)
|
||||
{
|
||||
|
|
@ -360,13 +359,12 @@ CURLcode Curl_resolv_announce_start(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
#ifdef USE_CURL_ASYNC
|
||||
static struct Curl_resolv_async *
|
||||
hostip_async_new(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
const char *hostname,
|
||||
uint16_t port,
|
||||
uint8_t transport,
|
||||
timediff_t timeout_ms)
|
||||
static struct Curl_resolv_async *hostip_async_new(struct Curl_easy *data,
|
||||
uint8_t dns_queries,
|
||||
const char *hostname,
|
||||
uint16_t port,
|
||||
uint8_t transport,
|
||||
timediff_t timeout_ms)
|
||||
{
|
||||
struct Curl_resolv_async *async;
|
||||
size_t hostlen = strlen(hostname);
|
||||
|
|
@ -442,9 +440,10 @@ static CURLcode hostip_resolv_take_result(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_resolv_get_ai(struct Curl_easy *data, uint32_t resolv_id,
|
||||
int ai_family, unsigned int index)
|
||||
const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data,
|
||||
uint32_t resolv_id,
|
||||
int ai_family,
|
||||
unsigned int index)
|
||||
{
|
||||
#ifdef CURLRES_ASYNCH
|
||||
struct Curl_resolv_async *async = Curl_async_get(data, resolv_id);
|
||||
|
|
@ -959,7 +958,6 @@ CURLcode Curl_resolv(struct Curl_easy *data,
|
|||
timeout_ms, TRUE, presolv_id, entry);
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_CURL_ASYNC
|
||||
|
||||
struct Curl_resolv_async *Curl_async_get(struct Curl_easy *data,
|
||||
|
|
|
|||
37
lib/hostip.h
37
lib/hostip.h
|
|
@ -51,8 +51,8 @@ struct Curl_dns_entry;
|
|||
#define CURL_DNSQ_AAAA (1U << 1)
|
||||
#define CURL_DNSQ_HTTPS (1U << 2)
|
||||
|
||||
#define CURL_DNSQ_ALL (CURL_DNSQ_A|CURL_DNSQ_AAAA|CURL_DNSQ_HTTPS)
|
||||
#define CURL_DNSQ_IP(x) (uint8_t)((x)&(CURL_DNSQ_A|CURL_DNSQ_AAAA))
|
||||
#define CURL_DNSQ_ALL (CURL_DNSQ_A | CURL_DNSQ_AAAA | CURL_DNSQ_HTTPS)
|
||||
#define CURL_DNSQ_IP(x) (uint8_t)((x)&(CURL_DNSQ_A | CURL_DNSQ_AAAA))
|
||||
|
||||
#ifdef CURLVERBOSE
|
||||
const char *Curl_resolv_query_str(uint8_t dns_queries);
|
||||
|
|
@ -88,10 +88,10 @@ struct Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, uint16_t port);
|
|||
|
||||
/*
|
||||
* Curl_printable_address() returns a printable version of the 1st address
|
||||
* given in the 'ip' 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
|
||||
* bufsize bytes big.
|
||||
*/
|
||||
void Curl_printable_address(const struct Curl_addrinfo *ip,
|
||||
void Curl_printable_address(const struct Curl_addrinfo *ai,
|
||||
char *buf, size_t bufsize);
|
||||
|
||||
/* Start DNS resolving for the given parameters. Returns
|
||||
|
|
@ -142,25 +142,26 @@ CURLcode Curl_resolv_take_result(struct Curl_easy *data, uint32_t resolv_id,
|
|||
|
||||
void Curl_resolv_destroy(struct Curl_easy *data, uint32_t resolv_id);
|
||||
|
||||
const struct Curl_addrinfo *
|
||||
Curl_resolv_get_ai(struct Curl_easy *data, uint32_t resolv_id,
|
||||
int ai_family, unsigned int index);
|
||||
const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data,
|
||||
uint32_t resolv_id,
|
||||
int ai_family,
|
||||
unsigned int index);
|
||||
#ifdef USE_HTTPSRR
|
||||
const struct Curl_https_rrinfo *
|
||||
Curl_resolv_get_https(struct Curl_easy *data, uint32_t resolv_id);
|
||||
const struct Curl_https_rrinfo *Curl_resolv_get_https(struct Curl_easy *data,
|
||||
uint32_t resolv_id);
|
||||
bool Curl_resolv_knows_https(struct Curl_easy *data, uint32_t resolv_id);
|
||||
#endif /* USE_HTTPSRR */
|
||||
|
||||
#else /* USE_CURL_ASYNC */
|
||||
#define Curl_resolv_shutdown_all(x) Curl_nop_stmt
|
||||
#define Curl_resolv_destroy_all(x) Curl_nop_stmt
|
||||
#else /* !USE_CURL_ASYNC */
|
||||
#define Curl_resolv_shutdown_all(x) Curl_nop_stmt
|
||||
#define Curl_resolv_destroy_all(x) Curl_nop_stmt
|
||||
#define Curl_resolv_take_result(x, y, z) CURLE_NOT_BUILT_IN
|
||||
#define Curl_resolv_get_ai(x,y,z, a) NULL
|
||||
#define Curl_resolv_get_https(x,y) NULL
|
||||
#define Curl_resolv_knows_https(x,y) TRUE
|
||||
#define Curl_resolv_pollset(x,y) CURLE_OK
|
||||
#define Curl_resolv_destroy(x,y) Curl_nop_stmt
|
||||
#endif /* USE_CURL_ASYNC, else */
|
||||
#define Curl_resolv_get_ai(x, y, z, a) NULL
|
||||
#define Curl_resolv_get_https(x, y) NULL
|
||||
#define Curl_resolv_knows_https(x, y) TRUE
|
||||
#define Curl_resolv_pollset(x, y) CURLE_OK
|
||||
#define Curl_resolv_destroy(x, y) Curl_nop_stmt
|
||||
#endif /* USE_CURL_ASYNC */
|
||||
|
||||
CURLcode Curl_resolver_error(struct Curl_easy *data, const char *detail);
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
|
|||
#endif /* CURLRES_IPV4 */
|
||||
|
||||
#if defined(CURLRES_IPV4) && !defined(USE_RESOLV_ARES) && \
|
||||
!defined(CURLRES_AMIGA)
|
||||
!defined(CURLRES_AMIGA)
|
||||
|
||||
/*
|
||||
* Curl_ipv4_resolve_r() - ipv4 thread-safe resolver function.
|
||||
|
|
|
|||
72
lib/http.c
72
lib/http.c
|
|
@ -472,53 +472,53 @@ static bool http_should_fail(struct Curl_easy *data, int httpcode)
|
|||
DEBUGASSERT(data->conn);
|
||||
|
||||
/*
|
||||
** If we have not been asked to fail on error,
|
||||
** do not fail.
|
||||
*/
|
||||
* If we have not been asked to fail on error,
|
||||
* do not fail.
|
||||
*/
|
||||
if(!data->set.http_fail_on_error)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
** Any code < 400 is never terminal.
|
||||
*/
|
||||
* Any code < 400 is never terminal.
|
||||
*/
|
||||
if(httpcode < 400)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
** A 416 response to a resume request is presumably because the file is
|
||||
** already completely downloaded and thus not actually a fail.
|
||||
*/
|
||||
* A 416 response to a resume request is presumably because the file is
|
||||
* already completely downloaded and thus not actually a fail.
|
||||
*/
|
||||
if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET &&
|
||||
httpcode == 416)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
** Any code >= 400 that is not 401 or 407 is always
|
||||
** a terminal error
|
||||
*/
|
||||
* Any code >= 400 that is not 401 or 407 is always
|
||||
* a terminal error
|
||||
*/
|
||||
if((httpcode != 401) && (httpcode != 407))
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
** All we have left to deal with is 401 and 407
|
||||
*/
|
||||
* All we have left to deal with is 401 and 407
|
||||
*/
|
||||
DEBUGASSERT((httpcode == 401) || (httpcode == 407));
|
||||
|
||||
/*
|
||||
** Examine the current authentication state to see if this is an error. The
|
||||
** idea is for this function to get called after processing all the headers
|
||||
** in a response message. If we have been to asked to authenticate
|
||||
** a particular stage, and we have done it, we are OK. If we are already
|
||||
** completely authenticated, it is not OK to get another 401 or 407.
|
||||
**
|
||||
** It is possible for authentication to go stale such that the client needs
|
||||
** to reauthenticate. Once that info is available, use it here.
|
||||
*/
|
||||
* Examine the current authentication state to see if this is an error. The
|
||||
* idea is for this function to get called after processing all the headers
|
||||
* in a response message. If we have been to asked to authenticate
|
||||
* a particular stage, and we have done it, we are OK. If we are already
|
||||
* completely authenticated, it is not OK to get another 401 or 407.
|
||||
*
|
||||
* It is possible for authentication to go stale such that the client needs
|
||||
* to reauthenticate. Once that info is available, use it here.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Either we are not authenticating, or we are supposed to be authenticating
|
||||
** something else. This is an error.
|
||||
*/
|
||||
* Either we are not authenticating, or we are supposed to be authenticating
|
||||
* something else. This is an error.
|
||||
*/
|
||||
if((httpcode == 401) && !data->state.aptr.user)
|
||||
return TRUE;
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
|
|
@ -766,14 +766,14 @@ static CURLcode output_auth_headers(struct Curl_easy *data,
|
|||
*
|
||||
* @returns CURLcode
|
||||
*/
|
||||
CURLcode
|
||||
Curl_http_output_auth(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
const char *request,
|
||||
Curl_HttpReq httpreq,
|
||||
const char *path,
|
||||
bool proxytunnel) /* TRUE if this is the request setting
|
||||
up the proxy tunnel */
|
||||
CURLcode Curl_http_output_auth(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
const char *request,
|
||||
Curl_HttpReq httpreq,
|
||||
const char *path,
|
||||
bool proxytunnel) /* TRUE if this is
|
||||
the request setting up
|
||||
the proxy tunnel */
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct auth *authhost;
|
||||
|
|
@ -1506,7 +1506,7 @@ static CURLcode cr_exp100_read(struct Curl_easy *data,
|
|||
/* We are now waiting for a reply from the server or
|
||||
* a timeout on our side IFF the request has been fully sent. */
|
||||
DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE, "
|
||||
"timeout %dms", data->set.expect_100_timeout));
|
||||
"timeout %dms", data->set.expect_100_timeout));
|
||||
ctx->state = EXP100_AWAITING_CONTINUE;
|
||||
ctx->start = *Curl_pgrs_now(data);
|
||||
Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT);
|
||||
|
|
@ -4024,7 +4024,7 @@ static void http_check_auth_closure(struct Curl_easy *data,
|
|||
#endif
|
||||
}
|
||||
#else
|
||||
#define http_check_auth_closure(x,y) /* empty */
|
||||
#define http_check_auth_closure(x, y) /* empty */
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -4603,7 +4603,7 @@ CURLcode Curl_http_write_resp_hd(struct Curl_easy *data,
|
|||
|
||||
result = http_rw_hd(data, hd, hdlen, &tmp, 0, &consumed);
|
||||
if(!result && is_eos) {
|
||||
result = Curl_client_write(data, (CLIENTWRITE_BODY|CLIENTWRITE_EOS),
|
||||
result = Curl_client_write(data, (CLIENTWRITE_BODY | CLIENTWRITE_EOS),
|
||||
&tmp, 0);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
16
lib/http.h
16
lib/http.h
|
|
@ -185,14 +185,14 @@ CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
|
|||
*
|
||||
* @returns CURLcode
|
||||
*/
|
||||
CURLcode
|
||||
Curl_http_output_auth(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
const char *request,
|
||||
Curl_HttpReq httpreq,
|
||||
const char *path,
|
||||
bool proxytunnel); /* TRUE if this is the request setting
|
||||
up the proxy tunnel */
|
||||
CURLcode Curl_http_output_auth(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
const char *request,
|
||||
Curl_HttpReq httpreq,
|
||||
const char *path,
|
||||
bool proxytunnel); /* TRUE if this is
|
||||
the request setting up
|
||||
the proxy tunnel */
|
||||
|
||||
/* Decode HTTP status code string. */
|
||||
CURLcode Curl_http_decode_status(int *pstatus, const char *s, size_t len);
|
||||
|
|
|
|||
|
|
@ -1734,8 +1734,8 @@ static CURLcode http2_handle_stream_close(struct Curl_cfilter *cf,
|
|||
break;
|
||||
curlx_dyn_reset(&dbuf);
|
||||
result = curlx_dyn_addf(&dbuf, "%.*s: %.*s\x0d\x0a",
|
||||
(int)e->namelen, e->name,
|
||||
(int)e->valuelen, e->value);
|
||||
(int)e->namelen, e->name,
|
||||
(int)e->valuelen, e->value);
|
||||
if(result)
|
||||
break;
|
||||
Curl_debug(data, CURLINFO_HEADER_IN, curlx_dyn_ptr(&dbuf),
|
||||
|
|
|
|||
|
|
@ -680,7 +680,8 @@ static int compare_func(const void *a, const void *b)
|
|||
}
|
||||
|
||||
UNITTEST CURLcode canon_path(const char *q, size_t len,
|
||||
struct dynbuf *new_path, bool normalize);
|
||||
struct dynbuf *new_path,
|
||||
bool do_uri_encode);
|
||||
UNITTEST CURLcode canon_path(const char *q, size_t len,
|
||||
struct dynbuf *new_path,
|
||||
bool do_uri_encode)
|
||||
|
|
|
|||
|
|
@ -258,12 +258,12 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
|
|||
size_t trlen = curlx_dyn_len(&ch->trailer);
|
||||
if(cw_next)
|
||||
result = Curl_cwriter_write(data, cw_next,
|
||||
CLIENTWRITE_HEADER|
|
||||
CLIENTWRITE_HEADER |
|
||||
CLIENTWRITE_TRAILER,
|
||||
tr, trlen);
|
||||
else
|
||||
result = Curl_client_write(data,
|
||||
CLIENTWRITE_HEADER|
|
||||
CLIENTWRITE_HEADER |
|
||||
CLIENTWRITE_TRAILER,
|
||||
tr, trlen);
|
||||
if(result) {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void Curl_httpsrr_trace(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
#else
|
||||
#define httpsrr_report_addr(a,b,c,d) Curl_nop_stmt
|
||||
#define httpsrr_report_addr(a, b, c, d) Curl_nop_stmt
|
||||
#endif /* CURLVERBOSE */
|
||||
|
||||
CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi,
|
||||
|
|
@ -194,8 +194,8 @@ CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi,
|
|||
return result;
|
||||
}
|
||||
|
||||
struct Curl_https_rrinfo *
|
||||
Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo)
|
||||
struct Curl_https_rrinfo *Curl_httpsrr_dup_move(
|
||||
struct Curl_https_rrinfo *rrinfo)
|
||||
{
|
||||
struct Curl_https_rrinfo *dup = curlx_memdup(rrinfo, sizeof(*rrinfo));
|
||||
if(dup)
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ struct Curl_https_rrinfo {
|
|||
CURLcode Curl_httpsrr_set(struct Curl_https_rrinfo *hi,
|
||||
uint16_t rrkey, const uint8_t *val, size_t vlen);
|
||||
|
||||
struct Curl_https_rrinfo *
|
||||
Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo);
|
||||
struct Curl_https_rrinfo *Curl_httpsrr_dup_move(
|
||||
struct Curl_https_rrinfo *rrinfo);
|
||||
|
||||
void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo);
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ CURLcode Curl_httpsrr_from_ares(const ares_dns_record_t *dnsrec,
|
|||
void Curl_httpsrr_trace(struct Curl_easy *data,
|
||||
struct Curl_https_rrinfo *hi);
|
||||
#else
|
||||
#define Curl_httpsrr_trace(a,b) Curl_nop_stmt
|
||||
#define Curl_httpsrr_trace(a, b) Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
#endif /* USE_HTTPSRR */
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@
|
|||
#include <idn2.h>
|
||||
|
||||
#if defined(_WIN32) && defined(UNICODE)
|
||||
#define IDN2_LOOKUP(name, host, flags) \
|
||||
#define IDN2_LOOKUP(name, host, flags) \
|
||||
idn2_lookup_u8((const uint8_t *)name, (uint8_t **)host, flags)
|
||||
#else
|
||||
#define IDN2_LOOKUP(name, host, flags) \
|
||||
#define IDN2_LOOKUP(name, host, flags) \
|
||||
idn2_lookup_ul((const char *)(name), (char **)(host), flags)
|
||||
#endif
|
||||
#endif /* USE_LIBIDN2 */
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
/* OpenSSL 3.0.0 marks the MD4 functions as deprecated */
|
||||
#define OPENSSL_NO_MD4
|
||||
#else
|
||||
/* Cover also OPENSSL_NO_MD4 configured in openssl */
|
||||
/* Cover also OPENSSL_NO_MD4 configured in OpenSSL */
|
||||
#include <openssl/opensslconf.h>
|
||||
#endif
|
||||
#endif /* USE_OPENSSL */
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ CURLcode Curl_md5it(unsigned char *output,
|
|||
result = my_md5_init(&ctx);
|
||||
if(!result) {
|
||||
do {
|
||||
unsigned int ilen = (unsigned int) CURLMIN(len, UINT_MAX);
|
||||
unsigned int ilen = (unsigned int)CURLMIN(len, UINT_MAX);
|
||||
my_md5_update(&ctx, input, ilen);
|
||||
input += ilen;
|
||||
len -= ilen;
|
||||
|
|
|
|||
|
|
@ -1937,7 +1937,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data,
|
|||
case 0:
|
||||
if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) {
|
||||
failf(data, "client mime read EOF fail, "
|
||||
"only %"FMT_OFF_T"/%"FMT_OFF_T
|
||||
"only %" FMT_OFF_T "/%" FMT_OFF_T
|
||||
" of needed bytes read", ctx->read_len, ctx->total_len);
|
||||
return CURLE_READ_ERROR;
|
||||
}
|
||||
|
|
@ -1992,7 +1992,7 @@ static CURLcode cr_mime_read(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
CURL_TRC_READ(data, "cr_mime_read(len=%zu, total=%" FMT_OFF_T
|
||||
", read=%"FMT_OFF_T") -> %d, %zu, %d",
|
||||
", read=%" FMT_OFF_T ") -> %d, %zu, %d",
|
||||
blen, ctx->total_len, ctx->read_len, result, *pnread, *peos);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@ const unsigned char Curl_ldigits[] = "0123456789abcdef";
|
|||
/* Upper-case digits. */
|
||||
const unsigned char Curl_udigits[] = "0123456789ABCDEF";
|
||||
|
||||
#define OUTCHAR(x) \
|
||||
do { \
|
||||
if(stream((unsigned char)(x), userp)) \
|
||||
return TRUE; \
|
||||
(*donep)++; \
|
||||
#define OUTCHAR(x) \
|
||||
do { \
|
||||
if(stream((unsigned char)(x), userp)) \
|
||||
return TRUE; \
|
||||
(*donep)++; \
|
||||
} while(0)
|
||||
|
||||
/* Data type to read from the arglist */
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@
|
|||
|
||||
#define CURL_MULTI_HANDLE 0x000bab1e
|
||||
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
/* On a debug build, we want to fail hard on multi handles that
|
||||
* are not NULL, but no longer have the MAGIC touch. This gives
|
||||
|
|
|
|||
|
|
@ -361,7 +361,6 @@ void Curl_pgrs_deliver_inc(struct Curl_easy *data, size_t delta)
|
|||
data->progress.deliver += delta;
|
||||
}
|
||||
|
||||
|
||||
void Curl_pgrs_download_inc(struct Curl_easy *data, size_t delta)
|
||||
{
|
||||
if(delta) {
|
||||
|
|
|
|||
|
|
@ -322,8 +322,7 @@ const struct Curl_scheme Curl_scheme_smb = {
|
|||
|
||||
const struct Curl_scheme Curl_scheme_smbs = {
|
||||
"smbs", /* scheme */
|
||||
#if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
|
||||
defined(USE_SSL)
|
||||
#if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE) && defined(USE_SSL)
|
||||
&Curl_protocol_smb,
|
||||
#else
|
||||
ZERO_NULL,
|
||||
|
|
@ -405,7 +404,7 @@ const struct Curl_scheme Curl_scheme_ws = {
|
|||
const struct Curl_scheme Curl_scheme_wss = {
|
||||
"wss", /* scheme */
|
||||
#if defined(CURL_DISABLE_WEBSOCKETS) || defined(CURL_DISABLE_HTTP) || \
|
||||
!defined(USE_SSL)
|
||||
!defined(USE_SSL)
|
||||
ZERO_NULL,
|
||||
#else
|
||||
&Curl_protocol_ws,
|
||||
|
|
|
|||
|
|
@ -38,16 +38,17 @@ struct UserDefined;
|
|||
/* Low level request receive/send io_flags checks. */
|
||||
#define CURL_REQ_WANT_SEND(d) ((d)->req.io_flags & REQ_IO_SEND)
|
||||
#define CURL_REQ_WANT_RECV(d) ((d)->req.io_flags & REQ_IO_RECV)
|
||||
#define CURL_REQ_WANT_IO(d) ((d)->req.io_flags & (REQ_IO_RECV|REQ_IO_SEND))
|
||||
#define CURL_REQ_WANT_IO(d) \
|
||||
((d)->req.io_flags & (REQ_IO_RECV | REQ_IO_SEND))
|
||||
/* Low level request receive/send io_flags manipulations. */
|
||||
#define CURL_REQ_SET_SEND(d) ((d)->req.io_flags |= REQ_IO_SEND)
|
||||
#define CURL_REQ_SET_RECV(d) ((d)->req.io_flags |= REQ_IO_RECV)
|
||||
#define CURL_REQ_SET_SEND(d) ((d)->req.io_flags |= REQ_IO_SEND)
|
||||
#define CURL_REQ_SET_RECV(d) ((d)->req.io_flags |= REQ_IO_RECV)
|
||||
#define CURL_REQ_CLEAR_SEND(d) \
|
||||
((d)->req.io_flags &= (uint8_t)~REQ_IO_SEND)
|
||||
#define CURL_REQ_CLEAR_RECV(d) \
|
||||
((d)->req.io_flags &= (uint8_t)~REQ_IO_RECV)
|
||||
#define CURL_REQ_CLEAR_IO(d) \
|
||||
((d)->req.io_flags &= (uint8_t)~(REQ_IO_RECV|REQ_IO_SEND))
|
||||
((d)->req.io_flags &= (uint8_t)~(REQ_IO_RECV | REQ_IO_SEND))
|
||||
|
||||
enum expect100 {
|
||||
EXP100_SEND_DATA, /* enough waiting, send the body now */
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ static CURLcode rtsp_setup_body(struct Curl_easy *data,
|
|||
/* As stated in the http comments, it is probably not wise to
|
||||
* actually set a custom Content-Length in the headers */
|
||||
if(!Curl_checkheaders(data, STRCONST("Content-Length"))) {
|
||||
result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T"\r\n",
|
||||
result = curlx_dyn_addf(reqp, "Content-Length: %" FMT_OFF_T "\r\n",
|
||||
req_clen);
|
||||
if(result)
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
|
|||
if(ufds[i].fd == CURL_SOCKET_BAD)
|
||||
continue;
|
||||
VERIFY_SOCK(ufds[i].fd);
|
||||
if(ufds[i].events & (POLLIN |POLLOUT |POLLPRI |
|
||||
if(ufds[i].events & (POLLIN | POLLOUT | POLLPRI |
|
||||
POLLRDNORM | POLLWRNORM | POLLRDBAND)) {
|
||||
if(ufds[i].fd > maxfd)
|
||||
maxfd = ufds[i].fd;
|
||||
|
|
@ -636,9 +636,9 @@ CURLcode Curl_pollset_set(struct Curl_easy *data,
|
|||
bool do_in, bool do_out)
|
||||
{
|
||||
return Curl_pollset_change(data, ps, sock,
|
||||
(do_in ? CURL_POLL_IN : 0)|
|
||||
(do_in ? CURL_POLL_IN : 0) |
|
||||
(do_out ? CURL_POLL_OUT : 0),
|
||||
(!do_in ? CURL_POLL_IN : 0)|
|
||||
(!do_in ? CURL_POLL_IN : 0) |
|
||||
(!do_out ? CURL_POLL_OUT : 0));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@
|
|||
* Definition of pollfd struct and constants for platforms lacking them.
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_SYS_POLL_H) && \
|
||||
!defined(HAVE_POLL_H) && \
|
||||
!defined(POLLIN)
|
||||
#if !defined(HAVE_SYS_POLL_H) && !defined(HAVE_POLL_H) && !defined(POLLIN)
|
||||
|
||||
#define POLLIN 0x01
|
||||
#define POLLPRI 0x02
|
||||
|
|
|
|||
12
lib/sendf.c
12
lib/sendf.c
|
|
@ -372,8 +372,8 @@ static CURLcode do_init_writer_stack(struct Curl_easy *data)
|
|||
The bit pattern defines to what "streams" to write to. Body and/or header.
|
||||
The defines are in sendf.h of course.
|
||||
*/
|
||||
CURLcode Curl_client_write(struct Curl_easy *data,
|
||||
int type, const char *buf, size_t len)
|
||||
CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf,
|
||||
size_t len)
|
||||
{
|
||||
CURLcode result;
|
||||
|
||||
|
|
@ -675,7 +675,7 @@ static CURLcode cr_in_read(struct Curl_easy *data,
|
|||
case 0:
|
||||
if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) {
|
||||
failf(data, "client read function EOF fail, "
|
||||
"only %"FMT_OFF_T"/%"FMT_OFF_T " of needed bytes read",
|
||||
"only %" FMT_OFF_T "/%" FMT_OFF_T " of needed bytes read",
|
||||
ctx->read_len, ctx->total_len);
|
||||
result = CURLE_READ_ERROR;
|
||||
break;
|
||||
|
|
@ -729,8 +729,8 @@ static CURLcode cr_in_read(struct Curl_easy *data,
|
|||
*peos = (bool)ctx->seen_eos;
|
||||
break;
|
||||
}
|
||||
CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%"FMT_OFF_T
|
||||
", read=%"FMT_OFF_T") -> %d, nread=%zu, eos=%d",
|
||||
CURL_TRC_READ(data, "cr_in_read(len=%zu, total=%" FMT_OFF_T
|
||||
", read=%" FMT_OFF_T ") -> %d, nread=%zu, eos=%d",
|
||||
blen, ctx->total_len, ctx->read_len, result,
|
||||
*pnread, *peos);
|
||||
return result;
|
||||
|
|
@ -1138,7 +1138,7 @@ CURLcode Curl_creader_set_fread(struct Curl_easy *data, curl_off_t len)
|
|||
cl_reset_reader(data);
|
||||
result = do_init_reader_stack(data, r);
|
||||
out:
|
||||
CURL_TRC_READ(data, "add fread reader, len=%"FMT_OFF_T " -> %d",
|
||||
CURL_TRC_READ(data, "add fread reader, len=%" FMT_OFF_T " -> %d",
|
||||
len, result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,22 +67,22 @@ extern int Curl_getnameinfo_a(const struct sockaddr *sa,
|
|||
|
||||
/* GSSAPI wrappers. */
|
||||
|
||||
extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status,
|
||||
extern OM_uint32 Curl_gss_import_name_a(OM_uint32 *minor_status,
|
||||
gss_buffer_t in_name,
|
||||
gss_OID in_name_type,
|
||||
gss_name_t * out_name);
|
||||
gss_name_t *out_name);
|
||||
#define gss_import_name Curl_gss_import_name_a
|
||||
|
||||
extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status,
|
||||
extern OM_uint32 Curl_gss_display_status_a(OM_uint32 *minor_status,
|
||||
OM_uint32 status_value,
|
||||
int status_type, gss_OID mech_type,
|
||||
gss_msg_ctx_t * message_context,
|
||||
gss_msg_ctx_t *message_context,
|
||||
gss_buffer_t status_string);
|
||||
#define gss_display_status Curl_gss_display_status_a
|
||||
|
||||
extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
|
||||
extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 *minor_status,
|
||||
gss_cred_id_t cred_handle,
|
||||
gss_ctx_id_t * context_handle,
|
||||
gss_ctx_id_t *context_handle,
|
||||
gss_name_t target_name,
|
||||
gss_OID mech_type,
|
||||
gss_flags_t req_flags,
|
||||
|
|
@ -90,10 +90,10 @@ extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
|
|||
gss_channel_bindings_t
|
||||
input_chan_bindings,
|
||||
gss_buffer_t input_token,
|
||||
gss_OID * actual_mech_type,
|
||||
gss_OID *actual_mech_type,
|
||||
gss_buffer_t output_token,
|
||||
gss_flags_t * ret_flags,
|
||||
OM_uint32 * time_rec);
|
||||
gss_flags_t *ret_flags,
|
||||
OM_uint32 *time_rec);
|
||||
#define gss_init_sec_context Curl_gss_init_sec_context_a
|
||||
|
||||
extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 *minor_status,
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ static void my_sha256_final(unsigned char *digest, void *in)
|
|||
(a)[0] = (unsigned char)((((unsigned long)(val)) >> 24) & 0xff); \
|
||||
(a)[1] = (unsigned char)((((unsigned long)(val)) >> 16) & 0xff); \
|
||||
(a)[2] = (unsigned char)((((unsigned long)(val)) >> 8) & 0xff); \
|
||||
(a)[3] = (unsigned char) (((unsigned long)(val)) & 0xff); \
|
||||
(a)[3] = (unsigned char)(((unsigned long)(val)) & 0xff); \
|
||||
} while(0)
|
||||
|
||||
#define WPA_PUT_BE64(a, val) \
|
||||
|
|
@ -486,7 +486,7 @@ CURLcode Curl_sha256it(unsigned char *output, const unsigned char *input,
|
|||
result = my_sha256_init(&ctx);
|
||||
if(!result) {
|
||||
do {
|
||||
unsigned int ilen = (unsigned int) CURLMIN(len, UINT_MAX);
|
||||
unsigned int ilen = (unsigned int)CURLMIN(len, UINT_MAX);
|
||||
my_sha256_update(&ctx, input, ilen);
|
||||
len -= ilen;
|
||||
input += ilen;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ int Curl_wakeup_signal(curl_socket_t socks[2]);
|
|||
CURLcode Curl_wakeup_consume(curl_socket_t socks[2], bool all);
|
||||
|
||||
#else
|
||||
#define Curl_wakeup_destroy(x) Curl_nop_stmt
|
||||
#define Curl_wakeup_destroy(x) Curl_nop_stmt
|
||||
#endif
|
||||
|
||||
#endif /* HEADER_CURL_SOCKETPAIR_H */
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
if(gss_major_status != GSS_S_CONTINUE_NEEDED)
|
||||
break;
|
||||
|
||||
/* analyse response */
|
||||
/* analyze response */
|
||||
|
||||
/* GSS-API response looks like
|
||||
* +----+------+-----+----------------+
|
||||
|
|
|
|||
|
|
@ -1266,9 +1266,9 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
|
|||
|
||||
#ifdef USE_WINSOCK
|
||||
/* We want to wait for both stdin and the socket. Since
|
||||
** the select() function in Winsock only works on sockets
|
||||
** we have to use the WaitForMultipleObjects() call.
|
||||
*/
|
||||
* the select() function in Winsock only works on sockets
|
||||
* we have to use the WaitForMultipleObjects() call.
|
||||
*/
|
||||
|
||||
/* First, create a sockets event object */
|
||||
event_handle = WSACreateEvent();
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@
|
|||
#define CURL_UINT32_SPBSET_MAGIC 0x70737362
|
||||
#endif
|
||||
|
||||
/* Clear the bitset, making it empty. */
|
||||
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset);
|
||||
|
||||
void Curl_uint32_spbset_init(struct uint32_spbset *bset)
|
||||
{
|
||||
memset(bset, 0, sizeof(*bset));
|
||||
|
|
@ -41,6 +38,19 @@ void Curl_uint32_spbset_init(struct uint32_spbset *bset)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Clear the bitset, making it empty. */
|
||||
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset);
|
||||
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset)
|
||||
{
|
||||
struct uint32_spbset_chunk *next, *chunk;
|
||||
|
||||
for(chunk = bset->head.next; chunk; chunk = next) {
|
||||
next = chunk->next;
|
||||
curlx_free(chunk);
|
||||
}
|
||||
memset(&bset->head, 0, sizeof(bset->head));
|
||||
}
|
||||
|
||||
void Curl_uint32_spbset_destroy(struct uint32_spbset *bset)
|
||||
{
|
||||
DEBUGASSERT(bset->init == CURL_UINT32_SPBSET_MAGIC);
|
||||
|
|
@ -61,19 +71,8 @@ uint32_t Curl_uint32_spbset_count(struct uint32_spbset *bset)
|
|||
return n;
|
||||
}
|
||||
|
||||
UNITTEST void Curl_uint32_spbset_clear(struct uint32_spbset *bset)
|
||||
{
|
||||
struct uint32_spbset_chunk *next, *chunk;
|
||||
|
||||
for(chunk = bset->head.next; chunk; chunk = next) {
|
||||
next = chunk->next;
|
||||
curlx_free(chunk);
|
||||
}
|
||||
memset(&bset->head, 0, sizeof(bset->head));
|
||||
}
|
||||
|
||||
static struct uint32_spbset_chunk *
|
||||
uint32_spbset_get_chunk(struct uint32_spbset *bset, uint32_t i, bool grow)
|
||||
static struct uint32_spbset_chunk *uint32_spbset_get_chunk(
|
||||
struct uint32_spbset *bset, uint32_t i, bool grow)
|
||||
{
|
||||
struct uint32_spbset_chunk *chunk, **panchor = NULL;
|
||||
uint32_t i_offset = (i & ~CURL_UINT32_SPBSET_CH_MASK);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@
|
|||
#define CURL_UINT32_TBL_MAGIC 0x62757473
|
||||
#endif
|
||||
|
||||
/* Clear the table, making it empty. */
|
||||
UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl);
|
||||
|
||||
void Curl_uint32_tbl_init(struct uint32_tbl *tbl,
|
||||
Curl_uint32_tbl_entry_dtor *entry_dtor)
|
||||
{
|
||||
|
|
@ -82,14 +79,8 @@ CURLcode Curl_uint32_tbl_resize(struct uint32_tbl *tbl, uint32_t nrows)
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
void Curl_uint32_tbl_destroy(struct uint32_tbl *tbl)
|
||||
{
|
||||
DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC);
|
||||
Curl_uint32_tbl_clear(tbl);
|
||||
curlx_free(tbl->rows);
|
||||
memset(tbl, 0, sizeof(*tbl));
|
||||
}
|
||||
|
||||
/* Clear the table, making it empty. */
|
||||
UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl);
|
||||
UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl)
|
||||
{
|
||||
DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC);
|
||||
|
|
@ -98,6 +89,14 @@ UNITTEST void Curl_uint32_tbl_clear(struct uint32_tbl *tbl)
|
|||
tbl->last_key_added = UINT32_MAX;
|
||||
}
|
||||
|
||||
void Curl_uint32_tbl_destroy(struct uint32_tbl *tbl)
|
||||
{
|
||||
DEBUGASSERT(tbl->init == CURL_UINT32_TBL_MAGIC);
|
||||
Curl_uint32_tbl_clear(tbl);
|
||||
curlx_free(tbl->rows);
|
||||
memset(tbl, 0, sizeof(*tbl));
|
||||
}
|
||||
|
||||
uint32_t Curl_uint32_tbl_capacity(struct uint32_tbl *tbl)
|
||||
{
|
||||
return tbl->nrows;
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ void Curl_init_userdefined(struct Curl_easy *data)
|
|||
#endif
|
||||
|
||||
set->new_file_perms = 0644; /* Default permissions */
|
||||
set->allowed_protocols = (curl_prot_t) CURLPROTO_64ALL;
|
||||
set->allowed_protocols = (curl_prot_t)CURLPROTO_64ALL;
|
||||
set->redir_protocols = CURLPROTO_REDIR;
|
||||
|
||||
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ CURLcode Curl_conn_upkeep(struct Curl_easy *data,
|
|||
|
||||
/**
|
||||
* Always eval all arguments, return the first
|
||||
* result != (CURLE_OK|CURLE_AGAIN) or `r1`.
|
||||
* result != (CURLE_OK | CURLE_AGAIN) or `r1`.
|
||||
*/
|
||||
CURLcode Curl_1st_fatal(CURLcode r1, CURLcode r2);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ CURLUcode Curl_url_set_authority(CURLU *u, const char *authority);
|
|||
|
||||
CURLUcode Curl_junkscan(const char *url, size_t *urllen, bool allowspace);
|
||||
|
||||
#define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE
|
||||
#define U_CURLU_URLDECODE (unsigned int)CURLU_URLDECODE
|
||||
#define U_CURLU_PATH_AS_IS (unsigned int)CURLU_PATH_AS_IS
|
||||
|
||||
#endif /* HEADER_CURL_URLAPI_INT_H */
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
/* This file is for lib internal stuff */
|
||||
#include "curl_setup.h"
|
||||
|
||||
#define CURL_DEFAULT_USER "anonymous"
|
||||
#define CURL_DEFAULT_USER "anonymous"
|
||||
#define CURL_DEFAULT_PASSWORD "ftp@example.com"
|
||||
|
||||
#if !defined(_WIN32) && !defined(MSDOS)
|
||||
|
|
|
|||
|
|
@ -243,11 +243,9 @@ char *curl_version(void)
|
|||
#endif
|
||||
#ifdef HAVE_GSSAPI
|
||||
#ifdef HAVE_GSSGNU
|
||||
curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s",
|
||||
GSS_VERSION);
|
||||
curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s", GSS_VERSION);
|
||||
#elif defined(CURL_KRB5_VERSION)
|
||||
curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s",
|
||||
CURL_KRB5_VERSION);
|
||||
curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s", CURL_KRB5_VERSION);
|
||||
#else
|
||||
curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5");
|
||||
#endif
|
||||
|
|
@ -432,7 +430,7 @@ static const struct feat features_table[] = {
|
|||
FEATURE("alt-svc", NULL, CURL_VERSION_ALTSVC),
|
||||
#endif
|
||||
#if defined(USE_ARES) && defined(USE_RESOLV_THREADED) && defined(USE_HTTPSRR)
|
||||
FEATURE("asyn-rr", NULL, 0),
|
||||
FEATURE("asyn-rr", NULL, 0),
|
||||
#endif
|
||||
#ifdef CURLRES_ASYNCH
|
||||
FEATURE("AsynchDNS", NULL, CURL_VERSION_ASYNCHDNS),
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc)
|
|||
rc = ssh_get_publickey_hash(pubkey, SSH_PUBLICKEY_HASH_MD5, &hash, &hlen);
|
||||
if(rc != SSH_OK || hlen != 16) {
|
||||
failf(data,
|
||||
"Denied establishing ssh session: md5 fingerprint not available");
|
||||
"Denied establishing ssh session: MD5 fingerprint not available");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ static int myssh_is_known(struct Curl_easy *data, struct ssh_conn *sshc)
|
|||
|
||||
if(!curl_strequal(md5buffer, pubkey_md5)) {
|
||||
failf(data,
|
||||
"Denied establishing ssh session: mismatch md5 fingerprint. "
|
||||
"Denied establishing ssh session: mismatch MD5 fingerprint. "
|
||||
"Remote %s is not equal to %s", md5buffer, pubkey_md5);
|
||||
rc = SSH_ERROR;
|
||||
goto cleanup;
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
|
|||
LIBSSH2_HOSTKEY_HASH_SHA256);
|
||||
if(!fingerprint) {
|
||||
failf(data,
|
||||
"Denied establishing ssh session: sha256 fingerprint "
|
||||
"Denied establishing ssh session: SHA256 fingerprint "
|
||||
"not available");
|
||||
myssh_to(data, sshc, SSH_SESSION_FREE);
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
|
|
@ -491,7 +491,7 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
if(!fingerprint_b64) {
|
||||
failf(data, "sha256 fingerprint could not be encoded");
|
||||
failf(data, "SHA256 fingerprint could not be encoded");
|
||||
myssh_to(data, sshc, SSH_SESSION_FREE);
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
}
|
||||
|
|
@ -509,13 +509,13 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
|
|||
b64_pos++;
|
||||
}
|
||||
|
||||
/* Before we authenticate we check the hostkey's sha256 fingerprint
|
||||
/* Before we authenticate we check the hostkey's SHA256 fingerprint
|
||||
* against a known fingerprint, if available.
|
||||
*/
|
||||
if((pub_pos != b64_pos) ||
|
||||
strncmp(fingerprint_b64, pubkey_sha256, pub_pos)) {
|
||||
failf(data,
|
||||
"Denied establishing ssh session: mismatch sha256 fingerprint. "
|
||||
"Denied establishing ssh session: mismatch SHA256 fingerprint. "
|
||||
"Remote %s is not equal to %s", fingerprint_b64, pubkey_sha256);
|
||||
curlx_free(fingerprint_b64);
|
||||
myssh_to(data, sshc, SSH_SESSION_FREE);
|
||||
|
|
@ -550,12 +550,12 @@ static CURLcode ssh_check_fingerprint(struct Curl_easy *data,
|
|||
if(!fingerprint || !curl_strequal(md5buffer, pubkey_md5)) {
|
||||
if(fingerprint) {
|
||||
failf(data,
|
||||
"Denied establishing ssh session: mismatch md5 fingerprint. "
|
||||
"Denied establishing ssh session: mismatch MD5 fingerprint. "
|
||||
"Remote %s is not equal to %s", md5buffer, pubkey_md5);
|
||||
}
|
||||
else {
|
||||
failf(data,
|
||||
"Denied establishing ssh session: md5 fingerprint "
|
||||
"Denied establishing ssh session: MD5 fingerprint "
|
||||
"not available");
|
||||
}
|
||||
myssh_to(data, sshc, SSH_SESSION_FREE);
|
||||
|
|
|
|||
|
|
@ -35,10 +35,8 @@ static FILE *keylog_file_fp;
|
|||
|
||||
void Curl_tls_keylog_open(void)
|
||||
{
|
||||
char *keylog_file_name;
|
||||
|
||||
if(!keylog_file_fp) {
|
||||
keylog_file_name = curl_getenv("SSLKEYLOGFILE");
|
||||
char *keylog_file_name = curl_getenv("SSLKEYLOGFILE");
|
||||
if(keylog_file_name) {
|
||||
keylog_file_fp = curlx_fopen(keylog_file_name, FOPEN_APPENDTEXT);
|
||||
if(keylog_file_fp) {
|
||||
|
|
|
|||
|
|
@ -2946,7 +2946,7 @@ static CURLcode ossl_windows_load_anchors(struct Curl_cfilter *cf,
|
|||
/* Import certificates from the Windows root certificate store if
|
||||
requested.
|
||||
https://stackoverflow.com/questions/9507184/
|
||||
https://github.com/d3x0r/SACK/blob/master/src/netlib/ssl_layer.c#L1037
|
||||
https://github.com/d3x0r/SACK/blob/ff15424d3c581b86d40f818532e5a400c516d39d/src/netlib/ssl_layer.c#L1410
|
||||
https://datatracker.ietf.org/doc/html/rfc5280 */
|
||||
const char *win_stores[] = {
|
||||
"ROOT", /* Trusted Root Certification Authorities */
|
||||
|
|
|
|||
|
|
@ -175,20 +175,20 @@ static CURLcode schannel_set_ssl_version_min_max(DWORD *enabled_protocols,
|
|||
for(; i <= (ssl_version_max >> 16); ++i) {
|
||||
switch(i) {
|
||||
case CURL_SSLVERSION_TLSv1_0:
|
||||
(*enabled_protocols) |= SP_PROT_TLS1_0_CLIENT;
|
||||
*enabled_protocols |= SP_PROT_TLS1_0_CLIENT;
|
||||
break;
|
||||
case CURL_SSLVERSION_TLSv1_1:
|
||||
(*enabled_protocols) |= SP_PROT_TLS1_1_CLIENT;
|
||||
*enabled_protocols |= SP_PROT_TLS1_1_CLIENT;
|
||||
break;
|
||||
case CURL_SSLVERSION_TLSv1_2:
|
||||
(*enabled_protocols) |= SP_PROT_TLS1_2_CLIENT;
|
||||
*enabled_protocols |= SP_PROT_TLS1_2_CLIENT;
|
||||
break;
|
||||
case CURL_SSLVERSION_TLSv1_3:
|
||||
|
||||
/* Windows Server 2022 and newer */
|
||||
if(curlx_verify_windows_version(10, 0, 20348, PLATFORM_WINNT,
|
||||
VERSION_GREATER_THAN_EQUAL)) {
|
||||
(*enabled_protocols) |= SP_PROT_TLS1_3_CLIENT;
|
||||
*enabled_protocols |= SP_PROT_TLS1_3_CLIENT;
|
||||
break;
|
||||
}
|
||||
else { /* Windows 10 and older */
|
||||
|
|
@ -277,7 +277,7 @@ static int get_alg_id_by_name(const char *name)
|
|||
return 0; /* not found */
|
||||
}
|
||||
|
||||
#define NUM_CIPHERS 47 /* There are 47 options listed above */
|
||||
#define NUM_CIPHERS 47 /* There are a maximum of 47 options listed above */
|
||||
|
||||
static CURLcode set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
|
||||
ALG_ID *algIds)
|
||||
|
|
|
|||
|
|
@ -1684,7 +1684,7 @@ struct Curl_cftype Curl_cft_ssl = {
|
|||
|
||||
struct Curl_cftype Curl_cft_ssl_proxy = {
|
||||
"SSL-PROXY",
|
||||
CF_TYPE_SSL|CF_TYPE_PROXY,
|
||||
CF_TYPE_SSL | CF_TYPE_PROXY,
|
||||
CURL_LOG_LVL_NONE,
|
||||
ssl_cf_destroy,
|
||||
ssl_cf_connect,
|
||||
|
|
|
|||
|
|
@ -403,7 +403,8 @@ static CURLcode utf8asn1str(struct dynbuf *to, int type, const char *from,
|
|||
*
|
||||
* @unittest 1666
|
||||
*/
|
||||
UNITTEST CURLcode encodeOID(struct dynbuf *buf, const char *b, const char *e);
|
||||
UNITTEST CURLcode encodeOID(struct dynbuf *store,
|
||||
const char *beg, const char *end);
|
||||
UNITTEST CURLcode encodeOID(struct dynbuf *store,
|
||||
const char *beg, const char *end)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue