vozlt/nginx-module-vts

VTS doesn't support query string encoding

vultj opened this issue · 1 comments

vultj commented

If query strings are "encoded", * is turned into %2A. This is not supported by vts, see below:

# curl '127.0.0.1:9001/status/control?cmd=reset&group=%2A'
{"processingReturn":false,"processingCommandString":"reset","processingGroupString":"%2A","processingZoneString":"","processingCounts":0}
# curl '127.0.0.1:9001/status/control?cmd=reset&group=*'
{"processingReturn":true,"processingCommandString":"reset","processingGroupString":"*","processingZoneString":"","processingCounts":8}
u5surf commented

@vultj
Thanks reporting.

Indeed, although it seems to be a some kind of specification because the other characters (e.g. @) does not support escaping and it should restrict to display the data properly.
We'll consider whether it has a validity to add the rule of escaped character by confirming the other usecase or the another nginx's modules.

if (ngx_http_arg(r, (u_char *) "group", 5, &arg_group) == NGX_OK) {
if (arg_group.len == 1 && ngx_strncmp(arg_group.data, "*", 1) == 0)
{
control->group = -1;
}
else if (arg_group.len == 6
&& ngx_strncasecmp(arg_group.data, (u_char *) "server", 6) == 0)
{
control->group = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_NO;
}
else if (arg_group.len == 14
&& ngx_strncasecmp(arg_group.data, (u_char *) "upstream@alone", 14) == 0)
{
control->group = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_UA;
}
else if (arg_group.len == 14
&& ngx_strncasecmp(arg_group.data, (u_char *) "upstream@group", 14) == 0)
{
control->group = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_UG;
}
else if (arg_group.len == 5
&& ngx_strncasecmp(arg_group.data, (u_char *) "cache", 5) == 0)
{
control->group = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_CC;
}
else if (arg_group.len == 6
&& ngx_strncasecmp(arg_group.data, (u_char *) "filter", 6) == 0)
{
control->group = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_FG;
}
else {
control->command = NGX_HTTP_VHOST_TRAFFIC_STATUS_CONTROL_CMD_NONE;
}
}

Moreover, could you tell me what specifically do you have trouble with?
I wanna know by what had been escaped the query string.