Skip to content

Commit

Permalink
v4.1.2: bug fix: only semico0lons were understood as separators in th…
Browse files Browse the repository at this point in the history
…e `Content-Type` and `Content-Disposition` HTTP headers. Fixed to also use commas. Bug reported by "florin-ctu", issues #8 and #9.
  • Loading branch information
ColasNahaboo committed Jan 8, 2023
1 parent 350ce5e commit 8809750
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Feel welcome to copy and enhance this project, as well as providing bug reports,
- Or just email me: [email protected]

## History of changes
- 2023-01-08 v4.1.2: bug fix: only semico0lons were understood as separators in the `Content-Type` and `Content-Disposition` HTTP headers. Fixed to also use commas. Bug reported by "florin-ctu", issues #8 and #9.
- 2022-11-24 v4.1.1: bug fix: form fields after a file upload field were ignored. Please upgrade!
Bug report by "pipoprods", issue #7.
- 2021-12-23 v4.1.0:
Expand Down
6 changes: 3 additions & 3 deletions cgibashopts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See https://github.com/ColasNahaboo/cgibashopts
# Uses the CGI env variables REQUEST_METHOD CONTENT_TYPE QUERY_STRING

export CGIBASHOPTS_RELEASE=4.1.1
export CGIBASHOPTS_RELEASE=4.1.2
export CGIBASHOPTS_VERSION="${CGIBASHOPTS_RELEASE%%.*}"
cr=$'\r'
nl=$'\n'
Expand Down Expand Up @@ -83,11 +83,11 @@ urlencode() {
}

if [ "${REQUEST_METHOD:-}" = POST ]; then
if [[ ${CONTENT_TYPE:-} =~ ^multipart/form-data\;[[:space:]]*boundary=([^\;]+) ]]; then
if [[ ${CONTENT_TYPE:-} =~ ^multipart/form-data[\;,][[:space:]]*boundary=([^\;,]+) ]]; then
sep="--${BASH_REMATCH[1]}"
OIFS="$IFS"; IFS=$'\r'
while read -r line; do
if [[ $line =~ ^Content-Disposition:\ *form-data\;\ *name=\"([^\"]+)\"(\;\ *filename=\"([^\"]+)\")? ]]; then
if [[ $line =~ ^Content-Disposition:\ *form-data[\;,]\ *name=\"([^\"]+)\"(\;\ *filename=\"([^\"]+)\")? ]]; then
var="${BASH_REMATCH[1]}"
val="${BASH_REMATCH[3]}"
[[ $val =~ [%+] ]] && val=$(urldecode "$val")
Expand Down

0 comments on commit 8809750

Please sign in to comment.