Skip to content

Commit 2fb11df

Browse files
committed
SSL shutdown for rtmps.
While rtmp module does not support SSL, starting from nginx 1.25.5 an SSL connection can be passed from nginx stream pass module. Such connections should be shut down on connection closure. An rtmps example: rtmp { server { listen 1935; # rtmp application foo { live on; } } } stream { server { listen 1936 ssl; # rtmps ssl_certificate example.com.crt; ssl_certificate_key example.com.key; pass 127.0.0.1:1935; } }
1 parent 6f9fa49 commit 2fb11df

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ngx_rtmp_init.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,17 @@ ngx_rtmp_close_connection(ngx_connection_t *c)
258258

259259
ngx_log_debug0(NGX_LOG_DEBUG_RTMP, c->log, 0, "close connection");
260260

261+
#if (NGX_SSL)
262+
263+
if (c->ssl) {
264+
if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
265+
c->ssl->handler = ngx_rtmp_close_connection;
266+
return;
267+
}
268+
}
269+
270+
#endif
271+
261272
#if (NGX_STAT_STUB)
262273
(void) ngx_atomic_fetch_add(ngx_stat_active, -1);
263274
#endif

0 commit comments

Comments
 (0)