@@ -131,7 +131,7 @@ static ngx_int_t ngx_http_c_func_proceed_init_calls(ngx_cycle_t* cycle, ngx_htt
131
131
static u_char * ngx_http_c_func_strdup_with_p (ngx_pool_t * pool , const char * src , size_t len );
132
132
133
133
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 );
134
- 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 );
134
+ 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 );
135
135
static void ngx_http_c_func_output_filter (ngx_http_request_t * r );
136
136
137
137
#if (NGX_THREADS )
@@ -182,7 +182,7 @@ void* ngx_http_c_func_cache_get(void *shared_mem, const char* key);
182
182
void * ngx_http_c_func_cache_put (void * shared_mem , const char * key , void * value );
183
183
void * ngx_http_c_func_cache_new (void * shared_mem , const char * key , size_t size );
184
184
void * ngx_http_c_func_cache_remove (void * shared_mem , const char * key );
185
- void ngx_http_c_func_set_resp_var (ngx_http_c_func_ctx_t * ctx , const char * resp_content );
185
+ void ngx_http_c_func_set_resp_var (ngx_http_c_func_ctx_t * ctx , const char * resp_content , size_t resp_len );
186
186
void ngx_http_c_func_write_resp (ngx_http_c_func_ctx_t * ctx , uintptr_t status_code , const char * status_line , const char * content_type , const char * resp_content , size_t resp_len );
187
187
void ngx_http_c_func_write_resp_l (ngx_http_c_func_ctx_t * ctx , uintptr_t status_code , const char * status_line ,
188
188
size_t status_line_len , const char * content_type , size_t content_type_len ,
@@ -559,7 +559,7 @@ ngx_http_c_func_pre_configuration(ngx_conf_t *cf) {
559
559
return NGX_ERROR ;
560
560
#endif
561
561
562
- #ifndef ngx_http_c_func_module_version_11
562
+ #ifndef ngx_http_c_func_module_version_12
563
563
ngx_conf_log_error (NGX_LOG_EMERG , cf , 0 , "%s" , "the latest ngx_http_c_func_module.h not found in the c header path, \
564
564
please copy latest ngx_http_c_func_module.h to your /usr/include or /usr/local/include or relavent header search path \
565
565
with read and write permission." );
@@ -1486,15 +1486,16 @@ ngx_http_c_func_get_resp_var(ngx_http_request_t *r,
1486
1486
void
1487
1487
ngx_http_c_func_set_resp_var (
1488
1488
ngx_http_c_func_ctx_t * ctx ,
1489
- const char * resp_content
1489
+ const char * resp_content ,
1490
+ size_t resp_len
1490
1491
) {
1491
1492
ngx_http_c_func_internal_ctx_t * internal_ctx ;
1492
1493
ngx_http_request_t * r = (ngx_http_request_t * )ctx -> __r__ ;
1493
1494
internal_ctx = ngx_http_get_module_ctx (r , ngx_http_c_func_module );
1494
1495
1495
1496
if (internal_ctx != NULL ) {
1496
- internal_ctx -> resp_len = ngx_strlen ( resp_content ) ;
1497
- internal_ctx -> resp = ngx_http_c_func_strdup_with_p (r -> pool , resp_content , internal_ctx -> resp_len );
1497
+ internal_ctx -> resp_len = resp_len ;
1498
+ internal_ctx -> resp = ngx_http_c_func_strdup_with_p (r -> pool , resp_content , resp_len );
1498
1499
1499
1500
/** Decline means continue to next handler for this phase **/
1500
1501
internal_ctx -> rc = NGX_DECLINED ;
@@ -1508,14 +1509,15 @@ static void
1508
1509
ngx_http_c_func_set_resp_var_with_r (
1509
1510
ngx_http_request_t * r ,
1510
1511
ngx_http_c_func_ctx_t * ctx ,
1511
- const char * resp_content
1512
+ const char * resp_content ,
1513
+ size_t resp_len
1512
1514
) {
1513
1515
ngx_http_c_func_internal_ctx_t * internal_ctx ;
1514
1516
internal_ctx = ngx_http_get_module_ctx (r , ngx_http_c_func_module );
1515
1517
1516
1518
if (internal_ctx != NULL ) {
1517
- internal_ctx -> resp_len = ngx_strlen ( resp_content ) ;
1518
- internal_ctx -> resp = ngx_http_c_func_strdup_with_p (r -> pool , resp_content , internal_ctx -> resp_len );
1519
+ internal_ctx -> resp_len = resp_len ;
1520
+ internal_ctx -> resp = ngx_http_c_func_strdup_with_p (r -> pool , resp_content , resp_len );
1519
1521
1520
1522
/** Decline means continue to next handler for this phase **/
1521
1523
internal_ctx -> rc = NGX_DECLINED ;
@@ -1545,9 +1547,8 @@ ngx_http_c_func_write_resp_l(
1545
1547
if ( ((ngx_http_c_func_loc_conf_t * ) ngx_http_get_module_loc_conf (r , ngx_http_c_func_module ) )-> _is_call_to_var ) {
1546
1548
ngx_log_error (NGX_LOG_WARN ,
1547
1549
r -> connection -> log ,
1548
- 0 , "Recommended to call ngx_http_c_func_set_resp_var. \
1549
- ngx_http_c_func_write_resp only applicable when no variable specified" );
1550
- ngx_http_c_func_set_resp_var_with_r (r , appctx , resp_content );
1550
+ 0 , "Recommended to call ngx_http_c_func_set_resp_var. ngx_http_c_func_write_resp only applicable when no variable specified" );
1551
+ ngx_http_c_func_set_resp_var_with_r (r , appctx , resp_content , resp_content_len );
1551
1552
return ;
1552
1553
}
1553
1554
0 commit comments