Error code = 51 (not found) and redirection is now 30 following specifications Appendix https://gemini.circumlunar.space/docs/specification.html

This commit is contained in:
Solene Rapenne 2021-01-03 17:50:45 +01:00
parent d8a49b1827
commit b2ccab7448
2 changed files with 4 additions and 4 deletions

4
main.c
View File

@ -178,7 +178,7 @@ display_file(const char *path, const char *lang)
return;
err:
/* return an error code and no content */
status(40, "text/gemini", lang);
status(51, "text/gemini", lang);
syslog(LOG_DAEMON, "path invalid %s", path);
goto closefd;
@ -192,7 +192,7 @@ redirect:
goto err;
}
status_redirect(39, target);
status_redirect(30, target);
syslog(LOG_DAEMON, "redirection from %s to %s", path, target);
closefd:

View File

@ -36,7 +36,7 @@ if ! [ $OUT = "649a2e224632b679fd7599eafb13c001" ] ; then echo "error" ; exit 1
# redirect file
OUT=$(printf "gemini://perso.pw/old_location\r\n" | ../vger -d var/gemini/ | tee /dev/stderr | $MD5)
if ! [ $OUT = "28262311ea814e6a481fa365894cfc3f" ] ; then echo "error" ; exit 1 ; fi
if ! [ $OUT = "cb4597b6fcc82cbc366ac9002fb60dac" ] ; then echo "error" ; exit 1 ; fi
# file from local directory using virtualhosts
OUT=$(printf "gemini://perso.pw/index.gmi\r\n" | ../vger -v -d var/gemini/ | tee /dev/stderr | $MD5)
@ -89,7 +89,7 @@ then
# file from /var/gemini/blog
OUT=$(printf "gemini://host.name/blog\r\n" | ../vger | tee /dev/stderr | $MD5)
if ! [ $OUT = "f78c481e1614f1713e077b89aba5ab94" ] ; then echo "error" ; exit 1 ; fi
if ! [ $OUT = "ae3ce9fb5191a08a2c1f3e36b2985a01" ] ; then echo "error" ; exit 1 ; fi
fi