@@ -5133,7 +5133,7 @@ ngx_http_qjs_ext_internal_redirect(JSContext *cx, JSValueConst this_val,
5133
5133
"internalRedirect cannot be called while filtering" );
5134
5134
}
5135
5135
5136
- if (ngx_qjs_string (ctx -> engine , argv [0 ], & ctx -> redirect_uri ) != NGX_OK ) {
5136
+ if (ngx_qjs_string (cx , argv [0 ], & ctx -> redirect_uri ) != NGX_OK ) {
5137
5137
return JS_EXCEPTION ;
5138
5138
}
5139
5139
@@ -5412,7 +5412,7 @@ ngx_http_qjs_ext_return(JSContext *cx, JSValueConst this_val,
5412
5412
ctx = ngx_http_get_module_ctx (r , ngx_http_js_module );
5413
5413
5414
5414
if (status < NGX_HTTP_BAD_REQUEST || !JS_IsNullOrUndefined (argv [1 ])) {
5415
- if (ngx_qjs_string (ctx -> engine , argv [1 ], & body ) != NGX_OK ) {
5415
+ if (ngx_qjs_string (cx , argv [1 ], & body ) != NGX_OK ) {
5416
5416
return JS_ThrowOutOfMemory (cx );
5417
5417
}
5418
5418
@@ -5515,7 +5515,7 @@ ngx_http_qjs_ext_send(JSContext *cx, JSValueConst this_val,
5515
5515
ll = & out ;
5516
5516
5517
5517
for (n = 0 ; n < (ngx_uint_t ) argc ; n ++ ) {
5518
- if (ngx_qjs_string (ctx -> engine , argv [n ], & s ) != NGX_OK ) {
5518
+ if (ngx_qjs_string (cx , argv [n ], & s ) != NGX_OK ) {
5519
5519
return JS_ThrowTypeError (cx , "failed to convert arg" );
5520
5520
}
5521
5521
@@ -5578,7 +5578,7 @@ ngx_http_qjs_ext_send_buffer(JSContext *cx, JSValueConst this_val,
5578
5578
return JS_ThrowTypeError (cx , "cannot send buffer while not filtering" );
5579
5579
}
5580
5580
5581
- if (ngx_qjs_string (ctx -> engine , argv [0 ], & buffer ) != NGX_OK ) {
5581
+ if (ngx_qjs_string (cx , argv [0 ], & buffer ) != NGX_OK ) {
5582
5582
return JS_ThrowTypeError (cx , "failed get buffer arg" );
5583
5583
}
5584
5584
@@ -5735,7 +5735,7 @@ ngx_http_qjs_subrequest_done(ngx_http_request_t *r, void *data, ngx_int_t rc)
5735
5735
reply = JS_DupValue (cx , ngx_qjs_arg (sctx -> args [0 ]));
5736
5736
}
5737
5737
5738
- rc = ngx_qjs_call (( ngx_js_ctx_t * ) ctx , event -> function , & reply , 1 );
5738
+ rc = ngx_qjs_call (cx , event -> function , & reply , 1 );
5739
5739
5740
5740
JS_FreeValue (cx , reply );
5741
5741
ngx_js_del_event (ctx , event );
@@ -5786,7 +5786,7 @@ ngx_http_qjs_ext_subrequest(JSContext *cx, JSValueConst this_val,
5786
5786
"the primary request" );
5787
5787
}
5788
5788
5789
- if (ngx_qjs_string (ctx -> engine , argv [0 ], & uri ) != NGX_OK ) {
5789
+ if (ngx_qjs_string (cx , argv [0 ], & uri ) != NGX_OK ) {
5790
5790
return JS_ThrowTypeError (cx , "failed to convert uri arg" );
5791
5791
}
5792
5792
@@ -5812,7 +5812,7 @@ ngx_http_qjs_ext_subrequest(JSContext *cx, JSValueConst this_val,
5812
5812
arg = argv [1 ];
5813
5813
5814
5814
if (JS_IsString (arg )) {
5815
- if (ngx_qjs_string (ctx -> engine , arg , & args ) != NGX_OK ) {
5815
+ if (ngx_qjs_string (cx , arg , & args ) != NGX_OK ) {
5816
5816
return JS_ThrowTypeError (cx , "failed to convert args" );
5817
5817
}
5818
5818
@@ -5833,7 +5833,7 @@ ngx_http_qjs_ext_subrequest(JSContext *cx, JSValueConst this_val,
5833
5833
}
5834
5834
5835
5835
if (!JS_IsUndefined (value )) {
5836
- rc = ngx_qjs_string (ctx -> engine , value , & args );
5836
+ rc = ngx_qjs_string (cx , value , & args );
5837
5837
JS_FreeValue (cx , value );
5838
5838
5839
5839
if (rc != NGX_OK ) {
@@ -5857,7 +5857,7 @@ ngx_http_qjs_ext_subrequest(JSContext *cx, JSValueConst this_val,
5857
5857
}
5858
5858
5859
5859
if (!JS_IsUndefined (value )) {
5860
- rc = ngx_qjs_string (ctx -> engine , value , & method_name );
5860
+ rc = ngx_qjs_string (cx , value , & method_name );
5861
5861
JS_FreeValue (cx , value );
5862
5862
5863
5863
if (rc != NGX_OK ) {
@@ -5884,7 +5884,7 @@ ngx_http_qjs_ext_subrequest(JSContext *cx, JSValueConst this_val,
5884
5884
}
5885
5885
5886
5886
if (!JS_IsUndefined (value )) {
5887
- rc = ngx_qjs_string (ctx -> engine , value , & body_arg );
5887
+ rc = ngx_qjs_string (cx , value , & body_arg );
5888
5888
JS_FreeValue (cx , value );
5889
5889
5890
5890
if (rc != NGX_OK ) {
@@ -6233,7 +6233,6 @@ ngx_http_qjs_variables_set_property(JSContext *cx, JSValueConst obj,
6233
6233
u_char * lowcase_key ;
6234
6234
ngx_str_t name , s ;
6235
6235
ngx_uint_t key ;
6236
- ngx_http_js_ctx_t * ctx ;
6237
6236
ngx_http_request_t * r ;
6238
6237
ngx_http_variable_t * v ;
6239
6238
ngx_http_variable_value_t * vv ;
@@ -6279,9 +6278,7 @@ ngx_http_qjs_variables_set_property(JSContext *cx, JSValueConst obj,
6279
6278
return -1 ;
6280
6279
}
6281
6280
6282
- ctx = ngx_http_get_module_ctx (r , ngx_http_js_module );
6283
-
6284
- if (ngx_qjs_string (ctx -> engine , value , & s ) != NGX_OK ) {
6281
+ if (ngx_qjs_string (cx , value , & s ) != NGX_OK ) {
6285
6282
return -1 ;
6286
6283
}
6287
6284
@@ -6692,15 +6689,14 @@ ngx_http_qjs_headers_out_handler(JSContext *cx, ngx_http_request_t *r,
6692
6689
ngx_str_t * name , JSPropertyDescriptor * pdesc , JSValue * value ,
6693
6690
unsigned flags )
6694
6691
{
6695
- u_char * p ;
6696
- int64_t length ;
6697
- uint32_t i ;
6698
- ngx_int_t rc ;
6699
- ngx_str_t s ;
6700
- JSValue v ;
6701
- ngx_list_part_t * part ;
6702
- ngx_table_elt_t * header , * h , * * ph ;
6703
- ngx_http_js_ctx_t * ctx ;
6692
+ u_char * p ;
6693
+ int64_t length ;
6694
+ uint32_t i ;
6695
+ ngx_int_t rc ;
6696
+ ngx_str_t s ;
6697
+ JSValue v ;
6698
+ ngx_list_part_t * part ;
6699
+ ngx_table_elt_t * header , * h , * * ph ;
6704
6700
6705
6701
if (flags & NJS_HEADER_GET ) {
6706
6702
return ngx_http_qjs_header_generic (cx , r , & r -> headers_out .headers , NULL ,
@@ -6758,7 +6754,6 @@ ngx_http_qjs_headers_out_handler(JSContext *cx, ngx_http_request_t *r,
6758
6754
}
6759
6755
6760
6756
ph = & header ;
6761
- ctx = ngx_http_get_module_ctx (r , ngx_http_js_module );
6762
6757
6763
6758
for (i = 0 ; i < (uint32_t ) length ; i ++ ) {
6764
6759
if (JS_IsArray (cx , * value )) {
@@ -6768,7 +6763,7 @@ ngx_http_qjs_headers_out_handler(JSContext *cx, ngx_http_request_t *r,
6768
6763
}
6769
6764
}
6770
6765
6771
- rc = ngx_qjs_string (ctx -> engine , v , & s );
6766
+ rc = ngx_qjs_string (cx , v , & s );
6772
6767
6773
6768
if (JS_IsArray (cx , * value )) {
6774
6769
JS_FreeValue (cx , v );
@@ -6828,15 +6823,14 @@ ngx_http_qjs_headers_out_special_handler(JSContext *cx, ngx_http_request_t *r,
6828
6823
ngx_str_t * name , JSPropertyDescriptor * pdesc , JSValue * value ,
6829
6824
unsigned flags , ngx_table_elt_t * * hh )
6830
6825
{
6831
- u_char * p ;
6832
- uint32_t length ;
6833
- JSValue len , setval ;
6834
- ngx_str_t s ;
6835
- ngx_uint_t i , rc ;
6836
- ngx_list_t * headers ;
6837
- ngx_list_part_t * part ;
6838
- ngx_table_elt_t * header , * h ;
6839
- ngx_http_js_ctx_t * ctx ;
6826
+ u_char * p ;
6827
+ uint32_t length ;
6828
+ JSValue len , setval ;
6829
+ ngx_str_t s ;
6830
+ ngx_uint_t i , rc ;
6831
+ ngx_list_t * headers ;
6832
+ ngx_list_part_t * part ;
6833
+ ngx_table_elt_t * header , * h ;
6840
6834
6841
6835
if (flags & NJS_HEADER_GET ) {
6842
6836
return ngx_http_qjs_headers_out_handler (cx , r , name , pdesc , NULL ,
@@ -6870,9 +6864,7 @@ ngx_http_qjs_headers_out_special_handler(JSContext *cx, ngx_http_request_t *r,
6870
6864
setval = JS_UNDEFINED ;
6871
6865
}
6872
6866
6873
- ctx = ngx_http_get_module_ctx (r , ngx_http_js_module );
6874
-
6875
- rc = ngx_qjs_string (ctx -> engine , setval , & s );
6867
+ rc = ngx_qjs_string (cx , setval , & s );
6876
6868
6877
6869
if (value != NULL && JS_IsArray (cx , * value )) {
6878
6870
JS_FreeValue (cx , setval );
@@ -7054,7 +7046,6 @@ ngx_http_qjs_headers_out_content_type(JSContext *cx, ngx_http_request_t *r,
7054
7046
JSValue len , setval ;
7055
7047
ngx_int_t rc ;
7056
7048
ngx_str_t * hdr , s ;
7057
- ngx_http_js_ctx_t * ctx ;
7058
7049
7059
7050
if (flags & NJS_HEADER_GET ) {
7060
7051
hdr = & r -> headers_out .content_type ;
@@ -7108,9 +7099,7 @@ ngx_http_qjs_headers_out_content_type(JSContext *cx, ngx_http_request_t *r,
7108
7099
setval = * value ;
7109
7100
}
7110
7101
7111
- ctx = ngx_http_get_module_ctx (r , ngx_http_js_module );
7112
-
7113
- rc = ngx_qjs_string (ctx -> engine , setval , & s );
7102
+ rc = ngx_qjs_string (cx , setval , & s );
7114
7103
7115
7104
if (JS_IsArray (cx , * value )) {
7116
7105
JS_FreeValue (cx , setval );
0 commit comments