| @@ -21,18 +21,17 @@ |
| * SPDX-License-Identifier: curl |
| * |
| ***************************************************************************/ |
| - | |
| #include "curl_setup.h" |
| |
| #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY) && \ |
| - | defined(USE_PROXY_HTTP3) && defined(USE_NGHTTP3) && \ |
| - | defined(USE_NGTCP2) && defined(USE_OPENSSL) |
| + | defined(USE_PROXY_HTTP3) && defined(USE_NGHTTP3) && \ |
| + | defined(USE_NGTCP2) && defined(USE_OPENSSL) |
| |
| #include <ngtcp2/ngtcp2.h> |
| - | #include <ngtcp2/ngtcp2_crypto.h> |
| + | |
| #ifdef USE_OPENSSL |
| #include <openssl/err.h> |
| - | #if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC) |
| + | #if defined(OPENSSL_IS_AWSLC) || defined(OPENSSL_IS_BORINGSSL) |
| #include <ngtcp2/ngtcp2_crypto_boringssl.h> |
| #elif defined(OPENSSL_QUIC_API2) |
| #include <ngtcp2/ngtcp2_crypto_ossl.h> |
| @@ -40,11 +39,15 @@ |
| #include <ngtcp2/ngtcp2_crypto_quictls.h> |
| #endif |
| #include "vtls/openssl.h" |
| - | #endif /* USE_OPENSSL */ |
| + | #endif |
| |
| #include <nghttp3/nghttp3.h> |
| |
| #include "urldata.h" |
| + | #include "url.h" |
| + | #include "uint-hash.h" |
| + | #include "curl_trc.h" |
| + | #include "rand.h" |
| #include "hash.h" |
| #include "sendf.h" |
| #include "multiif.h" |
| @@ -57,17 +60,13 @@ |
| #include "dynhds.h" |
| #include "http_proxy.h" |
| #include "select.h" |
| - | #include "uint-hash.h" |
| #include "vquic/vquic.h" |
| #include "vquic/vquic_int.h" |
| #include "vquic/vquic-tls.h" |
| #include "vtls/vtls.h" |
| #include "vtls/vtls_scache.h" |
| - | #include "curl_trc.h" |
| #include "cf-h3-proxy.h" |
| - | #include "url.h" |
| #include "capsule.h" |
| - | #include "rand.h" |
| |
| /* A stream window is the maximum amount we need to buffer for |
| * each active transfer. We use HTTP/3 flow control and only ACK |
| @@ -79,7 +78,7 @@ |
| |
| /* The pool keeps spares around and half of a full stream window |
| * seems good. More does not seem to improve performance. |
| - | * The benefit of the pool is that stream buffer to not keep |
| + | * The benefit of the pool is that stream buffers do not keep |
| * spares. Memory consumption goes down when streams run empty, |
| * have a large upload done, etc. */ |
| #define PROXY_H3_STREAM_POOL_SPARES \ |
| @@ -90,11 +89,10 @@ |
| #define PROXY_H3_STREAM_SEND_CHUNKS \ |
| (PROXY_H3_STREAM_WINDOW_SIZE / PROXY_H3_STREAM_CHUNK_SIZE) |
| |
| - | #define PROXY_QUIC_MAX_STREAMS (256*1024) |
| - | #define PROXY_QUIC_HANDSHAKE_TIMEOUT (10*NGTCP2_SECONDS) |
| + | #define PROXY_QUIC_MAX_STREAMS (256 * 1024) |
| + | #define PROXY_QUIC_HANDSHAKE_TIMEOUT (10 * NGTCP2_SECONDS) |
| |
| - | typedef enum |
| - | { |
| + | typedef enum { |
| H3_TUNNEL_INIT, /* init/default/no tunnel state */ |
| H3_TUNNEL_CONNECT, /* CONNECT request is being sent */ |
| H3_TUNNEL_RESPONSE, /* CONNECT response received completely */ |
| @@ -104,8 +102,7 @@ typedef enum |
| |
| struct h3_proxy_stream_ctx; |
| |
| - | struct h3_tunnel_stream |
| - | { |
| + | struct h3_tunnel_stream { |
| struct http_resp *resp; |
| char *authority; |
| struct h3_proxy_stream_ctx *stream; |
| @@ -218,7 +215,7 @@ struct cf_ngtcp2_proxy_ctx { |
| struct curl_tls_ctx tls; |
| #ifdef OPENSSL_QUIC_API2 |
| ngtcp2_crypto_ossl_ctx *ossl_ctx; |
| - | #endif /* OPENSSL_QUIC_API2 */ |
| + | #endif |
| ngtcp2_path connected_path; |
| ngtcp2_conn *qconn; |
| ngtcp2_cid dcid; |
| @@ -231,33 +228,31 @@ struct cf_ngtcp2_proxy_ctx { |
| struct cf_call_data call_data; |
| nghttp3_conn *h3conn; |
| nghttp3_settings h3settings; |
| - | struct curltime started_at; /* time the current attempt started */ |
| - | struct curltime handshake_at; /* time connect handshake finished */ |
| - | struct bufc_pool stream_bufcp; /* chunk pool for streams */ |
| - | struct dynbuf scratch; /* temp buffer for header construction */ |
| - | struct uint_hash streams; |
| - | /* hash `data->mid` to `h3_proxy_stream_ctx` */ |
| - | uint64_t used_bidi_streams; /* bidi streams we have opened */ |
| - | uint64_t max_bidi_streams; /* max bidi streams we can open */ |
| - | size_t earlydata_max; /* max amount of early data supported by |
| - | server on session reuse */ |
| - | size_t earlydata_skip; /* sending bytes to skip when earlydata |
| - | is accepted by peer */ |
| - | CURLcode tls_vrfy_result; /* result of TLS peer verification */ |
| + | struct curltime started_at; /* time the current attempt started */ |
| + | struct curltime handshake_at; /* time connect handshake finished */ |
| + | struct bufc_pool stream_bufcp; /* chunk pool for streams */ |
| + | struct dynbuf scratch; /* temp buffer for header construction */ |
| + | struct uint_hash streams; /* hash data->mid to h3_proxy_stream_ctx */ |
| + | uint64_t used_bidi_streams; /* bidi streams we have opened */ |
| + | uint64_t max_bidi_streams; /* max bidi streams we can open */ |
| + | size_t earlydata_max; /* max amount of early data supported by |
| + | server on session reuse */ |
| + | size_t earlydata_skip; /* sending bytes to skip when earlydata |
| + | is accepted by peer */ |
| + | CURLcode tls_vrfy_result; /* result of TLS peer verification */ |
| int qlogfd; |
| BIT(initialized); |
| - | BIT(tls_handshake_complete); /* TLS handshake is done */ |
| - | BIT(use_earlydata); /* Using 0RTT data */ |
| - | BIT(earlydata_accepted); /* 0RTT was accepted by server */ |
| - | BIT(shutdown_started); /* queued shutdown packets */ |
| + | BIT(tls_handshake_complete); /* TLS handshake is done */ |
| + | BIT(use_earlydata); /* Using 0RTT data */ |
| + | BIT(earlydata_accepted); /* 0RTT was accepted by server */ |
| + | BIT(shutdown_started); /* queued shutdown packets */ |
| }; |
| |
| - | struct cf_h3_proxy_ctx |
| - | { |
| + | struct cf_h3_proxy_ctx { |
| struct cf_ngtcp2_proxy_ctx *ngtcp2_ctx; |
| - | struct cf_call_data call_data; /* fallback before backend ctx exists */ |
| - | struct bufq inbufq; /* network receive buffer */ |
| - | struct Curl_peer *dest; /* where to tunnel to */ |
| + | struct cf_call_data call_data; /* fallback before backend ctx exists */ |
| + | struct bufq inbufq; /* network receive buffer */ |
| + | struct Curl_peer *dest; /* where to tunnel to */ |
| struct h3_tunnel_stream tunnel; /* our tunnel CONNECT stream */ |
| BIT(connected); |
| BIT(udp_tunnel); |
| @@ -266,12 +261,11 @@ struct cf_h3_proxy_ctx |
| /** |
| * All about the H3 internals of a stream |
| */ |
| - | struct h3_proxy_stream_ctx |
| - | { |
| - | int64_t id; /* HTTP/3 stream identifier */ |
| + | struct h3_proxy_stream_ctx { |
| + | int64_t id; /* HTTP/3 stream identifier */ |
| struct bufq sendbuf; /* h3 request body */ |
| size_t sendbuf_len_in_flight; /* sendbuf amount "in flight" */ |
| - | uint64_t error3; /* HTTP/3 stream error code */ |
| + | uint64_t error3; /* HTTP/3 stream error code */ |
| curl_off_t upload_left; /* number of request bytes left to upload */ |
| curl_off_t tun_data_recvd; /* number of bytes received over tunnel */ |
| uint64_t rx_offset; /* current receive offset */ |
| @@ -286,7 +280,7 @@ struct h3_proxy_stream_ctx |
| BIT(quic_flow_blocked); /* stream is blocked by QUIC flow control */ |
| }; |
| |
| - | #define H3_PROXY_STREAM_CTX(ctx, data) \ |
| + | #define H3_PROXY_STREAM_CTX(ctx, data) \ |
| ((data) ? Curl_uint32_hash_get(&(ctx)->streams, (data)->mid) : NULL) |
| |
| #define H3_STREAM_ID(stream) ((stream)->id) |
| @@ -356,12 +350,12 @@ static void cf_ngtcp2_proxy_ctx_close(struct cf_ngtcp2_proxy_ctx *ctx) |
| ngtcp2_crypto_ossl_ctx_del(ctx->ossl_ctx); |
| ctx->ossl_ctx = NULL; |
| } |
| - | #endif /* OPENSSL_QUIC_API2 */ |
| + | #endif |
| ctx->call_data = save; |
| } |
| |
| static void cf_ngtcp2_proxy_setup_keep_alive(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data) |
| + | struct Curl_easy *data) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -393,8 +387,8 @@ static void cf_ngtcp2_proxy_setup_keep_alive(struct Curl_cfilter *cf, |
| ngtcp2_conn_set_keep_alive_timeout(ctx->qconn, keep_ns); |
| CURL_TRC_CF(data, cf, "peer idle timeout is %" PRIu64 "ms, " |
| "set keep-alive to %" PRIu64 " ms.", |
| - | (uint64_t)(rp->max_idle_timeout / NGTCP2_MILLISECONDS), |
| - | (uint64_t)(keep_ns / NGTCP2_MILLISECONDS)); |
| + | rp->max_idle_timeout / NGTCP2_MILLISECONDS, |
| + | keep_ns / NGTCP2_MILLISECONDS); |
| } |
| } |
| |
| @@ -451,10 +445,10 @@ static void proxy_quic_printf(void *user_data, const char *fmt, ...) |
| va_end(ap); |
| curl_mfprintf(stderr, "\n"); |
| } |
| - | #endif /* DEBUG_NGTCP2 */ |
| + | #endif |
| |
| static void proxy_qlog_callback(void *user_data, uint32_t flags, |
| - | const void *data, size_t datalen) |
| + | const void *data, size_t datalen) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -483,7 +477,7 @@ static void quic_settings_proxy(struct cf_ngtcp2_proxy_ctx *ctx, |
| s->log_printf = proxy_quic_printf; |
| #else |
| s->log_printf = NULL; |
| - | #endif /* DEBUG_NGTCP2 */ |
| + | #endif |
| |
| s->initial_ts = pktx->ts; |
| s->handshake_timeout = (data->set.connecttimeout > 0) ? |
| @@ -496,7 +490,7 @@ static void quic_settings_proxy(struct cf_ngtcp2_proxy_ctx *ctx, |
| /* try ten times the ngtcp2 defaults here for problems with Caddy */ |
| s->glitch_ratelim_burst = 1000 * 10; |
| s->glitch_ratelim_rate = 33 * 10; |
| - | #endif /* NGTCP2_SETTINGS_V3 */ |
| + | #endif |
| t->initial_max_data = 10 * PROXY_H3_STREAM_WINDOW_SIZE; |
| t->initial_max_stream_data_bidi_local = PROXY_H3_STREAM_WINDOW_SIZE; |
| t->initial_max_stream_data_bidi_remote = PROXY_H3_STREAM_WINDOW_SIZE; |
| @@ -510,7 +504,7 @@ static void quic_settings_proxy(struct cf_ngtcp2_proxy_ctx *ctx, |
| } |
| |
| static void cf_ngtcp2_proxy_conn_close(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data); |
| + | struct Curl_easy *data); |
| |
| static bool cf_ngtcp2_proxy_err_is_fatal(int code) |
| { |
| @@ -520,7 +514,7 @@ static bool cf_ngtcp2_proxy_err_is_fatal(int code) |
| } |
| |
| static void cf_ngtcp2_proxy_err_set(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, int code) |
| + | struct Curl_easy *data, int code) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -545,7 +539,7 @@ static bool cf_ngtcp2_proxy_h3_err_is_fatal(int code) |
| } |
| |
| static void cf_ngtcp2_proxy_h3_err_set(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, int code) |
| + | struct Curl_easy *data, int code) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -558,7 +552,6 @@ static void cf_ngtcp2_proxy_h3_err_set(struct Curl_cfilter *cf, |
| } |
| |
| /* How to access `call_data` from a cf_h3_proxy filter */ |
| - | #undef CF_CTX_CALL_DATA |
| static struct cf_call_data *cf_h3_proxy_call_data(struct Curl_cfilter *cf) |
| { |
| struct cf_h3_proxy_ctx *ctx = cf ? cf->ctx : NULL; |
| @@ -571,6 +564,7 @@ static struct cf_call_data *cf_h3_proxy_call_data(struct Curl_cfilter *cf) |
| return &ctx->call_data; |
| } |
| |
| + | #undef CF_CTX_CALL_DATA |
| #define CF_CTX_CALL_DATA(cf) (*cf_h3_proxy_call_data(cf)) |
| |
| static void cf_h3_proxy_ctx_clear(struct cf_h3_proxy_ctx *ctx) |
| @@ -590,7 +584,7 @@ static void cf_h3_proxy_ctx_free(struct cf_h3_proxy_ctx *ctx) |
| } |
| |
| static CURLcode h3_proxy_data_setup(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data) |
| + | struct Curl_easy *data) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -631,8 +625,8 @@ static CURLcode h3_proxy_data_setup(struct Curl_cfilter *cf, |
| } |
| |
| static int cb_h3_proxy_acked_req_body(nghttp3_conn *conn, int64_t stream_id, |
| - | uint64_t datalen, void *user_data, |
| - | void *stream_user_data) |
| + | uint64_t datalen, void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -667,8 +661,8 @@ static int cb_h3_proxy_acked_req_body(nghttp3_conn *conn, int64_t stream_id, |
| } |
| |
| static int cb_h3_proxy_stream_close(nghttp3_conn *conn, int64_t stream_id, |
| - | uint64_t app_error_code, void *user_data, |
| - | void *stream_user_data) |
| + | uint64_t app_error_code, void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -726,8 +720,7 @@ static void cf_h3_proxy_upd_rx_win(struct Curl_cfilter *cf, |
| if(!stream->rx_offset) |
| return; |
| |
| - | avail = Curl_rlimit_avail(&data->progress.dl.rlimit, |
| - | Curl_pgrs_now(data)); |
| + | avail = Curl_rlimit_avail(&data->progress.dl.rlimit, Curl_pgrs_now(data)); |
| if(avail <= 0) { |
| /* nothing available, do not extend the rx offset */ |
| CURL_TRC_CF(data, cf, "[%" PRId64 "] dl rate limit exhausted (%" PRId64 |
| @@ -762,8 +755,8 @@ static void cf_h3_proxy_upd_rx_win(struct Curl_cfilter *cf, |
| } |
| |
| static int cb_h3_proxy_recv_data(nghttp3_conn *conn, int64_t stream3_id, |
| - | const uint8_t *buf, size_t buflen, |
| - | void *user_data, void *stream_user_data) |
| + | const uint8_t *buf, size_t buflen, |
| + | void *user_data, void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -808,8 +801,8 @@ static int cb_h3_proxy_recv_data(nghttp3_conn *conn, int64_t stream3_id, |
| } |
| |
| static int cb_h3_proxy_deferred_consume(nghttp3_conn *conn, int64_t stream_id, |
| - | size_t consumed, void *user_data, |
| - | void *stream_user_data) |
| + | size_t consumed, void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -828,13 +821,12 @@ static int cb_h3_proxy_deferred_consume(nghttp3_conn *conn, int64_t stream_id, |
| return 0; |
| } |
| |
| - | static int cb_h3_proxy_recv_header(nghttp3_conn *conn, int64_t sid, |
| - | int32_t token, nghttp3_rcbuf *name, |
| - | nghttp3_rcbuf *value, uint8_t flags, |
| - | void *user_data, void *stream_user_data) |
| + | static int cb_h3_proxy_recv_header(nghttp3_conn *conn, int64_t stream_id, |
| + | int32_t token, nghttp3_rcbuf *name, |
| + | nghttp3_rcbuf *value, uint8_t flags, |
| + | void *user_data, void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| - | int64_t stream_id = sid; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| nghttp3_vec h3name = nghttp3_rcbuf_get_buf(name); |
| @@ -888,12 +880,11 @@ static int cb_h3_proxy_recv_header(nghttp3_conn *conn, int64_t sid, |
| } |
| else { |
| /* store as an HTTP1-style header */ |
| - | CURL_TRC_CF(data, cf, "[%" PRId64 "] header: %.*s: %.*s", |
| - | stream_id, (int)h3name.len, h3name.base, |
| - | (int)h3val.len, h3val.base); |
| + | CURL_TRC_CF(data, cf, "[%" PRId64 "] header: %.*s: %.*s", stream_id, |
| + | (int)h3name.len, h3name.base, (int)h3val.len, h3val.base); |
| result = Curl_dynhds_add(&proxy_ctx->tunnel.resp->headers, |
| - | (const char *)h3name.base, h3name.len, |
| - | (const char *)h3val.base, h3val.len); |
| + | (const char *)h3name.base, h3name.len, |
| + | (const char *)h3val.base, h3val.len); |
| if(result) { |
| return -1; |
| } |
| @@ -901,14 +892,14 @@ static int cb_h3_proxy_recv_header(nghttp3_conn *conn, int64_t sid, |
| return 0; |
| } |
| |
| - | static int cb_h3_proxy_end_headers(nghttp3_conn *conn, int64_t sid, |
| - | int fin, void *user_data, void *stream_user_data) |
| + | static int cb_h3_proxy_end_headers(nghttp3_conn *conn, int64_t stream_id, |
| + | int fin, void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| struct Curl_easy *data = stream_user_data; |
| - | int64_t stream_id = sid; |
| struct h3_proxy_stream_ctx *stream; |
| (void)conn; |
| (void)stream_id; |
| @@ -932,8 +923,8 @@ static int cb_h3_proxy_end_headers(nghttp3_conn *conn, int64_t sid, |
| if(!stream) |
| return 0; |
| |
| - | CURL_TRC_CF(data, cf, "[%" PRId64 "] end_headers, status=%d", |
| - | stream_id, stream->status_code); |
| + | CURL_TRC_CF(data, cf, "[%" PRId64 "] end_headers, status=%d", stream_id, |
| + | stream->status_code); |
| |
| if(!proxy_ctx->tunnel.has_final_response) { |
| if(stream->status_code / 100 != 1) { |
| @@ -949,9 +940,9 @@ static int cb_h3_proxy_end_headers(nghttp3_conn *conn, int64_t sid, |
| return 0; |
| } |
| |
| - | static int cb_h3_proxy_stop_sending(nghttp3_conn *conn, int64_t sid, |
| - | uint64_t app_error_code, void *user_data, |
| - | void *stream_user_data) |
| + | static int cb_h3_proxy_stop_sending(nghttp3_conn *conn, int64_t stream_id, |
| + | uint64_t app_error_code, void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -961,7 +952,7 @@ static int cb_h3_proxy_stop_sending(nghttp3_conn *conn, int64_t sid, |
| (void)stream_user_data; |
| |
| if(ctx) { |
| - | int rv = ngtcp2_conn_shutdown_stream_read(ctx->qconn, 0, sid, |
| + | int rv = ngtcp2_conn_shutdown_stream_read(ctx->qconn, 0, stream_id, |
| app_error_code); |
| |
| if(rv && rv != NGTCP2_ERR_STREAM_NOT_FOUND) { |
| @@ -972,15 +963,14 @@ static int cb_h3_proxy_stop_sending(nghttp3_conn *conn, int64_t sid, |
| return 0; |
| } |
| |
| - | static int cb_h3_proxy_reset_stream(nghttp3_conn *conn, int64_t sid, |
| - | uint64_t app_error_code, void *user_data, |
| - | void *stream_user_data) |
| + | static int cb_h3_proxy_reset_stream(nghttp3_conn *conn, int64_t stream_id, |
| + | uint64_t app_error_code, void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| struct Curl_easy *data = stream_user_data; |
| - | int64_t stream_id = sid; |
| int rv; |
| (void)conn; |
| |
| @@ -1001,11 +991,13 @@ static int cb_h3_proxy_reset_stream(nghttp3_conn *conn, int64_t sid, |
| return 0; |
| } |
| |
| - | static nghttp3_ssize |
| - | cb_h3_read_data_for_tunnel_stream(nghttp3_conn *conn, int64_t stream_id, |
| - | nghttp3_vec *vec, size_t veccnt, |
| - | uint32_t *pflags, void *user_data, |
| - | void *stream_user_data) |
| + | static nghttp3_ssize cb_h3_read_data_for_tunnel_stream(nghttp3_conn *conn, |
| + | int64_t stream_id, |
| + | nghttp3_vec *vec, |
| + | size_t veccnt, |
| + | uint32_t *pflags, |
| + | void *user_data, |
| + | void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| @@ -1094,14 +1086,14 @@ static nghttp3_callbacks ngh3_proxy_callbacks = { |
| cb_h3_proxy_reset_stream, |
| NULL, /* shutdown */ |
| NULL, /* recv_settings (deprecated) */ |
| - | #ifdef NGHTTP3_CALLBACKS_V2 /* nghttp3 v1.11.0+ */ |
| + | #ifdef NGHTTP3_CALLBACKS_V2 /* nghttp3 v1.11.0+ */ |
| NULL, /* recv_origin */ |
| NULL, /* end_origin */ |
| NULL, /* rand */ |
| - | #endif /* NGHTTP3_CALLBACKS_V2 */ |
| + | #endif |
| #ifdef NGHTTP3_CALLBACKS_V3 /* nghttp3 v1.14.0+ */ |
| NULL, /* recv_settings2 */ |
| - | #endif /* NGHTTP3_CALLBACKS_V3 */ |
| + | #endif |
| }; |
| |
| #if NGTCP2_VERSION_NUM < 0x011100 |
| @@ -1111,8 +1103,7 @@ struct cf_ngtcp2_proxy_sfind_ctx { |
| uint32_t mid; |
| }; |
| |
| - | static bool cf_ngtcp2_proxy_sfind(uint32_t mid, void *value, |
| - | void *user_data) |
| + | static bool cf_ngtcp2_proxy_sfind(uint32_t mid, void *value, void *user_data) |
| { |
| struct cf_ngtcp2_proxy_sfind_ctx *fctx = user_data; |
| struct h3_proxy_stream_ctx *stream = value; |
| @@ -1125,8 +1116,8 @@ static bool cf_ngtcp2_proxy_sfind(uint32_t mid, void *value, |
| return TRUE; /* continue */ |
| } |
| |
| - | static struct h3_proxy_stream_ctx * |
| - | cf_ngtcp2_proxy_get_stream(struct cf_ngtcp2_proxy_ctx *ctx, int64_t stream_id) |
| + | static struct h3_proxy_stream_ctx *cf_ngtcp2_proxy_get_stream( |
| + | struct cf_ngtcp2_proxy_ctx *ctx, int64_t stream_id) |
| { |
| struct cf_ngtcp2_proxy_sfind_ctx fctx; |
| fctx.stream_id = stream_id; |
| @@ -1135,8 +1126,8 @@ cf_ngtcp2_proxy_get_stream(struct cf_ngtcp2_proxy_ctx *ctx, int64_t stream_id) |
| return fctx.stream; |
| } |
| #else |
| - | static struct h3_proxy_stream_ctx * |
| - | cf_ngtcp2_proxy_get_stream(struct cf_ngtcp2_proxy_ctx *ctx, int64_t stream_id) |
| + | static struct h3_proxy_stream_ctx *cf_ngtcp2_proxy_get_stream( |
| + | struct cf_ngtcp2_proxy_ctx *ctx, int64_t stream_id) |
| { |
| struct Curl_easy *data = |
| ngtcp2_conn_get_stream_user_data(ctx->qconn, stream_id); |
| @@ -1204,8 +1195,7 @@ static CURLcode cf_ngtcp2_h3conn_init(struct Curl_cfilter *cf, |
| rc = nghttp3_conn_bind_qpack_streams(ctx->h3conn, qpack_enc_stream_id, |
| qpack_dec_stream_id); |
| if(rc) { |
| - | failf(data, "error binding HTTP/3 qpack streams: %s", |
| - | ngtcp2_strerror(rc)); |
| + | failf(data, "error binding HTTP/3 qpack streams: %s", ngtcp2_strerror(rc)); |
| return CURLE_QUIC_CONNECT_ERROR; |
| } |
| |
| @@ -1260,7 +1250,7 @@ static int cb_ngtcp2_proxy_handshake_completed(ngtcp2_conn *tconn, |
| #ifdef USE_GNUTLS |
| int flags = gnutls_session_get_flags(ctx->tls.gtls.session); |
| ctx->earlydata_accepted = !!(flags & GNUTLS_SFLAGS_EARLY_DATA); |
| - | #endif /* USE_GNUTLS */ |
| + | #endif |
| #ifdef USE_WOLFSSL |
| #ifdef WOLFSSL_EARLY_DATA |
| ctx->earlydata_accepted = |
| @@ -1270,7 +1260,7 @@ static int cb_ngtcp2_proxy_handshake_completed(ngtcp2_conn *tconn, |
| DEBUGASSERT(0); /* should not come here if ED is disabled. */ |
| ctx->earlydata_accepted = FALSE; |
| #endif /* WOLFSSL_EARLY_DATA */ |
| - | #endif /* USE_WOLFSSL */ |
| + | #endif |
| CURL_TRC_CF(data, cf, "server did%s accept %zu bytes of early data", |
| ctx->earlydata_accepted ? "" : " not", ctx->earlydata_skip); |
| Curl_pgrsEarlyData(data, ctx->earlydata_accepted ? |
| @@ -1291,14 +1281,13 @@ static int cb_ngtcp2_proxy_handshake_completed(ngtcp2_conn *tconn, |
| } |
| |
| static int cb_ngtcp2_recv_stream_data(ngtcp2_conn *tconn, uint32_t flags, |
| - | int64_t sid, uint64_t offset, |
| + | int64_t stream_id, uint64_t offset, |
| const uint8_t *buf, size_t buflen, |
| void *user_data, void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| - | int64_t stream_id = (int64_t)sid; |
| nghttp3_ssize nconsumed; |
| int fin = (flags & NGTCP2_STREAM_DATA_FLAG_FIN) ? 1 : 0; |
| struct Curl_easy *data = stream_user_data; |
| @@ -1326,9 +1315,8 @@ static int cb_ngtcp2_recv_stream_data(ngtcp2_conn *tconn, uint32_t flags, |
| * including QPACK HEADERS. In other words, it does not consume payload of |
| * DATA frame. */ |
| if(nconsumed) { |
| - | ngtcp2_conn_extend_max_stream_offset(tconn, stream_id, |
| - | (uint64_t)nconsumed); |
| - | ngtcp2_conn_extend_max_offset(tconn, (uint64_t)nconsumed); |
| + | ngtcp2_conn_extend_max_stream_offset(tconn, stream_id, nconsumed); |
| + | ngtcp2_conn_extend_max_offset(tconn, nconsumed); |
| } |
| |
| return 0; |
| @@ -1359,14 +1347,13 @@ static int cb_ngtcp2_acked_stream_data_offset(ngtcp2_conn *tconn, |
| } |
| |
| static int cb_ngtcp2_stream_close(ngtcp2_conn *tconn, uint32_t flags, |
| - | int64_t sid, uint64_t app_error_code, |
| + | int64_t stream_id, uint64_t app_error_code, |
| void *user_data, void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| struct Curl_easy *data = stream_user_data; |
| - | int64_t stream_id = (int64_t)sid; |
| int rv; |
| |
| (void)tconn; |
| @@ -1382,8 +1369,7 @@ static int cb_ngtcp2_stream_close(ngtcp2_conn *tconn, uint32_t flags, |
| |
| rv = nghttp3_conn_close_stream(ctx->h3conn, stream_id, app_error_code); |
| CURL_TRC_CF(data, cf, "[%" PRId64 "] quic close(app_error=%" |
| - | PRIu64 ") -> %d", stream_id, (uint64_t)app_error_code, |
| - | rv); |
| + | PRIu64 ") -> %d", stream_id, app_error_code, rv); |
| if(rv && rv != NGHTTP3_ERR_STREAM_NOT_FOUND) { |
| cf_ngtcp2_proxy_h3_err_set(cf, data, rv); |
| return NGTCP2_ERR_CALLBACK_FAILURE; |
| @@ -1403,9 +1389,8 @@ static int cb_ngtcp2_extend_max_local_streams_bidi(ngtcp2_conn *tconn, |
| (void)tconn; |
| ctx->max_bidi_streams = max_streams; |
| if(data) |
| - | CURL_TRC_CF(data, cf, "max bidi streams now %" PRIu64 |
| - | ", used %" PRIu64, (uint64_t)ctx->max_bidi_streams, |
| - | (uint64_t)ctx->used_bidi_streams); |
| + | CURL_TRC_CF(data, cf, "max bidi streams now %" PRIu64 ", used %" PRIu64, |
| + | ctx->max_bidi_streams, ctx->used_bidi_streams); |
| return 0; |
| } |
| |
| @@ -1466,14 +1451,13 @@ static int cb_ngtcp2_get_new_connection_id2(ngtcp2_conn *tconn, |
| } |
| #endif |
| |
| - | static int cb_ngtcp2_stream_reset(ngtcp2_conn *tconn, int64_t sid, |
| + | static int cb_ngtcp2_stream_reset(ngtcp2_conn *tconn, int64_t stream_id, |
| uint64_t final_size, uint64_t app_error_code, |
| void *user_data, void *stream_user_data) |
| { |
| struct Curl_cfilter *cf = user_data; |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| - | int64_t stream_id = (int64_t)sid; |
| struct Curl_easy *data = stream_user_data; |
| int rv; |
| (void)tconn; |
| @@ -1514,7 +1498,7 @@ static int cb_ngtcp2_extend_max_stream_data(ngtcp2_conn *tconn, |
| stream = H3_PROXY_STREAM_CTX(ctx, s_data); |
| if(stream && stream->quic_flow_blocked) { |
| CURL_TRC_CF(s_data, cf, "[%" PRId64 "] unblock quic flow", |
| - | (int64_t)stream_id); |
| + | stream_id); |
| stream->quic_flow_blocked = FALSE; |
| Curl_multi_mark_dirty(s_data); |
| } |
| @@ -1611,13 +1595,13 @@ static ngtcp2_callbacks ngtcp2_proxy_callbacks = { |
| NULL, /* early_data_rejected */ |
| #ifdef NGTCP2_CALLBACKS_V2 /* ngtcp2 v1.14.0+ */ |
| NULL, /* begin_path_validation */ |
| - | #endif /* NGTCP2_CALLBACKS_V2 */ |
| + | #endif |
| #ifdef NGTCP2_CALLBACKS_V3 /* ngtcp2 v1.22.0+ */ |
| NULL, /* recv_stateless_reset2 */ |
| cb_ngtcp2_get_new_connection_id2, /* get_new_connection_id2 */ |
| NULL, /* dcid_status2 */ |
| ngtcp2_crypto_get_path_challenge_data2_cb, /* get_path_challenge_data2 */ |
| - | #endif /* NGTCP2_CALLBACKS_V3 */ |
| + | #endif |
| }; |
| |
| #if defined(_MSC_VER) && defined(_DLL) |
| @@ -1642,7 +1626,7 @@ static CURLcode cf_ngtcp2_recv_pkts_proxy(const unsigned char *buf, |
| CURL_TRC_CF(pktx->data, pktx->cf, "vquic_recv(len=%zu, gso=%zu, ecn=%x)", |
| buflen, gso_size, ecn); |
| ngtcp2_addr_init(&path.local, (struct sockaddr *)&ctx->q.local_addr, |
| - | (socklen_t)ctx->q.local_addrlen); |
| + | ctx->q.local_addrlen); |
| ngtcp2_addr_init(&path.remote, (struct sockaddr *)remote_addr, |
| remote_addrlen); |
| pi.ecn = (uint8_t)ecn; |
| @@ -1705,8 +1689,8 @@ static CURLcode proxy_h3_progress_ingress_ngtcp2(struct Curl_cfilter *cf, |
| * Return number of bytes written or -1 with *err set. |
| */ |
| static CURLcode proxy_read_pkt_to_send(void *userp, |
| - | unsigned char *buf, size_t buflen, |
| - | size_t *pnread) |
| + | unsigned char *buf, size_t buflen, |
| + | size_t *pnread) |
| { |
| struct proxy_pkt_io_ctx *x = userp; |
| struct cf_h3_proxy_ctx *proxy_ctx = x->cf->ctx; |
| @@ -1757,11 +1741,11 @@ static CURLcode proxy_read_pkt_to_send(void *userp, |
| else if(n < 0) { |
| switch(n) { |
| case NGTCP2_ERR_STREAM_DATA_BLOCKED: { |
| - | struct h3_proxy_stream_ctx *stream = NULL; |
| + | struct h3_proxy_stream_ctx *stream; |
| DEBUGASSERT(ndatalen == -1); |
| nghttp3_conn_block_stream(ctx->h3conn, stream_id); |
| CURL_TRC_CF(x->data, x->cf, "[%" PRId64 "] block quic flow", |
| - | (int64_t)stream_id); |
| + | stream_id); |
| stream = cf_ngtcp2_proxy_get_stream(ctx, stream_id); |
| if(stream) /* it might be not one of our h3 streams? */ |
| stream->quic_flow_blocked = TRUE; |
| @@ -1851,7 +1835,7 @@ static CURLcode proxy_h3_progress_egress_ngtcp2(struct Curl_cfilter *cf, |
| */ |
| max_payload_size = ngtcp2_conn_get_max_tx_udp_payload_size(ctx->qconn); |
| path_max_payload_size = |
| - | ngtcp2_conn_get_path_max_tx_udp_payload_size(ctx->qconn); |
| + | ngtcp2_conn_get_path_max_tx_udp_payload_size(ctx->qconn); |
| send_quantum = ngtcp2_conn_get_send_quantum(ctx->qconn); |
| CURL_TRC_CF(data, cf, "egress, collect and send packets, quantum=%zu", |
| send_quantum); |
| @@ -1867,7 +1851,7 @@ static CURLcode proxy_h3_progress_egress_ngtcp2(struct Curl_cfilter *cf, |
| size_t buflen = Curl_bufq_len(&ctx->q.sendbuf); |
| if((buflen >= send_quantum) || |
| ((buflen + gsolen) >= ctx->q.sendbuf.chunk_size)) |
| - | break; |
| + | break; |
| DEBUGASSERT(nread > 0); |
| ++pktcnt; |
| if(pktcnt == 1) { |
| @@ -1918,7 +1902,7 @@ static CURLcode proxy_h3_progress_egress_ngtcp2(struct Curl_cfilter *cf, |
| } |
| |
| static CURLcode cf_ngtcp2_proxy_shutdown(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, bool *done) |
| + | struct Curl_easy *data, bool *done) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -1969,7 +1953,7 @@ static CURLcode cf_ngtcp2_proxy_shutdown(struct Curl_cfilter *cf, |
| &ctx->last_error, pktx.ts); |
| CURL_TRC_CF(data, cf, "start shutdown(err_type=%d, err_code=%" |
| PRIu64 ") -> %zd", ctx->last_error.type, |
| - | (uint64_t)ctx->last_error.error_code, (ssize_t)nwritten); |
| + | ctx->last_error.error_code, (ssize_t)nwritten); |
| /* there are cases listed in ngtcp2 documentation where this call |
| * may fail. Since we are doing a connection shutdown as graceful |
| * as we can, such an error is ignored here. */ |
| @@ -2020,7 +2004,7 @@ out: |
| } |
| |
| static void cf_ngtcp2_proxy_conn_close(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data) |
| + | struct Curl_easy *data) |
| { |
| bool done; |
| cf_ngtcp2_proxy_shutdown(cf, data, &done); |
| @@ -2044,8 +2028,8 @@ static void cf_ngtcp2_proxy_close(struct Curl_cfilter *cf, |
| } |
| |
| static void cf_ngtcp2_proxy_stream_close(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, |
| - | struct h3_proxy_stream_ctx *stream) |
| + | struct Curl_easy *data, |
| + | struct h3_proxy_stream_ctx *stream) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -2136,9 +2120,9 @@ static CURLcode check_and_set_expiry_ngtcp2(struct Curl_cfilter *cf, |
| } |
| |
| static ssize_t proxy_recv_closed_stream(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, |
| - | struct h3_proxy_stream_ctx *stream, |
| - | CURLcode *err) |
| + | struct Curl_easy *data, |
| + | struct h3_proxy_stream_ctx *stream, |
| + | CURLcode *err) |
| { |
| ssize_t nread = -1; |
| *err = CURLE_OK; |
| @@ -2180,10 +2164,10 @@ out: |
| return nread; |
| } |
| |
| - | static struct h3_proxy_stream_ctx * |
| - | h3_proxy_resolve_send_stream(struct cf_h3_proxy_ctx *proxy_ctx, |
| - | struct cf_ngtcp2_proxy_ctx *ctx, |
| - | struct Curl_easy *data) |
| + | static struct h3_proxy_stream_ctx *h3_proxy_resolve_send_stream( |
| + | struct cf_h3_proxy_ctx *proxy_ctx, |
| + | struct cf_ngtcp2_proxy_ctx *ctx, |
| + | struct Curl_easy *data) |
| { |
| struct h3_proxy_stream_ctx *stream = H3_PROXY_STREAM_CTX(ctx, data); |
| |
| @@ -2328,8 +2312,7 @@ static CURLcode cf_h3_proxy_recv(struct Curl_cfilter *cf, |
| } |
| |
| if(!Curl_bufq_is_empty(&proxy_ctx->inbufq)) { |
| - | result = Curl_bufq_cread(&proxy_ctx->inbufq, |
| - | buf, len, pnread); |
| + | result = Curl_bufq_cread(&proxy_ctx->inbufq, buf, len, pnread); |
| if(result) |
| goto out; |
| } |
| @@ -2340,8 +2323,7 @@ static CURLcode cf_h3_proxy_recv(struct Curl_cfilter *cf, |
| |
| /* inbufq had nothing before, maybe after progressing ingress? */ |
| if(!*pnread && !Curl_bufq_is_empty(&proxy_ctx->inbufq)) { |
| - | result = Curl_bufq_cread(&proxy_ctx->inbufq, |
| - | buf, len, pnread); |
| + | result = Curl_bufq_cread(&proxy_ctx->inbufq, buf, len, pnread); |
| if(result) { |
| CURL_TRC_CF(data, cf, "[%" PRId64 "] read inbufq(len=%zu) " |
| "-> %zd, %d", |
| @@ -2355,8 +2337,7 @@ static CURLcode cf_h3_proxy_recv(struct Curl_cfilter *cf, |
| } |
| else { |
| if(stream->xfer_result) { |
| - | CURL_TRC_CF(data, cf, "[%" PRId64 "] xfer write failed", |
| - | stream->id); |
| + | CURL_TRC_CF(data, cf, "[%" PRId64 "] xfer write failed", stream->id); |
| cf_ngtcp2_proxy_stream_close(cf, data, stream); |
| result = stream->xfer_result; |
| goto out; |
| @@ -2451,7 +2432,7 @@ static void proxy_h3_submit(int64_t *pstream_id, |
| *err = CURLE_SEND_ERROR; |
| goto out; |
| } |
| - | stream->id = (int64_t)sid; |
| + | stream->id = sid; |
| ++ctx->used_bidi_streams; |
| |
| /* Set stream user data in ngtcp2 connection for callbacks */ |
| @@ -2668,8 +2649,9 @@ static CURLcode cf_ngtcp2_proxy_adjust_pollset(struct Curl_cfilter *cf, |
| bool c_exhaust, s_exhaust; |
| |
| CF_DATA_SAVE(save, cf, data); |
| - | c_exhaust = want_send && (!ngtcp2_conn_get_cwnd_left(ctx->qconn) || |
| - | !ngtcp2_conn_get_max_data_left(ctx->qconn)); |
| + | c_exhaust = want_send && |
| + | (!ngtcp2_conn_get_cwnd_left(ctx->qconn) || |
| + | !ngtcp2_conn_get_max_data_left(ctx->qconn)); |
| s_exhaust = want_send && stream && H3_STREAM_ID(stream) >= 0 && |
| stream->quic_flow_blocked; |
| want_recv = (want_recv || c_exhaust || s_exhaust); |
| @@ -2726,8 +2708,8 @@ static int proxy_quic_ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid) |
| { |
| ngtcp2_crypto_conn_ref *cref; |
| struct Curl_cfilter *cf; |
| - | struct cf_h3_proxy_ctx *proxy_ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx; |
| + | struct cf_h3_proxy_ctx *proxy_ctx; |
| struct Curl_easy *data; |
| |
| cref = (ngtcp2_crypto_conn_ref *)SSL_get_app_data(ssl); |
| @@ -2751,7 +2733,7 @@ static int proxy_quic_ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid) |
| quic_tp = (unsigned char *)tpbuf; |
| quic_tp_len = (size_t)tplen; |
| } |
| - | #endif /* HAVE_OPENSSL_EARLYDATA */ |
| + | #endif |
| Curl_ossl_add_session(cf, data, ctx->peer.scache_key, ssl_sessionid, |
| SSL_version(ssl), "h3", quic_tp, quic_tp_len); |
| } |
| @@ -2766,7 +2748,7 @@ static CURLcode cf_ngtcp2_proxy_tls_ctx_setup(struct Curl_cfilter *cf, |
| struct curl_tls_ctx *ctx = user_data; |
| |
| #ifdef USE_OPENSSL |
| - | #if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC) |
| + | #if defined(OPENSSL_IS_AWSLC) || defined(OPENSSL_IS_BORINGSSL) |
| if(ngtcp2_crypto_boringssl_configure_client_context(ctx->ossl.ssl_ctx) |
| != 0) { |
| failf(data, "ngtcp2_crypto_boringssl_configure_client_context failed"); |
| @@ -2779,7 +2761,7 @@ static CURLcode cf_ngtcp2_proxy_tls_ctx_setup(struct Curl_cfilter *cf, |
| failf(data, "ngtcp2_crypto_quictls_configure_client_context failed"); |
| return CURLE_FAILED_INIT; |
| } |
| - | #endif |
| + | #endif /* !OPENSSL_IS_AWSLC && !OPENSSL_IS_BORINGSSL */ |
| if(Curl_ssl_scache_use(cf, data)) { |
| SSL_CTX_set_session_cache_mode(ctx->ossl.ssl_ctx, |
| SSL_SESS_CACHE_CLIENT | |
| @@ -2795,10 +2777,10 @@ static CURLcode cf_ngtcp2_proxy_tls_ctx_setup(struct Curl_cfilter *cf, |
| } |
| |
| static CURLcode cf_ngtcp2_proxy_on_session_reuse(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, |
| - | struct alpn_spec *alpns, |
| - | struct Curl_ssl_session *scs, |
| - | bool *do_early_data) |
| + | struct Curl_easy *data, |
| + | struct alpn_spec *alpns, |
| + | struct Curl_ssl_session *scs, |
| + | bool *do_early_data) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| struct cf_ngtcp2_proxy_ctx *ctx = proxy_ctx->ngtcp2_ctx; |
| @@ -2811,24 +2793,24 @@ static CURLcode cf_ngtcp2_proxy_on_session_reuse(struct Curl_cfilter *cf, |
| #ifdef USE_GNUTLS |
| ctx->earlydata_max = |
| gnutls_record_get_max_early_data_size(ctx->tls.gtls.session); |
| - | #endif /* USE_GNUTLS */ |
| + | #endif |
| #ifdef USE_WOLFSSL |
| #ifdef WOLFSSL_EARLY_DATA |
| ctx->earlydata_max = scs->earlydata_max; |
| #else |
| ctx->earlydata_max = 0; |
| #endif /* WOLFSSL_EARLY_DATA */ |
| - | #endif /* USE_WOLFSSL */ |
| + | #endif |
| #if defined(USE_GNUTLS) || defined(USE_WOLFSSL) || \ |
| - | (defined(USE_OPENSSL) && defined(HAVE_OPENSSL_EARLYDATA)) |
| - | if((!ctx->earlydata_max)) { |
| + | (defined(USE_OPENSSL) && defined(HAVE_OPENSSL_EARLYDATA)) |
| + | if(!ctx->earlydata_max) { |
| CURL_TRC_CF(data, cf, "SSL session does not allow earlydata"); |
| } |
| else if(!Curl_alpn_contains_proto(alpns, scs->alpn)) { |
| CURL_TRC_CF(data, cf, "SSL session from different ALPN, no early data"); |
| } |
| else if(!scs->quic_tp || !scs->quic_tp_len) { |
| - | CURL_TRC_CF(data, cf, "no 0RTT transport parameters, no early data, "); |
| + | CURL_TRC_CF(data, cf, "no 0RTT transport parameters, no early data"); |
| } |
| else { |
| int rv; |
| @@ -2867,7 +2849,7 @@ static CURLcode cf_h3_proxy_ctx_init(struct Curl_cfilter *cf, |
| CURLcode result = CURLE_OK; |
| const struct Curl_sockaddr_ex *sockaddr = NULL; |
| int qfd; |
| - | static const struct alpn_spec ALPN_SPEC_H3 = {{ "h3", "h3-29" }, 2}; |
| + | static const struct alpn_spec ALPN_SPEC_H3 = { { "h3", "h3-29" }, 2 }; |
| struct proxy_pkt_io_ctx pktx; |
| |
| ctx = curlx_calloc(1, sizeof(struct cf_ngtcp2_proxy_ctx)); |
| @@ -2913,7 +2895,7 @@ static CURLcode cf_h3_proxy_ctx_init(struct Curl_cfilter *cf, |
| goto out; |
| /* Get remote address from the socket filter below */ |
| if(cf->next->cft->query(cf->next, data, CF_QUERY_REMOTE_ADDR, NULL, |
| - | CURL_UNCONST(&sockaddr))) |
| + | CURL_UNCONST(&sockaddr))) |
| goto out; |
| if(!sockaddr) |
| goto out; |
| @@ -2996,8 +2978,8 @@ out: |
| } |
| |
| static CURLcode h3_submit_CONNECT(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, |
| - | struct h3_tunnel_stream *ts) |
| + | struct Curl_easy *data, |
| + | struct h3_tunnel_stream *ts) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| CURLcode result; |
| @@ -3023,10 +3005,9 @@ out: |
| return result; |
| } |
| |
| - | static CURLcode |
| - | h3_proxy_inspect_response(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, |
| - | struct h3_tunnel_stream *ts) |
| + | static CURLcode h3_proxy_inspect_response(struct Curl_cfilter *cf, |
| + | struct Curl_easy *data, |
| + | struct h3_tunnel_stream *ts) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| proxy_inspect_result res; |
| @@ -3126,9 +3107,8 @@ out: |
| |
| result = CURLE_COULDNT_CONNECT; |
| if(cerr) { |
| - | CURL_TRC_CF(data, cf, "connect error, type=%d, code=%" |
| - | PRIu64, |
| - | cerr->type, (uint64_t)cerr->error_code); |
| + | CURL_TRC_CF(data, cf, "connect error, type=%d, code=%" PRIu64, |
| + | cerr->type, cerr->error_code); |
| switch(cerr->type) { |
| case NGTCP2_CCERR_TYPE_VERSION_NEGOTIATION: |
| CURL_TRC_CF(data, cf, "error in version negotiation"); |
| @@ -3242,13 +3222,11 @@ out: |
| return result; |
| } |
| |
| - | static CURLcode |
| - | cf_h3_proxy_connect(struct Curl_cfilter *cf, |
| - | struct Curl_easy *data, |
| - | bool *done) |
| + | static CURLcode cf_h3_proxy_connect(struct Curl_cfilter *cf, |
| + | struct Curl_easy *data, bool *done) |
| { |
| struct cf_h3_proxy_ctx *proxy_ctx = cf->ctx; |
| - | struct cf_call_data save = {0}; |
| + | struct cf_call_data save = { 0 }; |
| CURLcode result = CURLE_OK; |
| timediff_t check; |
| struct h3_tunnel_stream *ts = &proxy_ctx->tunnel; |
| @@ -3318,8 +3296,7 @@ static void h3_proxy_data_done(struct Curl_cfilter *cf, struct Curl_easy *data) |
| |
| stream = H3_PROXY_STREAM_CTX(ctx, data); |
| if(stream) { |
| - | CURL_TRC_CF(data, cf, "[%" PRId64 "] easy handle is done", |
| - | stream->id); |
| + | CURL_TRC_CF(data, cf, "[%" PRId64 "] easy handle is done", stream->id); |
| cf_ngtcp2_proxy_stream_close(cf, data, stream); |
| Curl_uint32_hash_remove(&ctx->streams, data->mid); |
| if(!Curl_uint32_hash_count(&ctx->streams)) |
| @@ -3420,21 +3397,21 @@ static CURLcode cf_h3_proxy_shutdown(struct Curl_cfilter *cf, |
| } |
| |
| struct Curl_cftype Curl_cft_h3_proxy = { |
| - | "H3-PROXY", |
| - | CF_TYPE_IP_CONNECT | CF_TYPE_PROXY | CF_TYPE_SSL, |
| - | CURL_LOG_LVL_NONE, |
| - | cf_h3_proxy_destroy, |
| - | cf_h3_proxy_connect, |
| - | cf_h3_proxy_close, |
| - | cf_h3_proxy_shutdown, |
| - | cf_h3_proxy_adjust_pollset, |
| - | cf_h3_proxy_data_pending, |
| - | cf_h3_proxy_send, |
| - | cf_h3_proxy_recv, |
| - | cf_h3_proxy_cntrl, |
| - | cf_h3_proxy_is_alive, |
| - | Curl_cf_def_conn_keep_alive, |
| - | cf_h3_proxy_query, |
| + | "H3-PROXY", |
| + | CF_TYPE_IP_CONNECT | CF_TYPE_PROXY | CF_TYPE_SSL, |
| + | CURL_LOG_LVL_NONE, |
| + | cf_h3_proxy_destroy, |
| + | cf_h3_proxy_connect, |
| + | cf_h3_proxy_close, |
| + | cf_h3_proxy_shutdown, |
| + | cf_h3_proxy_adjust_pollset, |
| + | cf_h3_proxy_data_pending, |
| + | cf_h3_proxy_send, |
| + | cf_h3_proxy_recv, |
| + | cf_h3_proxy_cntrl, |
| + | cf_h3_proxy_is_alive, |
| + | Curl_cf_def_conn_keep_alive, |
| + | cf_h3_proxy_query, |
| }; |
| |
| CURLcode Curl_cf_h3_proxy_insert_after(struct Curl_cfilter *cf_at, |
| @@ -3473,6 +3450,3 @@ out: |
| } |
| |
| #endif |
| - | |
| - | /* Do not leak this filter's call_data accessor in unity builds. */ |
| - | #undef CF_CTX_CALL_DATA |