aboutsummaryrefslogtreecommitdiff
path: root/src/ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctl.c')
-rw-r--r--src/ctl.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ctl.c b/src/ctl.c
index 8845390..0960d54 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -917,7 +917,7 @@ static struct ctlio_resource *
find_resource (struct ctlio *io, const char *endpoint)
{
struct ctlio_resource *p;
- size_t len = strlen (endpoint);
+ size_t len = strcspn (endpoint, "?");
if (len == 0)
return NULL;
@@ -927,7 +927,9 @@ find_resource (struct ctlio *io, const char *endpoint)
for (p = restab; p->uri; p++)
if (len >= p->uri_len && memcmp (p->uri, endpoint, p->uri_len) == 0
- && (endpoint[p->uri_len] == 0 || endpoint[p->uri_len] == '/'))
+ && (endpoint[p->uri_len] == 0
+ || endpoint[p->uri_len] == '/'
+ || endpoint[p->uri_len] == '?'))
return p;
return NULL;
}
@@ -935,11 +937,8 @@ find_resource (struct ctlio *io, const char *endpoint)
static char *
json_extract (char *uri)
{
- char *p = strrchr (uri, '/');
- if (p && (strchr ("\"{[", p[1])
- || strcmp ("true", p + 1) == 0
- || strcmp ("false", p + 1) == 0
- || strcmp ("null", p + 1) == 0))
+ char *p = strchr (uri, '?');
+ if (p)
{
*p++ = 0;
return p;

Return to:

Send suggestions and report system problems to the System administrator.