* 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

@ -560,8 +560,9 @@ xml_chardata_cbuf_append(cbuf *cb,
* err;
* @endcode
*
* a=b&c=d -> [[a,"b"][c="d"]
* kalle&c=d -> [[c="d"]] # Discard elements with no delim2
* a=b&c=d -> [[a,"b"][c,"d"]
* a&b= -> [[a,null][b,""]]
* Note difference between empty (CGV_EMPTY) and empty string (CGV_STRING)
* XXX differentiate between error and null cvec.
*/
int
@ -622,12 +623,11 @@ uri_str2cvec(char *string,
}
else{
if (strlen(s)){
if ((cv = cvec_add(cvv, CGV_STRING)) == NULL){
if ((cv = cvec_add(cvv, CGV_EMPTY)) == NULL){
clicon_err(OE_UNIX, errno, "cvec_add");
goto err;
}
cv_name_set(cv, s);
cv_string_set(cv, "");
}
}
s = snext;