@@ -2194,8 +2194,12 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2194
2194
{
2195
2195
size_t len ;
2196
2196
time_t now , expires_header_time , max_age ;
2197
+ #if (nginx_version >= 1023000 )
2198
+ ngx_table_elt_t * expires_header , * cc ;
2199
+ #else
2197
2200
ngx_uint_t i ;
2198
2201
ngx_table_elt_t * expires_header , * cc , * * ccp ;
2202
+ #endif
2199
2203
2200
2204
expires_header = r -> headers_out .expires ;
2201
2205
@@ -2215,6 +2219,32 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2215
2219
len = sizeof ("Mon, 28 Sep 1970 06:00:00 GMT" );
2216
2220
expires_header -> value .len = len - 1 ;
2217
2221
2222
+ #if (nginx_version >= 1023000 )
2223
+ cc = r -> headers_out .cache_control ;
2224
+
2225
+ if (cc == NULL ) {
2226
+
2227
+ cc = ngx_list_push (& r -> headers_out .headers );
2228
+ if (cc == NULL ) {
2229
+ expires_header -> hash = 0 ;
2230
+ return NGX_ERROR ;
2231
+ }
2232
+
2233
+ r -> headers_out .cache_control = cc ;
2234
+ cc -> next = NULL ;
2235
+
2236
+ cc -> hash = 1 ;
2237
+ ngx_str_set (& cc -> key , "Cache-Control" );
2238
+
2239
+ } else {
2240
+ for (cc = cc -> next ; cc ; cc = cc -> next ) {
2241
+ cc -> hash = 0 ;
2242
+ }
2243
+
2244
+ cc = r -> headers_out .cache_control ;
2245
+ cc -> next = NULL ;
2246
+ }
2247
+ #else
2218
2248
ccp = r -> headers_out .cache_control .elts ;
2219
2249
2220
2250
if (ccp == NULL ) {
@@ -2244,6 +2274,8 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2244
2274
2245
2275
cc = ccp [0 ];
2246
2276
}
2277
+ #endif
2278
+
2247
2279
2248
2280
if (expires == NGX_HTTP_PUSH_STREAM_EXPIRES_EPOCH ) {
2249
2281
expires_header -> value .data = (u_char * ) "Thu, 01 Jan 1970 00:00:01 GMT" ;
0 commit comments