diff --git a/core.sh b/core.sh index 90b1fac..3a0151b 100755 --- a/core.sh +++ b/core.sh @@ -68,7 +68,7 @@ function _inject_hmr() { if [[ -z "$USE_HMR" ]]; then return fi - cat << EOF + cat <<-EOF
@@ -83,7 +83,7 @@ function htmx_page() { STYLE_TEXT='' fi fi - [[ ${HTTP_HEADERS["hx-request"]} == "true" ]] || [[ "$INTERNAL_REQUEST" == "true" ]] || cat << EOF + [[ ${HTTP_HEADERS["hx-request"]} == "true" ]] || [[ "$INTERNAL_REQUEST" == "true" ]] || cat <<-EOF @@ -99,7 +99,7 @@ EOF cat # meow -[[ "$INTERNAL_REQUEST" == "true" ]] || [[ ${HTTP_HEADERS["hx-request"]} == "true" ]] || [[ ! -z "$HIDE_LOGO" ]] || cat << EOF +[[ "$INTERNAL_REQUEST" == "true" ]] || [[ ${HTTP_HEADERS["hx-request"]} == "true" ]] || [[ ! -z "$HIDE_LOGO" ]] || cat <<-EOF
@@ -211,9 +211,7 @@ parseHttpRequest() { if [[ ! -z "$REQUEST_QUERY" ]]; then while read -r -d '&' line; do QUERY_PARAMS["${line%%=*}"]=$(urldecode "${line#*=}") - done << EOF -${REQUEST_QUERY}& -EOF + done <<< "${REQUEST_QUERY}&" fi # Read headers @@ -222,7 +220,6 @@ EOF [[ -z "$line" ]] && break KEY="${line%%:*}" HTTP_HEADERS["${KEY,,}"]="${line#*: }" - # debug "$line" done # Parse multipart Form Data @@ -235,9 +232,7 @@ EOF if [[ ! -z "${HTTP_HEADERS["cookie"]}" ]]; then while read -r -d ';' line; do COOKIES["${line%%=*}"]=$(urldecode "${line#*=}") - done << EOF -${HTTP_HEADERS["cookie"]}; -EOF + done <<< "${HTTP_HEADERS[cookie]};" fi CLEN=${HTTP_HEADERS["content-length"]} @@ -295,14 +290,12 @@ EOF if [[ "$PARSED" == "--$BOUNDARY"* ]]; then while read -r -d ';' line; do DISPOSITIONS["${line%%=*}"]=$(urldecode "${line#*=}") - done << EOF -${MULTIPART_HEADERS["content-disposition"]}; -EOF + done <<< "${MULTIPART_HEADERS["content-disposition"]};" NAME=$(trim_quotes "${DISPOSITIONS[name]}") FILENAME=$(trim_quotes "${DISPOSITIONS[filename]}") FILE_UPLOADS["$NAME"]="$UPLOAD_TO" FILE_UPLOAD_NAMES["$NAME"]="$FILENAME" - FILE_UPLOAD_TYPES["$NAME"]="${MULTIPART_HEADERS[Content-Type]}" + FILE_UPLOAD_TYPES["$NAME"]="${MULTIPART_HEADERS[content-type]}" MULTIPART_HEADERS=() DISPOSITIONS=() state="headers" @@ -330,9 +323,7 @@ EOF [[ ${HTTP_HEADERS["content-type"]} == "application/x-www-form-urlencoded" ]]; then while read -r -d '&' line; do FORM_DATA["${line%%=*}"]=$(urldecode "${line#*=}") - done << EOF -${REQUEST_BODY}& -EOF + done <<< "${REQUEST_BODY}&" fi }