repo: uritools
action: commit
revision: 
path_from: 
revision_from: a75363e4d77a9f35a9e8fb1515945629aba97d9a:
path_to: 
revision_to: 
git.thebackupbox.net
uritools
git clone git://git.thebackupbox.net/uritools
commit a75363e4d77a9f35a9e8fb1515945629aba97d9a
Author: epoch 
Date:   Mon Nov 16 00:51:36 2020 +0000

    http redirects were being output twice in urititle

diff --git a/urititle b/urititle
index 85f32597d4d1385b741314d32c23ef3a668cf902..
index ..662201c5950fbf62baa98de2e89d989fd7c7ed5a 100755
--- a/urititle
+++ b/urititle
@@ -25,9 +25,9 @@ http*)
     if printf "%s\n" "${a_header}" | grep -i '^Content-Type: ' 2>&1 >/dev/null 2>&1;then
       content_type="$(printf '%s\n' "${a_header}" | cut '-d ' -f2- | cut '-d;' -f1)"
     fi
-    if printf "%s\n" "${a_header}" | grep -i '^Location: ' 2>&1 >/dev/null 2>&1;then
-      content_type="redirect. ${a_header}"
-    fi
+    #if printf "%s\n" "${a_header}" | grep -i '^Location: ' 2>&1 >/dev/null 2>&1;then
+    #  content_type="redirect. ${a_header}"
+    #fi
     if printf "%s\n" "${a_hreader}" | grep -i '^curl failed' 2>&1 >/dev/null 2>&1;then
       content_type="curl failed. cert expired? dunno yet. TODO: code openssl checker."
     fi
@@ -70,6 +70,8 @@ gopher)
     printf "title: %s\n" "$(curl -s "$1" | grep ^i | head -n1 | cut -f1 | cut -b2-)"
   elif [ "$type" = 0 ];then
     printf "title: %s\n" "$(curl -s "$1" | head -n1)"
+  elif [ "$type" = "h" ];then
+    printf "title: %s\n" "$(curl -s "$1" | head -c 1000000 | tr -d '\n' | tr '<' '\n' | grep -iA 10 '^title' | grep -iB 10 '^\/title>' | cut '-d>' -f2 | tr '\t' ' ' | sed 's/^ *//g' | sed 's/ *$//g' | grep .)"
   else
     printf "title: don't know how to get title of non-1 gopher links"
   fi

-----END OF PAGE-----