set all variables to local

This commit is contained in:
overflowerror 2022-03-30 21:33:14 +02:00
parent 10b8f41076
commit 2b86c44b22
7 changed files with 24 additions and 19 deletions

View file

@ -1,13 +1,13 @@
#!/bin/bash
getCookie() {
key="$1"
local key="$1"
echo "$HTTP_COOKIE" | tr ';' $'\n' | grep -e "^$1=" | cut -d= -f2 | sed -r 's/\s*$//g'
}
setCookie() {
key="$1"
value="$2"
attributes="$3"
local key="$1"
local value="$2"
local attributes="$3"
header "Set-Cookie" "$key=$value; $attributes"
}

View file

@ -26,16 +26,15 @@ query() {
escape() {
echo "$1" |
sed "s/\\/\\\\/g" |
sed 's/\\/\\\\/g' |
sed "s/'/\\'/g" |
sed "s/\"/\\\"/g" |
sed "s/\n/\\n/g" |
sed "s/\r/\\r/g" |
sed "s/\t/\\t/g" |
sed "s/\Z/\\Z/g" |
sed "s/\b/\\b/g" |
sed "s/%/\\%/g" |
sed "s/_/\\_/g"
sed 's/\"/\\\"/g' |
sed 's/\n/\\n/g' |
sed 's/\r/\\r/g' |
sed 's/\t/\\t/g' |
sed 's/\Z/\\Z/g' |
sed 's/%/\\%/g' |
sed 's/_/\\_/g'
}
getColumns() {

View file

@ -20,8 +20,8 @@ _default404() {
}
_matchPaths() {
actual="$1"
search="$2"
local actual="$1"
local search="$2"
# TODO: add wildcards
test "$actual" = "$search"

View file

@ -32,8 +32,8 @@ _getSession() {
}
_newSessionId() {
base="$(date -Ins -u)"
random="$RANDOM"
local base="$(date -Ins -u)"
local random="$RANDOM"
while _getSession "$(echo "$base$random" | md5sum | cut -d' ' -f1)" > /dev/null; do
random="$RANDOM"
done

@ -1 +1 @@
Subproject commit 6b398f25719243c102f7a91972966538ed23dd01
Subproject commit 0964fdc24ff68d84f419354f227b12cb9ff27df3

6
uri.sh
View file

@ -17,6 +17,12 @@ queryString() {
_formData=""
cacheFormData() {
if test -z "$_formData"; then
_formData="$(cat)"
fi
}
formData() {
if test -z "$_formData"; then
_formData="$(cat)"

View file

@ -4,7 +4,7 @@ _hasStatus=0
status() {
_hasStatus=1
status="$1"
local status="$1"
echo -n "Status: $status "
case "$status" in
100) echo "Continue" ;;