Use new helper script to parse header fields
This commit is contained in:
2
bashserv
2
bashserv
Submodule bashserv updated: 0c8aad0696...a542830791
@@ -7,29 +7,10 @@ if [ $? -eq 0 ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -f
|
user_agent=$($BASHSERV_DIR/get_request_field.sh "User-Agent")
|
||||||
set $REQUEST_FIELDS
|
if [[ $user_agent =~ Mobile ]]; then
|
||||||
set +f
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
length="$1"
|
|
||||||
key="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
|
|
||||||
value=""
|
|
||||||
for i in $(seq 1 $length); do
|
|
||||||
value+="$1 "
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
case $key in
|
|
||||||
User-Agent)
|
|
||||||
if [[ $value =~ Mobile ]]; then
|
|
||||||
mobile=1
|
mobile=1
|
||||||
fi
|
fi
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$REQUEST_PATH_SANE" -o "$REQUEST_PATH_SANE" == "index.html" ]; then
|
if [ -z "$REQUEST_PATH_SANE" -o "$REQUEST_PATH_SANE" == "index.html" ]; then
|
||||||
body="<html>\n<head>\n<title>$WAKEBOARD_TITLE</title>\n"
|
body="<html>\n<head>\n<title>$WAKEBOARD_TITLE</title>\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user