Skip to content

Commit

Permalink
[fix] fix a compatibility bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
winshining committed Mar 27, 2018
1 parent 00a8548 commit f3401d4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ngx_http_flv_live_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ extern ngx_module_t ngx_http_headers_filter_module;

static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
#if (nginx_version >= 1011010)
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;

#endif

static ngx_str_t ngx_http_status_lines[] = {

Expand Down Expand Up @@ -650,6 +651,7 @@ ngx_http_flv_live_header_filter(ngx_rtmp_session_t *s)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);

if (r->headers_out.server == NULL) {
#if (nginx_version >= 1011010)
if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
len += sizeof(ngx_http_server_full_string) - 1;

Expand All @@ -659,6 +661,10 @@ ngx_http_flv_live_header_filter(ngx_rtmp_session_t *s)
} else {
len += sizeof(ngx_http_server_string) - 1;
}
#else
len += clcf->server_tokens ? sizeof(ngx_http_server_full_string) - 1 :
sizeof(ngx_http_server_string) - 1;
#endif
}

if (r->headers_out.date == NULL) {
Expand Down Expand Up @@ -752,6 +758,7 @@ ngx_http_flv_live_header_filter(ngx_rtmp_session_t *s)
*b->last++ = CR; *b->last++ = LF;

if (r->headers_out.server == NULL) {
#if (nginx_version >= 1011010)
if (clcf->server_tokens == NGX_HTTP_SERVER_TOKENS_ON) {
p = ngx_http_server_full_string;
len = sizeof(ngx_http_server_full_string) - 1;
Expand All @@ -761,6 +768,13 @@ ngx_http_flv_live_header_filter(ngx_rtmp_session_t *s)
len = sizeof(ngx_http_server_build_string) - 1;

} else {
#else
if (clcf->server_tokens) {
p = (u_char *) ngx_http_server_full_string;
len = sizeof(ngx_http_server_full_string) - 1;

} else {
#endif
p = ngx_http_server_string;
len = sizeof(ngx_http_server_string) - 1;
}
Expand Down

0 comments on commit f3401d4

Please sign in to comment.