<div dir="ltr">Hello everyone,<br><br>(the code is probably clearer and attached below)<br>This function modifies what ngx_connection_t->data points to.<br>ngx_connection_t->data is initially *ngx_http_connection_t.<br><div>The *ngx_http_connection_t is assigned to ngx_http_v3_session_t->http_connection <br><div>And the *ngx_http_v3_session_t assigned to ngx_connection_t->data. </div><div><br></div><div>Result: before ngx_connection_t->data is *ngx_http_connection_t</div><div>               after ngx_connection_t->data is *ngx_http_v3_session_t</div><div><br></div><div>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 <span style="font-family:monospace">ngx_http_v3_init_session.</span><br><div><br></div><div><font face="monospace">ngx_int_t<br>ngx_http_v3_init_session(ngx_connection_t *c)<br>{<br>    ngx_pool_cleanup_t     *cln;<br>    ngx_http_connection_t  *hc;<br>    ngx_http_v3_session_t  *h3c;<br><br>    hc = c->data;<br><br>    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init session");<br><br>    h3c = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_session_t));<br>    if (h3c == NULL) {<br>        goto failed;<br>    }<br><br>    h3c->http_connection = hc;<br><br>    ngx_queue_init(&h3c->blocked);<br><br>    h3c->keepalive.log = c->log;<br>    h3c->keepalive.data = c;<br>    h3c->keepalive.handler = ngx_http_v3_keepalive_handler;<br><br>    h3c->table.send_insert_count.log = c->log;<br>    h3c->table.send_insert_count.data = c;<br>    h3c->table.send_insert_count.handler = ngx_http_v3_inc_insert_count_handler;<br><br>    cln = ngx_pool_cleanup_add(c->pool, 0);<br>    if (cln == NULL) {<br>        goto failed;<br>    }<br><br>    cln->handler = ngx_http_v3_cleanup_session;<br>    cln->data = h3c;<br><br>    c->data = h3c;<br><br>    return NGX_OK;<br><br>failed:<br><br>    ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to create http3 session");<br>    return NGX_ERROR;<br>}<br></font><br>Regards,<br>Gabriel</div></div></div></div>