Commit Graph

32 Commits

Author SHA1 Message Date
prx
f973351945 reformat as much as possible.
Now main() is much simpler.
Removed all goto.
Less variables in main.
Simplified status_ to status().
Use a stop() function to log, send messages to stderr if necessary and close vger.
Minor fixes with defaults, mimes
There is still work to do to compare path using stat().
2022-08-08 22:57:03 +02:00
aa1affb6c2
fix cgi support for PATH_INFO
looks for files immediately after the cgidir, and anything after that file
if there are '/'s becomes PATH_INFO.

also adds a function strip_trailing_slash which may be useful in other parts too.
2022-03-26 20:31:50 +00:00
Solene Rapenne
0d3d453498 test.sh should be executable out of the box 2021-12-13 21:34:49 +01:00
prx
4972df5999 Fix virtualhost support changing the way request is parsed 2021-03-22 21:44:23 +01:00
prx
02d2d1dc7d percent-decoding 2021-03-09 20:45:12 +01:00
prx
de52acecfc Merge branch 'master' of tildegit.org:solene/vger 2021-03-09 20:37:46 +01:00
Omar Polo
ee8569c6e6 simplify cgi function
Don't fork+execlp the script.  There's no need to do so since on exec
the new process will inherit our file descriptor table (and hence our
stdout), so copying from its stdout to ours is just a waste of time.
This allows to drop the ``proc'' pledge(2) promise and to (slightly)
improve performance.
2021-03-09 19:14:42 +01:00
Omar Polo
8454548b51 add test for redirect with trailing slash with vhosts on 2021-03-09 19:14:42 +01:00
prx
e9be1b73a7 percent-decode uri 2021-03-02 10:06:09 +01:00
prx
43170e6804 restore all tests after mistake 2021-02-03 21:00:38 +01:00
prx
f0dbd2c9ed ready for Linux && disable solene's specific tests 2021-02-03 20:46:36 +01:00
prx
55042768e5 restore parent link in autoindex and add comments 2021-01-31 22:05:48 +01:00
prx
de7cd12f9f ignore after ? and make cgi+virtualhost work (sort of) 2021-01-31 21:21:15 +01:00
prx
3510035711 fix unacceptable ../ in autoidx and code formatting 2021-01-31 13:59:24 +01:00
prx
2cc63136f8 alphasort autoindex + add proper error code fir cgi 2021-01-14 14:30:11 +01:00
prx
f6bc000adc fix status code in cgi script 2021-01-14 13:49:46 +01:00
prx
470e47a018 Add simple cgi support +:
* read file byte after byte
* format code (syslog + err)
* move functions in utils.c
2021-01-14 13:31:51 +01:00
prx
f60ea88c8d add mimetype and autoindex option + minor changes
* follow style(9) for prototypes
* move first most used extension for more effeciciency when looking for mime
* add opts.h to deal with options
* remove lang=en by default
* add option to set default mimetype
* add option to autoindex if no index.gmi found
* redirect if ending "/" is missing
* send appropriate status code if request too long
* edit manpage and README for new options
2021-01-10 09:30:35 +01:00
prx
4a1b0c8ce2 fix issue if missing ending '/' and add appropriate test 2021-01-06 21:37:38 +01:00
Solene Rapenne
b2ccab7448 Error code = 51 (not found) and redirection is now 30 following specifications Appendix https://gemini.circumlunar.space/docs/specification.html 2021-01-03 17:50:45 +01:00
Solene Rapenne
d8a49b1827 add missing symlink for previously added test 2021-01-02 16:30:12 +01:00
Solene Rapenne
f0f05b83aa Add support to redirection 2021-01-01 21:00:40 +01:00
Solene Rapenne
ef93e01091 Remove the port part of the hostname + according test suite
patch from prx
2021-01-01 16:09:43 +01:00
Solene Rapenne
1753181bff add IRI tests using utf8 or emojis 2020-12-28 09:26:36 +01:00
Solene Rapenne
da225e1adc Add a check for OpenBSD unveil() 2020-12-05 17:51:15 +01:00
Solene Rapenne
b3bb3b2f91 Add chroot() feature 2020-12-03 22:59:39 +01:00
Solene Rapenne
7b0ae577c6 Adding missing test files 2020-12-03 22:06:48 +01:00
Solene Rapenne
1e0bb0368c Add MIME support + according tests 2020-12-02 19:59:52 +01:00
Solene Rapenne
dd201d73d9 Add a flag to change the default language in the return status code 2020-12-02 18:07:10 +01:00
Solene Rapenne
615079e26c Add virtualhost features with a flag + according tests 2020-12-02 15:31:21 +01:00
Solene Rapenne
0c2b3737ea don't try /var/gemini tests if directory doesn't exists 2020-12-01 23:55:54 +01:00
Solene Rapenne
c2d813c0f1 Init vger 2020-12-01 23:39:05 +01:00