From 73129b96d9f1dc99ba18008b5dfd10ef4bd7b643 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sat, 26 Oct 2024 17:07:25 +0200 Subject: [PATCH] Test: restconf http1.1 only had http2 test test: snmpwalk -t for valgrind leak in clicon_rpc --- lib/src/clixon_proto.c | 7 ++++--- test/lib.sh | 2 +- test/test_restconf.sh | 9 --------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/src/clixon_proto.c b/lib/src/clixon_proto.c index bfa9dae9..97d072cd 100644 --- a/lib/src/clixon_proto.c +++ b/lib/src/clixon_proto.c @@ -676,8 +676,6 @@ clicon_rpc(int sock, cprintf(cbsend, "%s", msg->op_body); if (clixon_msg_send11(sock, descr, cbsend) < 0) goto done; - if (cbsend) - cbuf_free(cbsend); if (clixon_msg_rcv11(sock, descr, 0, &cbrcv, eof) < 0) goto done; if (*eof) @@ -687,11 +685,14 @@ clicon_rpc(int sock, clixon_err(OE_UNIX, errno, "strdup"); goto done; } - cbuf_free(cbrcv); } ok: retval = 0; done: + if (cbsend) + cbuf_free(cbsend); + if (cbrcv) + cbuf_free(cbrcv); clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval); if (reply) free(reply); diff --git a/test/lib.sh b/test/lib.sh index 4a1b76c2..0a881adf 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -232,7 +232,7 @@ if $SNMPCHECK; then if [ $valgrindtest -ne 0 ]; then # To avoid "Timeout: No Response from localhost" from netsnmp/snmpd set timeout to 10s snmptable="$(type -p snmptable) -c public -v2c localhost -t 10 " - snmpwalk="$(type -p snmpwalk) -c public -v2c localhost -t 10 " + snmpwalk="$(type -p snmpwalk) -c public -t 10 -v2c localhost " else snmptable="$(type -p snmptable) -c public -v2c localhost " snmpwalk="$(type -p snmpwalk) -c public -v2c localhost " diff --git a/test/test_restconf.sh b/test/test_restconf.sh index 6bd6321d..11d841be 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -418,15 +418,6 @@ function testrun() new "restconf GET http/2 switch protocol" expectpart "$(curl $CURLOPTS --http2 -X GET $proto://$addr/.well-known/host-meta)" 0 "HTTP/1.1 200 OK" "" "" "" - # http2-prior knowledge - if [ $proto = http ]; then # see (2) https to http port in restconf_main_native.c - new "restconf GET http/2 prior-knowledge (http)" - expectpart "$(curl $CURLOPTS --http2-prior-knowledge -X GET $proto://$addr/.well-known/host-meta 2>&1)" "16 52 55 56" # "Error in the HTTP2 framing layer" "Connection reset by peer" - else - new "restconf GET https/2 prior-knowledge" - expectpart "$(curl $CURLOPTS --http2-prior-knowledge -X GET $proto://$addr/.well-known/host-meta)" 0 "HTTP/$HVER 200" "" "" "" - fi - # Wrong protocol http when https or vice versa if [ $proto = http ]; then # see (2) https to http port in restconf_main_native.c new "Wrong proto=https on http port, expect err 35 wrong version number"