@@ -92,6 +92,7 @@ ngx_http_vhost_traffic_status_display_set_server_node(
9292 }
9393
9494#if (NGX_HTTP_CACHE )
95+ ngx_http_vhost_traffic_status_display_encode_uri (r , & dst );
9596 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_SERVER ,
9697 & dst , vtsn -> stat_request_counter ,
9798 vtsn -> stat_in_bytes ,
@@ -140,6 +141,7 @@ ngx_http_vhost_traffic_status_display_set_server_node(
140141 vtsn -> stat_cache_scarce_counter_oc ,
141142 vtsn -> stat_request_time_counter_oc );
142143#else
144+ ngx_http_vhost_traffic_status_display_encode_uri (r , & dst );
143145 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_SERVER ,
144146 & dst , vtsn -> stat_request_counter ,
145147 vtsn -> stat_in_bytes ,
@@ -286,6 +288,31 @@ ngx_http_vhost_traffic_status_display_set_filter_node(ngx_http_request_t *r,
286288 return ngx_http_vhost_traffic_status_display_set_server_node (r , buf , & key , vtsn );
287289}
288290
291+ void
292+ ngx_http_vhost_traffic_status_display_encode_uri (ngx_http_request_t * r ,
293+ ngx_str_t * uri )
294+ {
295+
296+ size_t len ;
297+ ngx_str_t * euri ;
298+ u_char * p ;
299+ euri = uri ;
300+ len = ngx_escape_html (NULL , uri -> data , uri -> len );
301+
302+ if (len ) {
303+ p = ngx_pnalloc (r -> pool , uri -> len + len );
304+ if (p == NULL ) {
305+ ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
306+ "display_encode_uri::ngx_pnalloc() failed" );
307+ }
308+
309+ (void ) ngx_escape_html (p , uri -> data , uri -> len );
310+ euri -> data = p ;
311+ euri -> len = uri -> len + len ;
312+ uri = euri ;
313+ }
314+ return ;
315+ }
289316
290317u_char *
291318ngx_http_vhost_traffic_status_display_set_filter (ngx_http_request_t * r ,
@@ -332,6 +359,7 @@ ngx_http_vhost_traffic_status_display_set_filter(ngx_http_request_t *r,
332359 "display_set_filter::escape_json_pool() failed" );
333360 }
334361
362+ ngx_http_vhost_traffic_status_display_encode_uri (r , & filter );
335363 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_OBJECT_S ,
336364 & filter );
337365
@@ -392,6 +420,7 @@ ngx_http_vhost_traffic_status_display_set_upstream_node(ngx_http_request_t *r,
392420 }
393421
394422 if (vtsn != NULL ) {
423+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
395424 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_UPSTREAM ,
396425 & key , vtsn -> stat_request_counter ,
397426 vtsn -> stat_in_bytes , vtsn -> stat_out_bytes ,
@@ -434,6 +463,7 @@ ngx_http_vhost_traffic_status_display_set_upstream_node(ngx_http_request_t *r,
434463 vtsn -> stat_request_time_counter_oc , vtsn -> stat_response_time_counter_oc );
435464
436465 } else {
466+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
437467 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_UPSTREAM ,
438468 & key , (ngx_atomic_uint_t ) 0 ,
439469 (ngx_atomic_uint_t ) 0 , (ngx_atomic_uint_t ) 0 ,
@@ -563,6 +593,7 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
563593
564594 o = buf ;
565595
596+ ngx_http_vhost_traffic_status_display_encode_uri (r , & uscf -> host );
566597 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_ARRAY_S ,
567598 & uscf -> host );
568599 s = buf ;
@@ -703,6 +734,7 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
703734
704735 ngx_str_set (& key , "::nogroups" );
705736
737+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
706738 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_ARRAY_S , & key );
707739
708740 s = buf ;
@@ -742,6 +774,7 @@ u_char
742774 "display_set_cache_node::escape_json_pool() failed" );
743775 }
744776
777+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
745778 buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_CACHE ,
746779 & key , vtsn -> stat_cache_max_size ,
747780 vtsn -> stat_cache_used_size ,
0 commit comments