diff --git a/apps/restconf/restconf_lib.c b/apps/restconf/restconf_lib.c
index 2980261d..eea482de 100644
--- a/apps/restconf/restconf_lib.c
+++ b/apps/restconf/restconf_lib.c
@@ -755,6 +755,7 @@ restconf_config_init(clicon_handle h,
cvec *nsc = NULL;
int auth_type;
yang_stmt *yspec;
+ yang_stmt *y;
if ((yspec = clicon_dbspec_yang(h)) == NULL){
clicon_err(OE_FATAL, 0, "No DB_SPEC");
@@ -786,14 +787,27 @@ restconf_config_init(clicon_handle h,
else if (strcmp(bstr, "false") == 0)
restconf_pretty_set(h, 0);
}
+ /* Check if enable-http-data is true and that feature is enabled
+ * It is protected by if-feature http-data, which means if the feature is not enabled, its
+ * YANG spec will exist but by ANYDATA
+ */
if ((x = xpath_first(xrestconf, nsc, "enable-http-data")) != NULL &&
- (bstr = xml_body(x)) != NULL){
- if (strcmp(bstr, "true") == 0)
- restconf_http_data_set(h, 1);
- else if (strcmp(bstr, "false") == 0)
- restconf_http_data_set(h, 0);
+ (y = xml_spec(x)) != NULL &&
+ yang_keyword_get(y) != Y_ANYDATA &&
+ (bstr = xml_body(x)) != NULL &&
+ strcmp(bstr, "true") == 0) {
+ restconf_http_data_set(h, 1);
}
+ else if (strcmp(bstr, "false") == 0){
+ restconf_http_data_set(h, 0);
+ }
+ /* Check if fcgi-socket is true and that feature is enabled
+ * It is protected by if-feature fcgi, which means if the feature is not enabled, then
+ * YANG spec will exist but by ANYDATA
+ */
if ((x = xpath_first(xrestconf, nsc, "fcgi-socket")) != NULL &&
+ (y = xml_spec(x)) != NULL &&
+ yang_keyword_get(y) != Y_ANYDATA &&
(bstr = xml_body(x)) != NULL){
if (restconf_fcgi_socket_set(h, bstr) < 0)
goto done;
diff --git a/test/lib.sh b/test/lib.sh
index c4a2a771..74cbe64c 100755
--- a/test/lib.sh
+++ b/test/lib.sh
@@ -239,20 +239,20 @@ function restconf_config()
# Change this to fixed parameters
if [ $# -gt 2 ]; then
- proto=$3
+ myproto=$3
else
- proto=$RCPROTO
+ myproto=$RCPROTO
fi
if [ $# -gt 3 ]; then
- http_data=$4
+ myhttpdata=$4
else
- http_data=false
+ myhttpdata=false
fi
echo -n "clixon-restconf:fcgi"
- if [ $proto = http ]; then
+ if [ $myproto = http ]; then
echo -n "true"
- if ${http_data}; then
+ if ${myhttpdata}; then
echo -n "true"
fi
echo "$AUTH$PRETTY$DBGdefault0.0.0.080false"
@@ -269,7 +269,7 @@ function restconf_config()
servercerts $cakey $cacert $srvkey $srvcert
fi
echo -n "true"
- if ${http_data}; then
+ if ${myhttpdata}; then
echo -n "true"
fi
echo "$AUTH$PRETTY${certdir}/clixon-server-crt.pem${certdir}/clixon-server-key.pem${certdir}/clixon-ca-crt.pem$DBGdefault0.0.0.0443true"
diff --git a/test/test_perf_restconf.sh b/test/test_perf_restconf.sh
index fc08aee3..50f1fa41 100755
--- a/test/test_perf_restconf.sh
+++ b/test/test_perf_restconf.sh
@@ -244,6 +244,8 @@ rm -rf $dir
unset RESTCONFIG
unset HAVE_LIBNGHTTP2
unset RCPROTO
+unset HVER
+unset CURLOPTS
# unset conditional parameters
unset format
diff --git a/test/test_restconf.sh b/test/test_restconf.sh
index 38b79478..d1c13a8b 100755
--- a/test/test_restconf.sh
+++ b/test/test_restconf.sh
@@ -557,6 +557,7 @@ for proto in $protos; do
done
# unset conditional parameters
+unset HVER
unset RCPROTO
# Set by restconf_config
diff --git a/test/test_restconf_continue.sh b/test/test_restconf_continue.sh
index 8e5a7c99..0cbf76d3 100755
--- a/test/test_restconf_continue.sh
+++ b/test/test_restconf_continue.sh
@@ -133,6 +133,8 @@ fi
unset RESTCONFIG
unset nr
unset HAVE_LIBNGHTTP2
+unset CURLOPTS
+unset HVER
rm -rf $dir
diff --git a/test/test_restconf_err.sh b/test/test_restconf_err.sh
index 3a12aa88..1a936cde 100755
--- a/test/test_restconf_err.sh
+++ b/test/test_restconf_err.sh
@@ -352,6 +352,7 @@ fi
unset RESTCONFIG
unset HVER
unset RCPROTO
+unset CURLOPTS
unset HAVE_LIBNGHTTP2
rm -rf $dir