Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTS doesn't support query string encoding #279

Open
vultj opened this issue Sep 25, 2023 · 1 comment · May be fixed by #287
Open

VTS doesn't support query string encoding #279

vultj opened this issue Sep 25, 2023 · 1 comment · May be fixed by #287

Comments

@vultj
Copy link

vultj commented Sep 25, 2023

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
Copy link
Collaborator

u5surf commented Sep 25, 2023

@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.

u5surf added a commit to u5surf/nginx-module-vts that referenced this issue Dec 31, 2023
@u5surf u5surf linked a pull request Dec 31, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants