<div dir="ltr">Thanks you</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 9, 2024 at 1:58 PM Roman Arutyunyan <<a href="mailto:arut@nginx.com">arut@nginx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Gabriel,<br>
<br>
On Wed, Feb 07, 2024 at 03:34:42PM +0200, Clima Gabriel wrote:<br>
> Hello Roman,<br>
> Thank you. Noted about the mailing list.<br>
> <br>
> <br>
> My function will be called from / inline in ngx_http_ssl_servername.<br>
> ngx_http_ssl_servername itself is registered as a SNI TSL extensions<br>
> callback like this:<br>
> <br>
> #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME<br>
> <br>
> if (SSL_CTX_set_tlsext_servername_callback(conf->ssl.ctx,<br>
> ngx_http_ssl_servername)<br>
> == 0)<br>
> {<br>
> ngx_log_error(NGX_LOG_WARN, cf->log, 0,<br>
> "nginx was built with SNI support, however, now it is linked "<br>
> "dynamically to an OpenSSL library which has no tlsext support,<br>
> "<br>
> "therefore SNI is not available");<br>
> }<br>
> <br>
> #endif<br>
> ./src/http/modules/ngx_http_ssl_module.c<br>
<br>
As you see in ngx_http_ssl_servername() code, it already assumes that c->data<br>
references a ngx_http_connection_t object, so can you.<br>
<br>
> Regards,<br>
> Gabriel<br>
> <br>
> On Wed, Feb 7, 2024 at 11:29 AM Roman Arutyunyan <<a href="mailto:arut@nginx.com" target="_blank">arut@nginx.com</a>> wrote:<br>
> <br>
> > Hi,<br>
> ><br>
> > On Mon, Feb 05, 2024 at 11:24:39PM +0200, Clima Gabriel wrote:<br>
> > > Hello everyone,<br>
> > ><br>
> > > (the code is probably clearer and attached below)<br>
> ><br>
> > Please note that this mailing list is not for development question.<br>
> > We have a separate list <a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a> for this.<br>
> ><br>
> > > This function modifies what ngx_connection_t->data points to.<br>
> > > ngx_connection_t->data is initially *ngx_http_connection_t.<br>
> > > The *ngx_http_connection_t is assigned to<br>
> > > ngx_http_v3_session_t->http_connection<br>
> > > And the *ngx_http_v3_session_t assigned to ngx_connection_t->data.<br>
> > ><br>
> > > Result: before ngx_connection_t->data is *ngx_http_connection_t<br>
> > > after ngx_connection_t->data is *ngx_http_v3_session_t<br>
> > ><br>
> > > My question is: what is the proper way to find out what c->data is at any<br>
> > > given time? I need to know this because I'm writing a function which uses<br>
> > > the ngx_http_connection_t to obtain the hostname of the request, and it<br>
> > may<br>
> > > be invoked before or after the ngx_http_v3_init_session.<br>
> ><br>
> > There's no way to tell what object is referenced by c->data without taking<br>
> > context into consideration. Similarly you can't do that for HTTP/1 as<br>
> > well.<br>
> ><br>
> > You need to know what's the current connection stage to tell this.<br>
> > ngx_http_v3_init_session() is called right before initializing QUIC<br>
> > streams for<br>
> > the session.<br>
> ><br>
> > When exactly do you call your function?<br>
> ><br>
> > [..]<br>
> ><br>
> > --<br>
> > Roman Arutyunyan<br>
> > _______________________________________________<br>
> > nginx mailing list<br>
> > <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
> > <a href="https://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/nginx</a><br>
> ><br>
<br>
> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
> <a href="https://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/nginx</a><br>
<br>
<br>
--<br>
Roman Arutyunyan<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="https://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>