--- src/nginx-push-stream-module-0.5.5/src/ngx_http_push_stream_module_utils.c 2022-08-26 13:49:34.000000000 +0000 +++ src/nginx-push-stream-module-0.5.5/src/ngx_http_push_stream_module_utils.c 2022-08-26 13:48:01.000000000 +0000 @@ -2149,8 +2149,12 @@ { size_t len; time_t now, expires_header_time, max_age; +#if (nginx_version >= 1023000) + ngx_table_elt_t *expires_header, *cc; +#else ngx_uint_t i; ngx_table_elt_t *expires_header, *cc, **ccp; +#endif expires_header = r->headers_out.expires; @@ -2170,6 +2174,32 @@ len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT"); expires_header->value.len = len - 1; +#if (nginx_version >= 1023000) + cc = r->headers_out.cache_control; + + if (cc == NULL) { + + cc = ngx_list_push(&r->headers_out.headers); + if (cc == NULL) { + expires_header->hash = 0; + return NGX_ERROR; + } + + r->headers_out.cache_control = cc; + cc->next = NULL; + + cc->hash = 1; + ngx_str_set(&cc->key, "Cache-Control"); + + } else { + for (cc = cc->next; cc; cc = cc->next) { + cc->hash = 0; + } + + cc = r->headers_out.cache_control; + cc->next = NULL; + } +#else ccp = r->headers_out.cache_control.elts; if (ccp == NULL) { @@ -2199,6 +2229,8 @@ cc = ccp[0]; } +#endif + if (expires == NGX_HTTP_PUSH_STREAM_EXPIRES_EPOCH) { expires_header->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";