function __curl() { read -r proto server path <<<"$(printf '%s' "${1//// }")" if [ "$proto" != "http:" ]; then printf >&2 "sorry, %s supports only http\n" "${FUNCNAME[0]}" return 1 fi DOC=/${path// //} HOST=${server//:*} PORT=${server//*:} [ "${HOST}" = "${PORT}" ] && PORT=80 exec 3<>"/dev/tcp/${HOST}/$PORT" printf 'GET %s HTTP/1.0\r\nHost: %s\r\n\r\n' "${DOC}" "${HOST}" >&3 (while read -r line; do [ "$line" = $'\r' ] && break done && cat) <&3 exec 3>&- }