@@ -134,13 +134,13 @@ static u_char* ngx_http_c_func_strdup_with_p(ngx_pool_t *pool, const char *src,
134
134
135
135
// static ngx_int_t ngx_http_c_func_get_resp_var(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data);
136
136
// static void ngx_http_c_func_set_resp_var_with_r(ngx_http_request_t *r, ngx_http_c_func_ctx_t *ctx, const char* resp_content, size_t resp_len);
137
- #if (nginx_version > 1013003 )
137
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
138
138
static void ngx_http_c_func_output_filter (ngx_http_request_t * r );
139
139
#else
140
140
static ngx_int_t ngx_http_c_func_output_filter (ngx_http_request_t * r );
141
141
#endif
142
142
143
- #if (NGX_THREADS && nginx_version > 1013003 )
143
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
144
144
static void ngx_http_c_func_after_process (ngx_event_t * ev );
145
145
static void ngx_http_c_func_process_t_handler (void * data , ngx_log_t * log );
146
146
#endif
@@ -549,13 +549,8 @@ ngx_http_c_func_post_configuration(ngx_conf_t *cf) {
549
549
* h = ngx_http_c_func_rewrite_handler ;
550
550
551
551
/***Enable pre content phase for apps concurrent processing request layer, NGX_DONE and wait for finalize request ***/
552
- #if (nginx_version > 1013003 )
552
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
553
553
h = ngx_array_push (& cmcf -> phases [NGX_HTTP_PRECONTENT_PHASE ].handlers );
554
- if (h == NULL ) {
555
- return NGX_ERROR ;
556
- }
557
-
558
- * h = ngx_http_c_func_precontent_handler ;
559
554
#else
560
555
/**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,
561
556
then it will be last to called as it is reverse order
@@ -571,10 +566,14 @@ ngx_http_c_func_post_configuration(ngx_conf_t *cf) {
571
566
// h[i + 1] = h[i];
572
567
// }
573
568
574
- // h[0] = ngx_http_c_func_precontent_handler;
575
- * h = ngx_http_c_func_precontent_handler ;
576
-
569
+ // h[0] = ngx_http_c_func_precontent_handler;
577
570
#endif
571
+
572
+ if (h == NULL ) {
573
+ return NGX_ERROR ;
574
+ }
575
+
576
+ * h = ngx_http_c_func_precontent_handler ;
578
577
579
578
}
580
579
@@ -627,7 +626,7 @@ ngx_http_c_func_module_init(ngx_cycle_t *cycle) {
627
626
628
627
cscfp = cmcf -> servers .elts ;
629
628
630
- #if (NGX_THREADS && nginx_version > 1013003 )
629
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
631
630
ngx_log_error (NGX_LOG_NOTICE , cycle -> log , 0 , " enabled aio threads for c-function module " );
632
631
#endif
633
632
@@ -941,7 +940,7 @@ ngx_http_c_func_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) {
941
940
return NGX_CONF_OK ;
942
941
}
943
942
944
- #if (NGX_THREADS && nginx_version > 1013003 )
943
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
945
944
static void
946
945
ngx_http_c_func_process_t_handler (void * data , ngx_log_t * log )
947
946
{
@@ -1024,7 +1023,7 @@ ngx_http_c_func_precontent_handler(ngx_http_request_t *r) {
1024
1023
if (internal_ctx -> aio_processing ) {
1025
1024
return NGX_AGAIN ;
1026
1025
} else {
1027
- #if (nginx_version > 1013003 )
1026
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
1028
1027
ngx_http_c_func_output_filter (r );
1029
1028
return NGX_DONE ;
1030
1029
#else
@@ -1136,7 +1135,7 @@ ngx_http_c_func_precontent_handler(ngx_http_request_t *r) {
1136
1135
new_ctx -> req_body_len = 0 ;
1137
1136
}
1138
1137
1139
- #if (NGX_THREADS && nginx_version > 1013003 )
1138
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
1140
1139
internal_ctx -> aio_processing = 1 ;
1141
1140
ngx_thread_pool_t * tp ;
1142
1141
ngx_http_core_loc_conf_t * clcf ;
@@ -1167,7 +1166,7 @@ ngx_http_c_func_precontent_handler(ngx_http_request_t *r) {
1167
1166
ngx_log_error (NGX_LOG_WARN , r -> connection -> log , 0 , " nginx c function with nginx 1.13.3 and below is running single thread only, upgrade to nginx > 1.13.3 for concurrent request" );
1168
1167
#endif
1169
1168
lcf -> _handler (new_ctx );
1170
- #if (nginx_version > 1013003 )
1169
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
1171
1170
ngx_http_c_func_output_filter (r );
1172
1171
return NGX_DONE ;
1173
1172
#else
@@ -1755,7 +1754,7 @@ ngx_http_c_func_write_resp(
1755
1754
);
1756
1755
}
1757
1756
1758
- #if (nginx_version > 1013003 )
1757
+ #if (NGX_THREADS ) && ( nginx_version > 1013003 )
1759
1758
static void
1760
1759
ngx_http_c_func_output_filter (
1761
1760
ngx_http_request_t * r
0 commit comments