@@ -2194,8 +2194,7 @@ 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
- ngx_uint_t i ;
2198
- ngx_table_elt_t * expires_header , * cc , * * ccp ;
2197
+ ngx_table_elt_t * expires_header , * cc ;
2199
2198
2200
2199
expires_header = r -> headers_out .expires ;
2201
2200
@@ -2207,6 +2206,7 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2207
2206
}
2208
2207
2209
2208
r -> headers_out .expires = expires_header ;
2209
+ expires_header -> next = NULL ;
2210
2210
2211
2211
expires_header -> hash = 1 ;
2212
2212
ngx_str_set (& expires_header -> key , "Expires" );
@@ -2215,34 +2215,29 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2215
2215
len = sizeof ("Mon, 28 Sep 1970 06:00:00 GMT" );
2216
2216
expires_header -> value .len = len - 1 ;
2217
2217
2218
- ccp = r -> headers_out .cache_control . elts ;
2218
+ cc = r -> headers_out .cache_control ;
2219
2219
2220
- if (ccp == NULL ) {
2221
-
2222
- if (ngx_array_init (& r -> headers_out .cache_control , r -> pool , 1 , sizeof (ngx_table_elt_t * )) != NGX_OK ) {
2223
- return NGX_ERROR ;
2224
- }
2225
-
2226
- ccp = ngx_array_push (& r -> headers_out .cache_control );
2227
- if (ccp == NULL ) {
2228
- return NGX_ERROR ;
2229
- }
2220
+ if (cc == NULL ) {
2230
2221
2231
2222
cc = ngx_list_push (& r -> headers_out .headers );
2232
2223
if (cc == NULL ) {
2224
+ expires_header -> hash = 0 ;
2233
2225
return NGX_ERROR ;
2234
2226
}
2235
2227
2228
+ r -> headers_out .cache_control = cc ;
2229
+ cc -> next = NULL ;
2230
+
2236
2231
cc -> hash = 1 ;
2237
2232
ngx_str_set (& cc -> key , "Cache-Control" );
2238
- * ccp = cc ;
2239
2233
2240
2234
} else {
2241
- for (i = 1 ; i < r -> headers_out . cache_control . nelts ; i ++ ) {
2242
- ccp [ i ] -> hash = 0 ;
2235
+ for (cc = cc -> next ; cc ; cc = cc -> next ) {
2236
+ cc -> hash = 0 ;
2243
2237
}
2244
2238
2245
- cc = ccp [0 ];
2239
+ cc = r -> headers_out .cache_control ;
2240
+ cc -> next = NULL ;
2246
2241
}
2247
2242
2248
2243
if (expires == NGX_HTTP_PUSH_STREAM_EXPIRES_EPOCH ) {
@@ -2260,6 +2255,8 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2260
2255
2261
2256
expires_header -> value .data = ngx_pnalloc (r -> pool , len );
2262
2257
if (expires_header -> value .data == NULL ) {
2258
+ expires_header -> hash = 0 ;
2259
+ cc -> hash = 0 ;
2263
2260
return NGX_ERROR ;
2264
2261
}
2265
2262
@@ -2276,8 +2273,8 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2276
2273
max_age = expires_header_time - now ;
2277
2274
2278
2275
} else if (expires == NGX_HTTP_PUSH_STREAM_EXPIRES_ACCESS || r -> headers_out .last_modified_time == -1 ) {
2279
- expires_header_time = now + expires_time ;
2280
2276
max_age = expires_time ;
2277
+ expires_header_time = now + expires_time ;
2281
2278
2282
2279
} else {
2283
2280
expires_header_time = r -> headers_out .last_modified_time + expires_time ;
@@ -2293,6 +2290,7 @@ ngx_http_push_stream_set_expires(ngx_http_request_t *r, ngx_http_push_stream_exp
2293
2290
2294
2291
cc -> value .data = ngx_pnalloc (r -> pool , sizeof ("max-age=" ) + NGX_TIME_T_LEN + 1 );
2295
2292
if (cc -> value .data == NULL ) {
2293
+ cc -> hash = 0 ;
2296
2294
return NGX_ERROR ;
2297
2295
}
2298
2296
0 commit comments