From 10bd726e6c4c3033be9e6169ea259c9355e9223a Mon Sep 17 00:00:00 2001 From: winshining Date: Mon, 23 Sep 2019 22:50:05 +0800 Subject: [PATCH] [fix] fixed #127, add compatibility for case rtmps -> converter -> rtmp. --- README.CN.md | 4 ++++ README.md | 4 ++++ ngx_rtmp_cmd_module.c | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/README.CN.md b/README.CN.md index 1e5e1da..02eabd7 100644 --- a/README.CN.md +++ b/README.CN.md @@ -34,6 +34,10 @@ | 定时打印访问记录 | √ | x | | | JSON风格的stat | √ | x | | +## 兼容性 + +[NGINX](http://nginx.org)的版本**应该**大于或者等于1.2.6,与其他版本的兼容性未知。 + ## 支持的系统 * Linux(推荐)/FreeBSD/MacOS/Windows(受限)。 diff --git a/README.md b/README.md index 38712b5..d207cc4 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ Donate if you like this module. Many thanks to you! | Timing log for access | √ | x | | | JSON style stat | √ | x | | +## Compatibility + +The [NGINX](http://nginx.org) version **SHOULD** be equal to or greater than 1.2.6, the compatibility with other versions is unknown. + ## Systems supported * Linux (recommended)/FreeBSD/MacOS/Windows (limited). diff --git a/ngx_rtmp_cmd_module.c b/ngx_rtmp_cmd_module.c index a316fa9..e7826aa 100644 --- a/ngx_rtmp_cmd_module.c +++ b/ngx_rtmp_cmd_module.c @@ -176,6 +176,16 @@ ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h, return NGX_ERROR; } + if (v.tc_url[0]) { + /* compatibility for case: rtmps -> converter -> rtmp */ + if (ngx_strncasecmp(v.tc_url, (u_char *) "rtmps://", 8) == 0) { + ngx_log_error(NGX_LOG_WARN, s->connection->log, 0, + "connect: rtmps tcUrl received: %s", v.tc_url); + + ngx_memmove(v.tc_url + 4, v.tc_url + 5, ngx_strlen(v.tc_url) - 5); + } + } + #define NGX_RTMP_SET_STRPAR(name) \ s->name.len = ngx_strlen(v.name); \ s->name.data = ngx_palloc(s->connection->pool, s->name.len); \