File nginx-upload-progress-module-124+.patch of Package dba-nginx-1261-modsec

--- nginx-upload-progress-module-0.9.2/ngx_http_uploadprogress_module_orig.c	2016-08-03 09:02:38.000000000 +0200
+++ nginx-upload-progress-module-0.9.2/ngx_http_uploadprogress_module.c	2023-05-03 15:21:31.845281928 +0200
@@ -637,37 +637,28 @@ ngx_http_reportuploads_handler(ngx_http_
     len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT");
     expires->value.len = len - 1;
 
-    ccp = r->headers_out.cache_control.elts;
-    if (ccp == NULL) {
-
-        if (ngx_array_init(&r->headers_out.cache_control, r->pool,
-                           1, sizeof(ngx_table_elt_t *))
-            != NGX_OK) {
-            return NGX_HTTP_INTERNAL_SERVER_ERROR;
-        }
-
-        ccp = ngx_array_push(&r->headers_out.cache_control);
-        if (ccp == NULL) {
-            return NGX_HTTP_INTERNAL_SERVER_ERROR;
-        }
-
+    cc = r->headers_out.cache_control;
+    if (cc == NULL) {
         cc = ngx_list_push(&r->headers_out.headers);
         if (cc == NULL) {
+            expires->hash = 0;
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
         }
 
+        r->headers_out.cache_control = cc;
+        cc->next = NULL;
+
         cc->hash = 1;
         cc->key.len = sizeof("Cache-Control") - 1;
         cc->key.data = (u_char *) "Cache-Control";
 
-        *ccp = cc;
-
     } else {
-        for (i = 1; i < r->headers_out.cache_control.nelts; i++) {
-            ccp[i]->hash = 0;
+        for (cc = cc->next; cc; cc = cc->next) {
+            cc->hash = 0;
         }
 
-        cc = ccp[0];
+        cc = r->headers_out.cache_control;
+        cc->next = NULL;
     }
 
     expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";
openSUSE Build Service is sponsored by