implemented md5-hashing in notify_relay_redirect mode

This commit is contained in:
Roman Arutyunyan 2014-01-07 21:07:58 +04:00
parent 0166380bef
commit 8d28f7f1de

View file

@ -6,6 +6,7 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_md5.h>
#include "ngx_rtmp.h"
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_netcall_module.h"
@ -979,6 +980,22 @@ ngx_rtmp_notify_connect_handle(ngx_rtmp_session_t *s,
}
static void
ngx_rtmp_notify_set_name(u_char *dst, size_t dst_len, u_char *src,
size_t src_len)
{
u_char result[16], *p;
ngx_md5_t md5;
ngx_md5_init(&md5);
ngx_md5_update(&md5, src, src_len);
ngx_md5_final(result, &md5);
p = ngx_hex_dump(dst, result, ngx_min((dst_len - 1) / 2, 16));
*p = '\0';
}
static ngx_int_t
ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
void *arg, ngx_chain_t *in)
@ -1025,7 +1042,7 @@ ngx_rtmp_notify_publish_handle(ngx_rtmp_session_t *s,
nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);
if (nacf->relay_redirect) {
*ngx_cpymem(v->name, name, rc) = 0;
ngx_rtmp_notify_set_name(v->name, NGX_RTMP_MAX_NAME, name, (size_t) rc);
}
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
@ -1104,7 +1121,7 @@ ngx_rtmp_notify_play_handle(ngx_rtmp_session_t *s,
nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);
if (nacf->relay_redirect) {
*ngx_cpymem(v->name, name, rc) = 0;
ngx_rtmp_notify_set_name(v->name, NGX_RTMP_MAX_NAME, name, (size_t) rc);
}
ngx_log_error(NGX_LOG_INFO, s->connection->log, 0,