Skip to content

Commit

Permalink
added cutting off stream name args & removing trailing backslash from…
Browse files Browse the repository at this point in the history
… appname; thanks to spuzirev & semihalev
  • Loading branch information
arut committed Jun 8, 2012
1 parent 108bae8 commit eec4b7b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ngx_rtmp_cmd_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ static ngx_int_t
ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
{
size_t len;

static ngx_rtmp_connect_t v;

static ngx_rtmp_amf_elt_t in_cmd[] = {
Expand Down Expand Up @@ -112,6 +114,11 @@ ngx_rtmp_cmd_connect_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
return NGX_ERROR;
}

len = ngx_strlen(v.app);
if (len && v.app[len - 1] == '/') {
v.app[len - 1] = 0;
}

return ngx_rtmp_connect
? ngx_rtmp_connect(s, &v)
: NGX_OK;
Expand Down Expand Up @@ -363,6 +370,18 @@ ngx_rtmp_cmd_delete_stream(ngx_rtmp_session_t *s, ngx_rtmp_delete_stream_t *v)
}


static void
ngx_rtmp_cmd_cutoff_args(u_char *s)
{
u_char *p;

p = (u_char *)ngx_strchr(s, '?');
if (p) {
*p = 0;
}
}


static ngx_int_t
ngx_rtmp_cmd_publish_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
ngx_chain_t *in)
Expand Down Expand Up @@ -398,6 +417,8 @@ ngx_rtmp_cmd_publish_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
return NGX_ERROR;
}

ngx_rtmp_cmd_cutoff_args(v.name);

return ngx_rtmp_publish
? ngx_rtmp_publish(s, &v)
: NGX_OK;
Expand Down Expand Up @@ -605,6 +626,8 @@ ngx_rtmp_cmd_play_init(ngx_rtmp_session_t *s, ngx_rtmp_header_t *h,
return NGX_ERROR;
}

ngx_rtmp_cmd_cutoff_args(v.name);

return ngx_rtmp_play
? ngx_rtmp_play(s, &v)
: NGX_OK;
Expand Down

0 comments on commit eec4b7b

Please sign in to comment.