aboutsummaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-05-29 07:54:03 +0000
committerOmar Polo <op@omarpolo.com>2024-05-29 07:54:03 +0000
commitb2782022c92840866f5c97f053b7f0ba881fd41c (patch)
tree51e3fb66955d4a29a0f65607571c80104ed83b0d /regress
parent1ef0cd0cdb6512fad96ecf0830e581af677d5947 (diff)
add regress that hit gmid via a raw IPv4 address
Diffstat (limited to 'regress')
-rw-r--r--regress/lib.sh11
-rwxr-xr-xregress/regress1
-rw-r--r--regress/tests.sh10
3 files changed, 19 insertions, 3 deletions
diff --git a/regress/lib.sh b/regress/lib.sh
index 47e0451..94c015d 100644
--- a/regress/lib.sh
+++ b/regress/lib.sh
@@ -6,6 +6,8 @@ gemexp="./../gemexp"
gg="./../gg"
gmid="./../gmid"
current_test=
+server_name=
+gghost=
run_test() {
ggflags=
@@ -18,6 +20,9 @@ run_test() {
ran_no=$((ran_no + 1))
current_test=$1
+ server_name=localhost
+ gghost=localhost
+
rm -f reg.conf
if ! $1; then
@@ -58,7 +63,7 @@ gen_config() {
cat <<EOF > reg.conf
$config_common
$1
-server "localhost" {
+server "$server_name" {
cert "$PWD/localhost.pem"
key "$PWD/localhost.key"
root "$PWD/testdata"
@@ -108,13 +113,13 @@ setup_simple_test() {
# usage: get <path>
# return the body of the request on stdout
get() {
- $gg -T10 $ggflags "gemini://localhost:10965/$1" || true
+ $gg -T10 $ggflags "gemini://$gghost:10965/$1" || true
}
# usage: head <path>
# return the meta response line on stdout
head() {
- $gg -T10 -d header $ggflags "gemini://localhost:10965/$1" || true
+ $gg -T10 -d header $ggflags "gemini://$gghost:10965/$1" || true
}
# usage: fetch <path>
diff --git a/regress/regress b/regress/regress
index 13f8acb..04f8393 100755
--- a/regress/regress
+++ b/regress/regress
@@ -62,6 +62,7 @@ run_test test_proxy_with_certs
# run_test test_unknown_host # XXX: breaks on some distro
run_test test_include_mime
run_test test_log_file
+run_test test_ip_addr
# TODO: add test that uses only a TLSv1.2 or TLSv1.3
# TODO: add a test that attempt to serve a non-regular file
diff --git a/regress/tests.sh b/regress/tests.sh
index 65c4903..b5f62e0 100644
--- a/regress/tests.sh
+++ b/regress/tests.sh
@@ -430,3 +430,13 @@ log style legacy'
rm -f log log.edited
return 0
}
+
+test_ip_addr() {
+ server_name="*"
+ gghost=127.0.0.1
+ ggflags=-N
+ setup_simple_test
+
+ fetch /
+ check_reply "20 text/gemini" "# hello world" || return 1
+}