ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http init quic stream");
- phc = c->quic->parent->data;
+ phc = ngx_http_quic_get_connection(c);
if (phc->ssl_servername) {
hc->ssl_servername = phc->ssl_servername;
#define NGX_HTTP_QUIC_ALPN_DRAFT_FMT "\x05hq-%02uD"
+#define ngx_http_quic_get_connection(c) \
+ ((ngx_http_connection_t *) (c)->quic->parent->data)
+
+
ngx_int_t ngx_http_quic_init(ngx_connection_t *c);
typedef struct ngx_http_chunked_s ngx_http_chunked_t;
typedef struct ngx_http_v2_stream_s ngx_http_v2_stream_t;
typedef struct ngx_http_v3_parse_s ngx_http_v3_parse_t;
+typedef struct ngx_http_v3_connection_s
+ ngx_http_v3_connection_t;
typedef ngx_int_t (*ngx_http_header_handler_pt)(ngx_http_request_t *r,
ngx_table_elt_t *h, ngx_uint_t offset);
#endif
#endif
+#if (NGX_HTTP_V3 || NGX_COMPAT)
+ ngx_http_v3_connection_t *v3_session;
+#endif
+
ngx_chain_t *busy;
ngx_int_t nbusy;
unsigned ssl:1;
unsigned proxy_protocol:1;
- unsigned http3:1;
} ngx_http_connection_t;
#define NGX_HTTP_V3_ERR_DECODER_STREAM_ERROR 0x202
-#define ngx_http_v3_get_session(c) \
- ((ngx_http_v3_connection_t *) (c)->quic->parent->data)
+#define ngx_http_v3_get_session(c) ngx_http_quic_get_connection(c)->v3_session
#define ngx_http_v3_get_module_loc_conf(c, module) \
- ngx_http_get_module_loc_conf( \
- ((ngx_http_v3_connection_t *) c->quic->parent->data)->hc.conf_ctx, \
- module)
+ ngx_http_get_module_loc_conf(ngx_http_quic_get_connection(c)->conf_ctx, \
+ module)
#define ngx_http_v3_get_module_srv_conf(c, module) \
- ngx_http_get_module_srv_conf( \
- ((ngx_http_v3_connection_t *) c->quic->parent->data)->hc.conf_ctx, \
- module)
+ ngx_http_get_module_srv_conf(ngx_http_quic_get_connection(c)->conf_ctx, \
+ module)
#define ngx_http_v3_finalize_connection(c, code, reason) \
ngx_quic_finalize_connection(c->quic->parent, code, reason)
} ngx_http_v3_dynamic_table_t;
-typedef struct {
- /* the http connection must be first */
- ngx_http_connection_t hc;
+struct ngx_http_v3_connection_s {
ngx_http_v3_dynamic_table_t table;
ngx_event_t keepalive;
ngx_uint_t goaway; /* unsigned goaway:1; */
ngx_connection_t *known_streams[NGX_HTTP_V3_MAX_KNOWN_STREAM];
-} ngx_http_v3_connection_t;
+};
void ngx_http_v3_init(ngx_connection_t *c);
{
ngx_connection_t *pc;
ngx_pool_cleanup_t *cln;
- ngx_http_connection_t *phc;
+ ngx_http_connection_t *hc;
ngx_http_v3_connection_t *h3c;
pc = c->quic->parent;
- phc = pc->data;
+ hc = pc->data;
- if (phc->http3) {
+ if (hc->v3_session) {
return NGX_OK;
}
return NGX_ERROR;
}
- h3c->hc = *phc;
- h3c->hc.http3 = 1;
h3c->max_push_id = (uint64_t) -1;
ngx_queue_init(&h3c->blocked);
cln->handler = ngx_http_v3_cleanup_session;
cln->data = h3c;
- pc->data = h3c;
+ hc->v3_session = h3c;
return ngx_http_v3_send_settings(c);
}
static ngx_int_t
ngx_http_v3_send_settings(ngx_connection_t *c)
{
- u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 6];
- size_t n;
- ngx_connection_t *cc;
- ngx_http_v3_srv_conf_t *h3scf;
- ngx_http_v3_connection_t *h3c;
-
- h3c = ngx_http_v3_get_session(c);
+ u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 6];
+ size_t n;
+ ngx_connection_t *cc;
+ ngx_http_v3_srv_conf_t *h3scf;
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 send settings");
return NGX_DECLINED;
}
- h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx, ngx_http_v3_module);
+ h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
n = ngx_http_v3_encode_varlen_int(NULL,
NGX_HTTP_V3_PARAM_MAX_TABLE_CAPACITY);
"http3 set capacity %ui", capacity);
h3c = ngx_http_v3_get_session(c);
- h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx, ngx_http_v3_module);
+ h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
if (capacity > h3scf->max_table_capacity) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
h3c = ngx_http_v3_get_session(c);
dt = &h3c->table;
- h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx, ngx_http_v3_module);
+ h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
max_entries = h3scf->max_table_capacity / 32;
full_range = 2 * max_entries;
}
if (block->queue.prev == NULL) {
- h3scf = ngx_http_get_module_srv_conf(h3c->hc.conf_ctx,
- ngx_http_v3_module);
+ h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
if (h3c->nblocked == h3scf->max_blocked_streams) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,