|
@@ -124,17 +124,21 @@ get_raw() { |
|
|
# get the location, it's a database lookup |
|
|
# get the location, it's a database lookup |
|
|
loc=$($WGET --max-redirect=0 --method=HEAD -S -o - -O - 'https://docs.freebsd.org/cgi/mid.cgi?'"$mid" 2>/dev/null | awk 'tolower($1) == "location:" { print $2; exit }') |
|
|
loc=$($WGET --max-redirect=0 --method=HEAD -S -o - -O - 'https://docs.freebsd.org/cgi/mid.cgi?'"$mid" 2>/dev/null | awk 'tolower($1) == "location:" { print $2; exit }') |
|
|
|
|
|
|
|
|
# Some emails are sent to both -current and -snapshot, |
|
|
|
|
|
# we can't handle them for now |
|
|
|
|
|
# such as 20160529215940.GA11785@FreeBSD.org |
|
|
|
|
|
if [ x"$loc" = x"" ]; then |
|
|
if [ x"$loc" = x"" ]; then |
|
|
return 1 |
|
|
|
|
|
|
|
|
# Some emails are sent to both -current and -snapshot, |
|
|
|
|
|
# such as 20160529215940.GA11785@FreeBSD.org |
|
|
|
|
|
# try w/ some magic sed |
|
|
|
|
|
loc=$($WGET -O - 'https://docs.freebsd.org/cgi/mid.cgi?'"$mid" 2>/dev/null | |
|
|
|
|
|
sed -Ee '/.*(getmsg.cgi?[^"]*).*/!d;s//\/cgi\/\1/' | head -1) |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# if it's relative, add https |
|
|
|
|
|
|
|
|
# if it's host relative, add https |
|
|
if [ x"$loc" != x"${loc#//}" ]; then |
|
|
if [ x"$loc" != x"${loc#//}" ]; then |
|
|
# add https |
|
|
# add https |
|
|
loc="https:$loc" |
|
|
loc="https:$loc" |
|
|
|
|
|
elif [ x"$loc" != x"${loc#/[^/]}" ]; then |
|
|
|
|
|
# add https+host |
|
|
|
|
|
loc="https://docs.freebsd.org$loc" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
# get the raw part |
|
|
# get the raw part |
|
|