Commit Diff


commit - 226f13ece0b309abeee0ae8a4d8c9f049fe896a7
commit + 60b4efa1e2df8b5465deaec5c5493e1b2bf6a6c4
blob - 5854c91d48011423c4d4c1284735df1e4c79945f
blob + dd019e45242c8e64d99e3a6c65773a86fd3dbb54
--- regress/regress
+++ regress/regress
@@ -58,6 +58,7 @@ run_test test_proxy_relay_to
 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
 
 # TODO: add test that uses only a TLSv1.2 or TLSv1.3
 # TODO: add a test that attempt to serve a non-regular file
blob - 9aa083ad04b3434ad21525bcfa569eb9264a3cb7
blob + 9020103f39852831fb9418fd6405ec23906d6cd2
--- regress/tests.sh
+++ regress/tests.sh
@@ -376,4 +376,24 @@ test_include_mime() {
 
 	fetch_hdr /foo.1
 	check_reply '20 text/x-mandoc' || return 1
+}
+
+test_log_file() {
+	rm -f log log.edited
+	setup_simple_test 'log access "'$PWD'/log"' ''
+
+	fetch_hdr /
+	check_reply '20 text/gemini'
+
+	# remove the <ip>:<port> leading part
+	awk '{$1 = ""; print substr($0, 2)}' log > log.edited
+
+	echo GET gemini://localhost/ 20 text/gemini | cmp -s - log.edited
+	if [ $? -ne 0 ]; then
+		# keep the log for post-mortem analysis
+		return 1
+	fi
+
+	rm -f log log.edited
+	return 0
 }