about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2020-05-31 10:28:59 -0500
committerCase Duckworth2020-05-31 10:28:59 -0500
commit88d7ae33a92feb6072f4e876f310f8e67a1fc810 (patch)
tree3d0cda8757e3d208a3271cf8b2d71d7c9b1a1fca
parentHandle different charsets (diff)
downloadbollux-88d7ae33a92feb6072f4e876f310f8e67a1fc810.tar.gz
bollux-88d7ae33a92feb6072f4e876f310f8e67a1fc810.zip
Trim mime and only look at it once
-rwxr-xr-xbollux9
1 files changed, 5 insertions, 4 deletions
diff --git a/bollux b/bollux index 63dfe85..4864e48 100755 --- a/bollux +++ b/bollux
@@ -353,12 +353,13 @@ handle_response() {
353display() { 353display() {
354 # split header line 354 # split header line
355 local -a hdr 355 local -a hdr
356 local i
356 IFS=$'\n' read -d "" -ra hdr <<<"${1//;/$'\n'}" 357 IFS=$'\n' read -d "" -ra hdr <<<"${1//;/$'\n'}"
357 358
358 mime="${hdr[0],,}" 359 mime="$(trim "${hdr[0],,}")"
359 for h in "${hdr[@]}"; do 360 for ((i=1;i<="${#hdr[@]}";i++)); do
360 h="$(trim "$h")" 361 h="$(trim "${hdr[$i]}")"
361 log d "$h" 362 log d "'$h'"
362 case "$h" in 363 case "$h" in
363 charset=*) charset="${h#charset=}" ;; 364 charset=*) charset="${h#charset=}" ;;
364 esac 365 esac