Skip to content

Commit

Permalink
fix for using in mode: set -u
Browse files Browse the repository at this point in the history
  • Loading branch information
Colas Nahaboo committed Dec 13, 2017
1 parent 6ffee34 commit 458db44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cgibashopts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ urldecode() {
echo "$r"
}

if [ "$REQUEST_METHOD" = POST ]; then
if [[ $CONTENT_TYPE =~ ^multipart/form-data\;[[:space:]]*boundary=([^\;]+) ]]; then
if [ "${REQUEST_METHOD:-}" = POST ]; then
if [[ ${CONTENT_TYPE:-} =~ ^multipart/form-data\;[[:space:]]*boundary=([^\;]+) ]]; then
sep="--${BASH_REMATCH[1]}"
OIFS="$IFS"; IFS=$'\r'
while read -r line; do
Expand Down Expand Up @@ -100,16 +100,16 @@ if [ "$REQUEST_METHOD" = POST ]; then
declare -x FORM_$var="$val"
fi
done
s="$QUERY_STRING"
s="${QUERY_STRING:-}"
IFS="$OIFS"
unset OIFS
else
stdin=$(cat) # indirection to avoid issues with terminating newlines
s="${stdin}&${QUERY_STRING}"
s="${stdin}&${QUERY_STRING:-}"
unset stdin
fi
else
s="$QUERY_STRING"
s="${QUERY_STRING:-}"
fi

# regular (no file uploads) arguments processing
Expand Down

0 comments on commit 458db44

Please sign in to comment.