Mercurial > hg > nginx
comparison src/http/v3/ngx_http_v3.c @ 9161:4939fd04737f
HTTP/3: postponed session creation to init() callback.
Now the session object is assigned to c->data while ngx_http_connection_t
object is referenced by its http_connection field, similar to
ngx_http_v2_connection_t and ngx_http_request_t.
The change allows to eliminate v3_session field from ngx_http_connection_t.
The field was under NGX_HTTP_V3 macro, which was a source of binary
compatibility problems when nginx/module is build with/without HTTP/3 support.
Postponing is essential since c->data should retain the reference to
ngx_http_connection_t object throughout QUIC handshake, because SSL callbacks
ngx_http_ssl_servername() and ngx_http_ssl_alpn_select() rely on this.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 14 Sep 2023 14:13:43 +0400 |
parents | f742b1b46901 |
children |
comparison
equal
deleted
inserted
replaced
9160:dd5fd5719027 | 9161:4939fd04737f |
---|---|
28 h3c = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_session_t)); | 28 h3c = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_session_t)); |
29 if (h3c == NULL) { | 29 if (h3c == NULL) { |
30 goto failed; | 30 goto failed; |
31 } | 31 } |
32 | 32 |
33 h3c->http_connection = hc; | |
34 | |
33 ngx_queue_init(&h3c->blocked); | 35 ngx_queue_init(&h3c->blocked); |
34 | 36 |
35 h3c->keepalive.log = c->log; | 37 h3c->keepalive.log = c->log; |
36 h3c->keepalive.data = c; | 38 h3c->keepalive.data = c; |
37 h3c->keepalive.handler = ngx_http_v3_keepalive_handler; | 39 h3c->keepalive.handler = ngx_http_v3_keepalive_handler; |
46 } | 48 } |
47 | 49 |
48 cln->handler = ngx_http_v3_cleanup_session; | 50 cln->handler = ngx_http_v3_cleanup_session; |
49 cln->data = h3c; | 51 cln->data = h3c; |
50 | 52 |
51 hc->v3_session = h3c; | 53 c->data = h3c; |
52 | 54 |
53 return NGX_OK; | 55 return NGX_OK; |
54 | 56 |
55 failed: | 57 failed: |
56 | 58 |