Merge pull request #331 from sergey-dryabzhinsky/issue-317-fix-double-ampersand-in-event-request

Issue 317 fix double ampersand in event request
This commit is contained in:
Sergey Dryabzhinsky 2021-06-03 10:24:03 +03:00 committed by GitHub
commit d4d762e917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View file

@ -586,11 +586,13 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
* So not override them with empty values
*/
bsize = sizeof("&addr=") - 1 + addr_text->len * 3 +
bsize = sizeof("addr=") - 1 + addr_text->len * 3 +
sizeof("&clientid=") - 1 + NGX_INT_T_LEN;
// Indicator of additional vars from session
// Event `connect` don't have them, for example
if (s->app.len) {
bsize += sizeof("app=") - 1 + s->app.len * 3;
bsize += sizeof("&app=") - 1 + s->app.len * 3;
}
if (s->flashver.len) {
bsize += sizeof("&flashver=") - 1 + s->flashver.len * 3;
@ -613,8 +615,16 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
cl->buf = b;
cl->next = NULL;
b->last = ngx_cpymem(b->last, (u_char*) "addr=", sizeof("addr=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&clientid=",
sizeof("&clientid=") - 1);
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->connection->number);
if (s->app.len) {
b->last = ngx_cpymem(b->last, (u_char*) "app=", sizeof("app=") - 1);
b->last = ngx_cpymem(b->last, (u_char*) "&app=", sizeof("&app=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, s->app.data, s->app.len,
NGX_ESCAPE_ARGS);
}
@ -643,14 +653,6 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
s->page_url.len, NGX_ESCAPE_ARGS);
}
b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);
b->last = ngx_cpymem(b->last, (u_char*) "&clientid=",
sizeof("&clientid=") - 1);
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->connection->number);
return cl;
}

View file

@ -833,7 +833,10 @@ ngx_rtmp_stat_handler(ngx_http_request_t *r)
#ifdef NGX_COMPILER
NGX_RTMP_STAT_L("<compiler>" NGX_COMPILER "</compiler>\r\n");
#endif
/* This may prevent reproducible builds. If you need that info - pass `-DNGX_BUILD_DATEITIME=1` to CFLAGS */
#ifdef NGX_BUILD_DATEITIME
NGX_RTMP_STAT_L("<built>" __DATE__ " " __TIME__ "</built>\r\n");
#endif
NGX_RTMP_STAT_L("<pid>");
NGX_RTMP_STAT(nbuf, ngx_snprintf(nbuf, sizeof(nbuf),