Update 2024-10-20 07:57 OpenBSD/amd64-t14

This commit is contained in:
c0dev0id
2024-10-20 07:57:26 +02:00
parent 2dfb4eadd2
commit 634ce7bc79
5 changed files with 35 additions and 7 deletions
Executable
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
if [ -z "$1" ]
then
>&2 echo "webmime: no argument given"
exit 2
fi
URL="$(echo "$1" | grep -i ^http)"
if [ -z "$URL" ]
then
>&2 echo "webmime: argument is not a http url ($1)"
exit 1
fi
>&2 echo "webmime: reading content-type from: $1"
R="$(curl --connect-timeout 5 -sI "$URL" | grep -i "^content-type:" | tr -d ' ' | awk -F'[:;]' '{ print $2 }')"
if [ -z "$R" ]
then
>&2 echo "webmime: no content-type header found ($1)"
exit 1
fi
echo "$R"