@@ -56,8 +56,9 @@ typedef struct {
5656typedef struct {
5757 ngx_http_tnt_eval_loc_conf_t * base_conf ;
5858 ngx_http_variable_value_t * * values ;
59- unsigned int done :1 ;
60- unsigned int in_progress :1 ;
59+ ngx_int_t status ;
60+ ngx_int_t done :1 ;
61+ ngx_int_t in_progress :1 ;
6162
6263 /* A reference to the main request */
6364 ngx_http_request_t * r ;
@@ -206,6 +207,14 @@ ngx_http_tnt_eval_handler(ngx_http_request_t *r)
206207
207208 if (ctx -> done ) {
208209 dd ("subrequest done, r = %p, ctx = %p" , r , ctx );
210+
211+ /** If tnt_pass is down, then status should be passed to the client.
212+ * 0 meas that upstream works
213+ */
214+ if (ctx -> status != 0 ) {
215+ return ctx -> status ;
216+ }
217+
209218 return NGX_DECLINED ;
210219 }
211220
@@ -310,6 +319,8 @@ ngx_http_tnt_eval_post_subrequest_handler(ngx_http_request_t *r, void *data,
310319
311320 ctx -> done = 1 ;
312321
322+ ctx -> status = rc ;
323+
313324#if 0
314325 /* work-around a bug in the nginx core (ngx_http_named_location)
315326 */
@@ -827,15 +838,15 @@ ngx_http_tnt_eval_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
827838
828839 clcf = ctx -> loc_conf [ngx_http_core_module .ctx_index ];
829840
830- name .len = sizeof ("/eval_ " ) - 1 + NGX_OFF_T_LEN ;
841+ name .len = sizeof ("/tnt_eval_ " ) - 1 + NGX_OFF_T_LEN ;
831842
832843 name .data = ngx_palloc (cf -> pool , name .len );
833844
834845 if (name .data == NULL ) {
835846 return NGX_CONF_ERROR ;
836847 }
837848
838- name .len = ngx_sprintf (name .data , "/eval_ %O" , (off_t )(uintptr_t ) clcf )
849+ name .len = ngx_sprintf (name .data , "/tnt_eval_ %O" , (off_t )(uintptr_t ) clcf )
839850 - name .data ;
840851
841852 clcf -> loc_conf = ctx -> loc_conf ;
0 commit comments