Update 2024-10-20 07:57 OpenBSD/amd64-t14
This commit is contained in:
Executable
+26
@@ -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"
|
||||
Reference in New Issue
Block a user