* RESTCONF in Clixon used empty key as "wildchar". But according to RFC 8040 it should mean the "empty string".

* Example: `GET restconf/data/x:a=`
  * Previous meaning (wrong): Return all `a` elements.
  * New meaning (correct): Return the `a` instance with empty key string: "".
* [RESTCONF GET request of single-key list with empty string returns all elements #213](https://github.com/clicon/clixon/issues/213)
* [RESTCONF GETof lists with empty string keys does not work #214](https://github.com/clicon/clixon/issues/214)
This commit is contained in:
Olof hagsand 2021-05-05 15:04:22 +02:00
parent af04ec9e9d
commit 17e7b25537
8 changed files with 77 additions and 22 deletions

View file

@ -824,8 +824,12 @@ xp_relop(xp_ctx *xc1,
s1 = xml_body(x);
switch(op){
case XO_EQ:
if (s1 == NULL || s2 == NULL)
xr->xc_bool = (s1==NULL && s2 == NULL);
if (s1 == NULL && s2 == NULL)
xr->xc_bool = 1;
else if (s1 == NULL && strlen(s2) == 0)
xr->xc_bool = 1;
else if (strlen(s1) == 0 && s2 == NULL)
xr->xc_bool = 1;
else
xr->xc_bool = (strcmp(s1, s2)==0);
break;