@@ -724,12 +724,12 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
724
724
ngx_chain_t out ;
725
725
ngx_int_t rc , found = 0 , done = 0 , err_status = 0 ;
726
726
off_t rest = 0 , length = 0 ;
727
- ngx_uint_t len , i ;
727
+ ngx_uint_t len ;
728
728
ngx_slab_pool_t * shpool ;
729
729
ngx_http_uploadprogress_conf_t * upcf ;
730
730
ngx_http_uploadprogress_ctx_t * ctx ;
731
731
ngx_http_uploadprogress_node_t * up ;
732
- ngx_table_elt_t * expires , * cc , * * ccp ;
732
+ ngx_table_elt_t * expires , * cc ;
733
733
ngx_http_uploadprogress_state_t state ;
734
734
ngx_http_uploadprogress_template_t * t ;
735
735
@@ -778,6 +778,7 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
778
778
}
779
779
780
780
r -> headers_out .expires = expires ;
781
+ expires -> next = NULL ;
781
782
782
783
expires -> hash = 1 ;
783
784
expires -> key .len = sizeof ("Expires" ) - 1 ;
@@ -787,37 +788,28 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
787
788
len = sizeof ("Mon, 28 Sep 1970 06:00:00 GMT" );
788
789
expires -> value .len = len - 1 ;
789
790
790
- ccp = r -> headers_out .cache_control .elts ;
791
- if (ccp == NULL ) {
792
-
793
- if (ngx_array_init (& r -> headers_out .cache_control , r -> pool ,
794
- 1 , sizeof (ngx_table_elt_t * ))
795
- != NGX_OK ) {
796
- return NGX_HTTP_INTERNAL_SERVER_ERROR ;
797
- }
798
-
799
- ccp = ngx_array_push (& r -> headers_out .cache_control );
800
- if (ccp == NULL ) {
801
- return NGX_HTTP_INTERNAL_SERVER_ERROR ;
802
- }
803
-
791
+ cc = r -> headers_out .cache_control ;
792
+ if (cc == NULL ) {
804
793
cc = ngx_list_push (& r -> headers_out .headers );
805
794
if (cc == NULL ) {
795
+ expires -> hash = 0 ;
806
796
return NGX_HTTP_INTERNAL_SERVER_ERROR ;
807
797
}
808
798
799
+ r -> headers_out .cache_control = cc ;
800
+ cc -> next = NULL ;
801
+
809
802
cc -> hash = 1 ;
810
803
cc -> key .len = sizeof ("Cache-Control" ) - 1 ;
811
804
cc -> key .data = (u_char * ) "Cache-Control" ;
812
805
813
- * ccp = cc ;
814
-
815
806
} else {
816
- for (i = 1 ; i < r -> headers_out . cache_control . nelts ; i ++ ) {
817
- ccp [ i ] -> hash = 0 ;
807
+ for (cc = cc -> next ; cc ; cc = cc -> next ) {
808
+ cc -> hash = 0 ;
818
809
}
819
810
820
- cc = ccp [0 ];
811
+ cc = r -> headers_out .cache_control ;
812
+ cc -> next = NULL ;
821
813
}
822
814
823
815
expires -> value .data = (u_char * ) "Thu, 01 Jan 1970 00:00:01 GMT" ;
0 commit comments