Skip to content

Commit

Permalink
add regress that hit gmid via a raw IPv4 address
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-polo committed May 29, 2024
1 parent 1ef0cd0 commit b278202
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
11 changes: 8 additions & 3 deletions regress/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ gemexp="./../gemexp"
gg="./../gg"
gmid="./../gmid"
current_test=
server_name=
gghost=

run_test() {
ggflags=
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions regress/regress
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions regress/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit b278202

Please sign in to comment.