Test: restconf http1.1 only had http2 test

test: snmpwalk -t for valgrind
leak in clicon_rpc
This commit is contained in:
Olof hagsand 2024-10-26 17:07:25 +02:00
parent 537df0756d
commit 73129b96d9
3 changed files with 5 additions and 13 deletions

View file

@ -676,8 +676,6 @@ clicon_rpc(int sock,
cprintf(cbsend, "%s", msg->op_body); cprintf(cbsend, "%s", msg->op_body);
if (clixon_msg_send11(sock, descr, cbsend) < 0) if (clixon_msg_send11(sock, descr, cbsend) < 0)
goto done; goto done;
if (cbsend)
cbuf_free(cbsend);
if (clixon_msg_rcv11(sock, descr, 0, &cbrcv, eof) < 0) if (clixon_msg_rcv11(sock, descr, 0, &cbrcv, eof) < 0)
goto done; goto done;
if (*eof) if (*eof)
@ -687,11 +685,14 @@ clicon_rpc(int sock,
clixon_err(OE_UNIX, errno, "strdup"); clixon_err(OE_UNIX, errno, "strdup");
goto done; goto done;
} }
cbuf_free(cbrcv);
} }
ok: ok:
retval = 0; retval = 0;
done: done:
if (cbsend)
cbuf_free(cbsend);
if (cbrcv)
cbuf_free(cbrcv);
clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval); clixon_debug(CLIXON_DBG_MSG | CLIXON_DBG_DETAIL, "retval:%d", retval);
if (reply) if (reply)
free(reply); free(reply);

View file

@ -232,7 +232,7 @@ if $SNMPCHECK; then
if [ $valgrindtest -ne 0 ]; then if [ $valgrindtest -ne 0 ]; then
# To avoid "Timeout: No Response from localhost" from netsnmp/snmpd set timeout to 10s # To avoid "Timeout: No Response from localhost" from netsnmp/snmpd set timeout to 10s
snmptable="$(type -p snmptable) -c public -v2c localhost -t 10 " 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 else
snmptable="$(type -p snmptable) -c public -v2c localhost " snmptable="$(type -p snmptable) -c public -v2c localhost "
snmpwalk="$(type -p snmpwalk) -c public -v2c localhost " snmpwalk="$(type -p snmpwalk) -c public -v2c localhost "

View file

@ -418,15 +418,6 @@ function testrun()
new "restconf GET http/2 switch protocol" 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" "<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>" "<Link rel='restconf' href='/restconf'/>" "</XRD>" expectpart "$(curl $CURLOPTS --http2 -X GET $proto://$addr/.well-known/host-meta)" 0 "HTTP/1.1 200 OK" "<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>" "<Link rel='restconf' href='/restconf'/>" "</XRD>"
# 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" "<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>" "<Link rel='restconf' href='/restconf'/>" "</XRD>"
fi
# Wrong protocol http when https or vice versa # Wrong protocol http when https or vice versa
if [ $proto = http ]; then # see (2) https to http port in restconf_main_native.c 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" new "Wrong proto=https on http port, expect err 35 wrong version number"