Sync upstream updates from github.com/winshining/nginx-http-flv-module

This commit is contained in:
mxdyeah committed 2026-11-08 15:31:59 +08:00
1 parent 1be683b499
commit 20bbd5d297
16 files changed
+209 -76

No files matched your search

+21 -4
View File
@@ -323,7 +323,7 @@ ngx_http_flv_live_init_handlers(ngx_cycle_t *cycle)
return NGX_OK;
}
/* rtmp live conf aready exsits, so add additional event handlers */
/* rtmp live conf already exsits, so add additional event handlers */
h = ngx_array_push(&cmcf->events[NGX_HTTP_FLV_LIVE_REQUEST]);
*h = ngx_http_flv_live_request;
@@ -2064,6 +2064,8 @@ ngx_http_flv_live_connect_init(ngx_rtmp_session_t *s, ngx_str_t *app,
ngx_connection_t *c;
ngx_http_request_t *r;
u_char name[NGX_RTMP_MAX_NAME];
ngx_str_t addr;
u_char addr_buf[NGX_SOCKADDR_STRLEN];
r = s->data;
c = s->connection;
@@ -2074,8 +2076,20 @@ ngx_http_flv_live_connect_init(ngx_rtmp_session_t *s, ngx_str_t *app,
ngx_memcpy(v.args, r->args.data, ngx_min(r->args.len, sizeof(v.args) - 1));
ngx_memcpy(v.flashver, "flv_live 1.1", ngx_strlen("flv_live 1.1"));
*ngx_snprintf(v.tc_url, NGX_RTMP_MAX_URL, "http://%V/%V",
&r->headers_in.host->value, app) = 0;
if (r->headers_in.host) {
*ngx_snprintf(v.tc_url, NGX_RTMP_MAX_URL - 1, "http://%V/%V",
&r->headers_in.host->value, app) = 0;
} else {
addr.len = sizeof(addr_buf);
addr.data = addr_buf;
if (ngx_connection_local_sockaddr(c, &addr, 1) != NGX_OK) {
return NGX_ERROR;
}
*ngx_snprintf(v.tc_url, NGX_RTMP_MAX_URL - 1, "http://%V/%V",
&addr, app) = 0;
}
#define NGX_RTMP_SET_STRPAR(name) \
s->name.len = ngx_strlen(v.name); \
@@ -2482,11 +2496,14 @@ ngx_http_flv_live_handler(ngx_http_request_t *r)
if (r->http_version == NGX_HTTP_VERSION_9
#if (NGX_HTTP_V2)
|| r->http_version == NGX_HTTP_VERSION_20
#endif
#if (NGX_HTTP_V3)
|| r->http_version == NGX_HTTP_VERSION_30
#endif
)
{
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"flv live: HTTP version 0.9 or 2.0 not supported");
"flv live: HTTP version 0.9, 2.0 or 3.0 not supported");
return NGX_HTTP_NOT_ALLOWED;
}