@@ -92,6 +92,7 @@ ngx_http_vhost_traffic_status_display_set_server_node(
92
92
}
93
93
94
94
#if (NGX_HTTP_CACHE )
95
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & dst );
95
96
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_SERVER ,
96
97
& dst , vtsn -> stat_request_counter ,
97
98
vtsn -> stat_in_bytes ,
@@ -140,6 +141,7 @@ ngx_http_vhost_traffic_status_display_set_server_node(
140
141
vtsn -> stat_cache_scarce_counter_oc ,
141
142
vtsn -> stat_request_time_counter_oc );
142
143
#else
144
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & dst );
143
145
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_SERVER ,
144
146
& dst , vtsn -> stat_request_counter ,
145
147
vtsn -> stat_in_bytes ,
@@ -286,6 +288,31 @@ ngx_http_vhost_traffic_status_display_set_filter_node(ngx_http_request_t *r,
286
288
return ngx_http_vhost_traffic_status_display_set_server_node (r , buf , & key , vtsn );
287
289
}
288
290
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
+ }
289
316
290
317
u_char *
291
318
ngx_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,
332
359
"display_set_filter::escape_json_pool() failed" );
333
360
}
334
361
362
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & filter );
335
363
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_OBJECT_S ,
336
364
& filter );
337
365
@@ -392,6 +420,7 @@ ngx_http_vhost_traffic_status_display_set_upstream_node(ngx_http_request_t *r,
392
420
}
393
421
394
422
if (vtsn != NULL ) {
423
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
395
424
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_UPSTREAM ,
396
425
& key , vtsn -> stat_request_counter ,
397
426
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,
434
463
vtsn -> stat_request_time_counter_oc , vtsn -> stat_response_time_counter_oc );
435
464
436
465
} else {
466
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
437
467
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_UPSTREAM ,
438
468
& key , (ngx_atomic_uint_t ) 0 ,
439
469
(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,
563
593
564
594
o = buf ;
565
595
596
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & uscf -> host );
566
597
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_ARRAY_S ,
567
598
& uscf -> host );
568
599
s = buf ;
@@ -703,6 +734,7 @@ ngx_http_vhost_traffic_status_display_set_upstream_group(ngx_http_request_t *r,
703
734
704
735
ngx_str_set (& key , "::nogroups" );
705
736
737
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
706
738
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_ARRAY_S , & key );
707
739
708
740
s = buf ;
@@ -742,6 +774,7 @@ u_char
742
774
"display_set_cache_node::escape_json_pool() failed" );
743
775
}
744
776
777
+ ngx_http_vhost_traffic_status_display_encode_uri (r , & key );
745
778
buf = ngx_sprintf (buf , NGX_HTTP_VHOST_TRAFFIC_STATUS_JSON_FMT_CACHE ,
746
779
& key , vtsn -> stat_cache_max_size ,
747
780
vtsn -> stat_cache_used_size ,
0 commit comments