Skip to content

Commit

Permalink
proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
shamamayair committed Aug 31, 2023
1 parent 5770742 commit 9ed70ef
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions nginx-rtmp-kmp-module/src/ngx_rtmp_kmp_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ ngx_rtmp_kmp_connect_rtmp_json_get_size(ngx_rtmp_kmp_connect_t *obj,
sizeof("\",\"tc_url\":\"") - 1 + ngx_json_str_get_size(&obj->tc_url) +
sizeof("\",\"page_url\":\"") - 1 +
ngx_json_str_get_size(&obj->page_url) +
sizeof("\",\"addr\":\"") - 1 + s->connection->proxy_protocol != NULL ? s->connection->proxy_protocol->src_addr.len : s->connection->addr_text.len +
ngx_escape_json(NULL, s->connection->proxy_protocol != NULL ? s->connection->proxy_protocol->src_addr.data : s->connection->addr_text.data,
s->connection->proxy_protocol != NULL ? s->connection->proxy_protocol->src_addr.len : s->connection->addr_text.len) +
sizeof("\",\"addr\":\"") - 1 + s->connection->proxy_protocol != NULL && s->connection->proxy_protocol->src_addr != NULL ? s->connection->proxy_protocol->src_addr.len : s->connection->addr_text.len +
ngx_escape_json(NULL, s->connection->proxy_protocol != NULL && s->connection->proxy_protocol->src_addr != NULL ? s->connection->proxy_protocol->src_addr.data : s->connection->addr_text.data,
s->connection->proxy_protocol != NULL && s->connection->proxy_protocol->src_addr != NULL ? s->connection->proxy_protocol->src_addr.len : s->connection->addr_text.len) +
sizeof("\",\"connection\":") - 1 + NGX_INT_T_LEN +
sizeof("}") - 1;

Expand All @@ -55,12 +55,15 @@ ngx_rtmp_kmp_connect_rtmp_json_write(u_char *p, ngx_rtmp_kmp_connect_t *obj,
p = ngx_copy_fix(p, "\",\"page_url\":\"");
p = ngx_json_str_write(p, &obj->page_url);
p = ngx_copy_fix(p, "\",\"addr\":\"");
p = (u_char *) ngx_escape_json(p, s->connection->proxy_protocol != NULL ? s->connection->proxy_protocol->src_addr.data : s->connection->addr_text.data ,
s->connection->proxy_protocol != NULL ? s->connection->proxy_protocol->src_addr.len : s->connection->addr_text.len);
p = (u_char *) ngx_escape_json(p, s->connection->proxy_protocol != NULL && s->connection->proxy_protocol->src_addr != NULL ? s->connection->proxy_protocol->src_addr.data : s->connection->addr_text.data ,
s->connection->proxy_protocol != NULL && s->connection->proxy_protocol->src_addr != NULL ? s->connection->proxy_protocol->src_addr.len : s->connection->addr_text.len);
p = ngx_copy_fix(p, "\",\"connection\":");
p = ngx_sprintf(p, "%uA", (ngx_atomic_uint_t) s->connection->number);
*p++ = '}';




return p;
}

Expand Down

0 comments on commit 9ed70ef

Please sign in to comment.