2020#endif
2121
2222
23+ #ifdef T_NGX_HTTP_HAVE_LUA_MODULE
24+ #include <ngx_http_lua_ssl_certby.h>
25+ extern ngx_module_t ngx_http_lua_module ;
26+ #endif
2327
2428ngx_int_t
2529ngx_http_v3_conn_check_concurrent_cnt (ngx_http_xquic_main_conf_t * qmcf )
@@ -187,6 +191,22 @@ ngx_http_v3_cert_cb(const char *sni, void **chain,
187191 hc = qc -> http_connection ;
188192 c = qc -> connection ;
189193
194+ #ifdef T_NGX_HTTP_HAVE_LUA_MODULE
195+ ngx_http_lua_srv_conf_t * lscf = NULL ;
196+
197+ lscf = ngx_http_get_module_srv_conf (hc -> conf_ctx , ngx_http_lua_module );
198+ if (lscf != NULL && lscf -> srv .ssl_cert_src .len ) {
199+ ngx_ssl_conn_t * ssl_conn = qc -> ssl_conn ;
200+
201+ ngx_http_lua_ssl_cert_handler (ssl_conn , NULL );
202+ * chain = NULL ;
203+ * cert = NULL ;
204+ * key = NULL ;
205+
206+ return XQC_OK ;
207+ }
208+ #endif
209+
190210 /*
191211 * get the server core conf by sni, this is useful when multiple server
192212 * block listen on the same port. but useless when there is noly a single
256276ngx_http_v3_conn_create_notify (xqc_h3_conn_t * h3_conn ,
257277 const xqc_cid_t * cid , void * user_data )
258278{
279+ ngx_connection_t * c ;
280+
259281 /* we set alp user_data when accept connection */
260282 ngx_http_xquic_connection_t * user_conn = (ngx_http_xquic_connection_t * ) user_data ;
261283 user_conn -> ssl_conn = (ngx_ssl_conn_t * ) xqc_h3_conn_get_ssl (h3_conn );
@@ -265,6 +287,24 @@ ngx_http_v3_conn_create_notify(xqc_h3_conn_t *h3_conn,
265287
266288 xqc_h3_conn_set_user_data (h3_conn , user_conn );
267289
290+ c = user_conn -> connection ;
291+
292+ if (SSL_set_ex_data (user_conn -> ssl_conn , ngx_ssl_connection_index , c ) == 0 )
293+ {
294+ ngx_log_error (NGX_LOG_ERR , ngx_cycle -> log , 0 , "|xquic|SSL_set_ex_data() failed|" );
295+ return XQC_ERROR ;
296+ }
297+
298+ c -> xquic_conn = 1 ;
299+
300+ ngx_ssl_connection_t * p_ssl = ngx_pcalloc (c -> pool , sizeof (ngx_ssl_connection_t ));
301+ if (p_ssl == NULL ) {
302+ ngx_log_error (NGX_LOG_ERR , ngx_cycle -> log , 0 , "|xquic|alloc ngx_ssl_connection_t failed|" );
303+ return XQC_ERROR ;
304+ }
305+ p_ssl -> connection = user_conn -> ssl_conn ;
306+ c -> ssl = p_ssl ;
307+
268308 return NGX_OK ;
269309}
270310
0 commit comments