#!/bin/sh # httpd-utils # Written in 2020 by Lucas # CC0 1.0 Universal/Public domain - No rights reserved # # To the extent possible under law, the author(s) have dedicated all # copyright and related and neighboring rights to this software to the # public domain worldwide. This software is distributed without any # warranty. You should have received a copy of the CC0 Public Domain # Dedication along with this software. If not, see # . usage() { printf "Usage: %s domain domain_v4 domain_v6\n" "${0##*/}" >&2 exit 1 } list_codes() { case $1 in 1xx) q='1[0-9][0-9]' ;; 2xx) q='2[0-9][0-9]' ;; 3xx) q='3[0-9][0-9]' ;; 4xx) q='4[0-9][0-9]' ;; 5xx) q='5[0-9][0-9]' ;; *) q=X ;; esac grep -x -- "$q" codes.txt } show_category() { _t=$1 _cc=$2 cat - <
$_t $_cc
EOF for _c in $(list_codes "$_cc"); do printf '\t\t\t
%u
\n' "$_c" "$_c" done printf "\t\t\n" } [ $# -eq 3 ] || usage domain=$1 domain_v4=$2 domain_v6=$3 cat - < $domain

$domain

Utilities

/ip
shows client IP.
$domain_v4/ip
shows client IP, only listens on a IPv4 address.
$domain_v6/ip
shows client IP, only listens on a IPv6 address.

HTTP status codes

EOF show_category "Informational" 1xx show_category "Successful" 2xx show_category "Redirection" 3xx show_category "Client Error" 4xx show_category "Server Error" 5xx cat - < EOF