ngx_http_v3_init_session function

Roman Arutyunyan arut at nginx.com
Wed Feb 7 09:28:53 UTC 2024


Hi,

On Mon, Feb 05, 2024 at 11:24:39PM +0200, Clima Gabriel wrote:
> Hello everyone,
> 
> (the code is probably clearer and attached below)

Please note that this mailing list is not for development question.
We have a separate list nginx-devel at nginx.org for this.

> This function modifies what ngx_connection_t->data points to.
> ngx_connection_t->data is initially *ngx_http_connection_t.
> The *ngx_http_connection_t is assigned to
> ngx_http_v3_session_t->http_connection
> And the *ngx_http_v3_session_t assigned to ngx_connection_t->data.
> 
> Result: before ngx_connection_t->data is *ngx_http_connection_t
>                after ngx_connection_t->data is *ngx_http_v3_session_t
> 
> My question is: what is the proper way to find out what c->data is at any
> given time? I need to know this because I'm writing a function which uses
> the ngx_http_connection_t to obtain the hostname of the request, and it may
> be invoked before or after the ngx_http_v3_init_session.

There's no way to tell what object is referenced by c->data without taking
context into consideration.  Similarly you can't do that for HTTP/1 as well.

You need to know what's the current connection stage to tell this.
ngx_http_v3_init_session() is called right before initializing QUIC streams for
the session.

When exactly do you call your function?

[..]

--
Roman Arutyunyan


More information about the nginx mailing list