mirror of
https://github.com/curl/curl.git
synced 2026-06-09 10:04:15 +03:00
use custom mem funcs
This commit is contained in:
parent
06c12cc08b
commit
2f118a0187
4 changed files with 46 additions and 4 deletions
|
|
@ -1208,12 +1208,13 @@ static CURLcode init_ngh3_conn(struct Curl_cfilter *cf,
|
|||
}
|
||||
|
||||
nghttp3_settings_default(&ctx->h3settings);
|
||||
nghttp3_mem mem = {NULL, Curl_ngtcp2_malloc, Curl_ngtcp2_free,
|
||||
Curl_ngtcp2_calloc, Curl_ngtcp2_realloc};
|
||||
|
||||
rc = nghttp3_conn_client_new(&ctx->h3conn,
|
||||
&ngh3_callbacks,
|
||||
&ctx->h3settings,
|
||||
nghttp3_mem_default(),
|
||||
cf);
|
||||
&mem, cf);
|
||||
if(rc) {
|
||||
failf(data, "error creating nghttp3 connection instance");
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
|
@ -2466,12 +2467,14 @@ static const struct alpn_spec ALPN_SPEC_H3 = {
|
|||
ctx->q.local_addrlen);
|
||||
ngtcp2_addr_init(&ctx->connected_path.remote,
|
||||
&sockaddr->curl_sa_addr, (socklen_t)sockaddr->addrlen);
|
||||
ngtcp2_mem mem = {NULL, Curl_ngtcp2_malloc, Curl_ngtcp2_free,
|
||||
Curl_ngtcp2_calloc, Curl_ngtcp2_realloc};
|
||||
|
||||
rc = ngtcp2_conn_client_new(&ctx->qconn, &ctx->dcid, &ctx->scid,
|
||||
&ctx->connected_path,
|
||||
NGTCP2_PROTO_VER_V1, &ng_callbacks,
|
||||
&ctx->settings, &ctx->transport_params,
|
||||
NULL, cf);
|
||||
&mem, cf);
|
||||
if(rc)
|
||||
return CURLE_QUIC_CONNECT_ERROR;
|
||||
|
||||
|
|
|
|||
|
|
@ -1103,10 +1103,12 @@ static CURLcode cf_osslq_h3conn_init(struct cf_osslq_ctx *ctx, SSL *conn,
|
|||
int rc;
|
||||
|
||||
nghttp3_settings_default(&h3->settings);
|
||||
nghttp3_mem mem = {NULL, Curl_ngtcp2_malloc, Curl_ngtcp2_free,
|
||||
Curl_ngtcp2_calloc, Curl_ngtcp2_realloc};
|
||||
rc = nghttp3_conn_client_new(&h3->conn,
|
||||
&ngh3_callbacks,
|
||||
&h3->settings,
|
||||
nghttp3_mem_default(),
|
||||
&mem,
|
||||
user_data);
|
||||
if(rc) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
|
|
|
|||
|
|
@ -723,6 +723,34 @@ CURLcode Curl_conn_may_http3(struct Curl_easy *data,
|
|||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#if defined(USE_NGTCP2) || defined(USE_NGHTTP3)
|
||||
|
||||
void *Curl_ngtcp2_malloc(size_t size, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
return Curl_cmalloc(size);
|
||||
}
|
||||
|
||||
void Curl_ngtcp2_free(void *ptr, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
Curl_cfree(ptr);
|
||||
}
|
||||
|
||||
void *Curl_ngtcp2_calloc(size_t nmemb, size_t size, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
return Curl_ccalloc(nmemb, size);
|
||||
}
|
||||
|
||||
void *Curl_ngtcp2_realloc(void *ptr, size_t size, void *user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
return Curl_crealloc(ptr, size);
|
||||
}
|
||||
|
||||
#endif /* USE_NGTCP2 || USE_NGHTTP3 */
|
||||
|
||||
#else /* CURL_DISABLE_HTTP || !USE_HTTP3 */
|
||||
|
||||
CURLcode Curl_conn_may_http3(struct Curl_easy *data,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,15 @@ CURLcode Curl_cf_quic_create(struct Curl_cfilter **pcf,
|
|||
|
||||
extern struct Curl_cftype Curl_cft_http3;
|
||||
|
||||
#if defined(USE_NGTCP2) || defined(USE_NGHTTP3)
|
||||
|
||||
void *Curl_ngtcp2_malloc(size_t size, void *user_data);
|
||||
void Curl_ngtcp2_free(void *ptr, void *user_data);
|
||||
void *Curl_ngtcp2_calloc(size_t nmemb, size_t size, void *user_data);
|
||||
void *Curl_ngtcp2_realloc(void *ptr, size_t size, void *user_data);
|
||||
|
||||
#endif /* USE_NGTCP2 || USE_NGHTTP3 */
|
||||
|
||||
#else
|
||||
#define Curl_vquic_init() 1
|
||||
#endif /* !CURL_DISABLE_HTTP && USE_HTTP3 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue