fetch-uri - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
fetch-uri (587B)
---
1 #!/bin/sh
2
3 export PATH="$HOME/bin:$PATH"
4
5 usage() {
6 printf "usage: %s [-h] URI\n" "$(basename "$0")" >&2
7 exit 1
8 }
9
10 if [ $# -lt 1 ] || [ $# -gt 2 ]
11 then
12 usage
13 fi
14
15 if [ $# -eq 2 ]
16 then
17 [ $1 = -h ] || usage
18 opth=-I
19 shift
20 fi
21
22 uri="$1"
23 usetor=""
24 ua="$(http-user-agent)"
25 beg="${uri#*://}"
26 [ -z "${beg}" ] && exit 1
27 beg="${beg:?}"
28 case "$beg" in
29 */*) host="${beg%%/*}" ;;
30 *) host="$beg"
31 esac
32 grep -qx "$host" "/home/annna/bin/modules/tor/whitelist-from-tor" || usetor=1
33 curl -qgsm 5 --fail -L --max-redirs 3 -A "$ua" $opth ${usetor:+--preproxy socks5h://127.0.0.1:9050 }"$uri"
34