Http data server Fixed binary data retrieval

This commit is contained in:
Olof hagsand 2022-05-05 18:06:42 +02:00
parent 90474d1523
commit 7452813da7
7 changed files with 28 additions and 13 deletions

View file

@ -116,6 +116,9 @@ EOF
# remove read access
chmod 660 $dir/www/data/noread.html
# bitmap
cp ./clixon.png $dir/www/data/
# Http test routine with arguments:
# 1. proto:http/https
function testrun()
@ -221,6 +224,15 @@ EOF
new "WWW options"
expectpart "$(curl $CURLOPTS -X OPTIONS $proto://localhost/data/index.html)" 0 "HTTP/$HVER 200" "allow: OPTIONS,HEAD,GET"
# Remove -i option for binary transfer
CURLOPTS2=$(echo $CURLOPTS | sed 's/i//')
new "WWW binary bitmap"
curl $CURLOPTS2 -X GET $proto://localhost/data/clixon.png -o $dir/foo.png
cmp $dir/foo.png $dir/www/data/clixon.png
if [ $? -ne 0 ]; then
err1 "$dir/foo.png $dir/www/data/example.css should be equal" "Not equal"
fi
# negative errors
new "WWW get http not found"
expectpart "$(curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/notfound.html)" 0 "HTTP/$HVER 404" "Content-Type: text/html" "<title>404 Not Found</title>"
@ -254,7 +266,7 @@ EOF
expectpart "$(curl $CURLOPTS -X POST -H 'Accept: text/html' -H "Content-Type: application/yang-data+json" -d '{"ietf-interfaces:interfaces":{"interface":{"name":"eth/0/0","type":"clixon-example:eth","enabled":true}}}' $proto://localhost/data/notfound.html)" 0 "HTTP/$HVER 405" "Content-Type: text/html" "<title>405 Method Not Allowed</title>"
fi
if [ $RC -ne 0 ]; then
new "Kill restconf daemon"
stop_restconf