Skip to content

Commit 85e1e8d

Browse files
authored
Merge pull request #60 from BenBE/fix-1.23
Fix compilation issues with nginx 1.23
2 parents 68b3ab3 + 83a4c76 commit 85e1e8d

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

ngx_http_uploadprogress_module.c

+13-19
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,12 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
559559
ngx_chain_t out;
560560
ngx_int_t rc, found=0, done=0, err_status=0;
561561
off_t rest=0, length=0;
562-
ngx_uint_t len, i;
562+
ngx_uint_t len;
563563
ngx_slab_pool_t *shpool;
564564
ngx_http_uploadprogress_conf_t *upcf;
565565
ngx_http_uploadprogress_ctx_t *ctx;
566566
ngx_http_uploadprogress_node_t *up;
567-
ngx_table_elt_t *expires, *cc, **ccp;
567+
ngx_table_elt_t *expires, *cc;
568568
ngx_http_uploadprogress_state_t state;
569569
ngx_http_uploadprogress_template_t *t;
570570

@@ -637,6 +637,7 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
637637
}
638638

639639
r->headers_out.expires = expires;
640+
expires->next = NULL;
640641

641642
expires->hash = 1;
642643
expires->key.len = sizeof("Expires") - 1;
@@ -646,37 +647,30 @@ ngx_http_reportuploads_handler(ngx_http_request_t * r)
646647
len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT");
647648
expires->value.len = len - 1;
648649

649-
ccp = r->headers_out.cache_control.elts;
650-
if (ccp == NULL) {
650+
cc = r->headers_out.cache_control;
651651

652-
if (ngx_array_init(&r->headers_out.cache_control, r->pool,
653-
1, sizeof(ngx_table_elt_t *))
654-
!= NGX_OK) {
655-
return NGX_HTTP_INTERNAL_SERVER_ERROR;
656-
}
657-
658-
ccp = ngx_array_push(&r->headers_out.cache_control);
659-
if (ccp == NULL) {
660-
return NGX_HTTP_INTERNAL_SERVER_ERROR;
661-
}
652+
if (cc == NULL) {
662653

663654
cc = ngx_list_push(&r->headers_out.headers);
664655
if (cc == NULL) {
656+
expires->hash = 0;
665657
return NGX_HTTP_INTERNAL_SERVER_ERROR;
666658
}
667659

660+
r->headers_out.cache_control = cc;
661+
cc->next = NULL;
662+
668663
cc->hash = 1;
669664
cc->key.len = sizeof("Cache-Control") - 1;
670665
cc->key.data = (u_char *) "Cache-Control";
671666

672-
*ccp = cc;
673-
674667
} else {
675-
for (i = 1; i < r->headers_out.cache_control.nelts; i++) {
676-
ccp[i]->hash = 0;
668+
for (cc = cc->next; cc; cc = cc->next) {
669+
cc->hash = 0;
677670
}
678671

679-
cc = ccp[0];
672+
cc = r->headers_out.cache_control;
673+
cc->next = NULL;
680674
}
681675

682676
expires->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";

0 commit comments

Comments
 (0)