File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -523,14 +523,29 @@ ngx_http_c_func_post_configuration(ngx_conf_t *cf) {
523523 /***Enable pre content phase for apps concurrent processing request layer, NGX_DONE and wait for finalize request ***/
524524#if (nginx_version > 1013003 )
525525 h = ngx_array_push (& cmcf -> phases [NGX_HTTP_PRECONTENT_PHASE ].handlers );
526- #else /**Access Phase is the only last phase for multi thread**/
527- h = ngx_array_push (& cmcf -> phases [NGX_HTTP_ACCESS_PHASE ].handlers );
528- #endif
529526 if (h == NULL ) {
530527 return NGX_ERROR ;
531528 }
532529
533530 * h = ngx_http_c_func_precontent_handler ;
531+ #else
532+ /**Access Phase is the only last phase for multi thread, we need to mimic to trick nginx c function access phase at first to register,
533+ then it will be last to called as it is reverse order
534+ **/
535+ h = ngx_array_push (& cmcf -> phases [NGX_HTTP_ACCESS_PHASE ].handlers );
536+ if (h == NULL ) {
537+ return NGX_ERROR ;
538+ }
539+
540+ h = cmcf -> phases [NGX_HTTP_ACCESS_PHASE ].handlers .elts ;
541+ ngx_uint_t i ;
542+ for (i = 0 ; i < cmcf -> phases [NGX_HTTP_ACCESS_PHASE ].handlers .nelts - 1 ; i ++ ) {
543+ h [i + 1 ] = h [i ];
544+ }
545+
546+ h [0 ] = ngx_http_c_func_precontent_handler ;
547+ #endif
548+
534549 }
535550
536551 /*** Default Init for shm with 1M if pool is empty***/
You can’t perform that action at this time.
0 commit comments