Commit graph

79 commits

Author SHA1 Message Date
Solene Rapenne
458592594e Repair chroot, the only feature that isn't covered by tests 2021-02-23 23:24:12 +01:00
Solene Rapenne
31d384833f Rewording 2021-02-08 21:55:55 +01:00
Solene Rapenne
ff78ea5049 Documentation rewording 2021-02-05 21:28:41 +01:00
Solene Rapenne
349e56c28c Bump LICENSE to include 2021 2021-02-05 21:28:21 +01:00
Solene Rapenne
2191a8a18b Fix make clean, find conditions are tricky 2021-02-05 21:24:32 +01:00
prx
84120dca09 remove double ticks 2021-02-03 21:01:07 +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
189803ab52 useless space 2021-01-31 21:21:46 +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
495fa3213f small tip for cgi 2021-01-14 13:54:29 +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
Solene Rapenne
332a5cd1d6 Tell about autoindex in README 2021-01-10 13:11:46 +01:00
Solene Rapenne
c2debd2d6c Man page rewording 2021-01-10 13:10:32 +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
ec3d847e1c explain inetd should only answer on 127.0.0.1 instead of all interfaces. Suggestion from xhr 2021-01-03 21:42:18 +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
76c107a582 Reminder about opening TCP/1965 in the firewall 2021-01-02 12:31:18 +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
prx
d5cf84928e fix tests, initialize all, remove useless var 2020-12-13 11:11:38 +01:00
prx
f9dc956824 errcheck strlcat 2020-12-13 11:11:36 +01:00
prx
8aa3acd2d4 add errors checks on strlcpy, fgets, use faster memmove to don't need buffer 2020-12-13 11:11:25 +01:00
prx
e3448992bc use macro 2020-12-13 11:09:22 +01:00
prx
e3cb05af6d init all 2020-12-13 11:08:26 +01:00
prx
7381464bf7 initialize option 2020-12-13 11:08:23 +01:00
prx
44a767f577 initialize pos 2020-12-13 11:08:21 +01:00
prx
6d0d8d8130 add missing useradd, simplify cert usage with relayd 2020-12-09 21:31:39 +01:00
prx
395eeeccea path is supposed to be const. format unveil in a fuction 2020-12-09 21:31:35 +01:00
prx
4e82f1e44c remove unused extension and fix warnings 2020-12-09 21:29:15 +01:00
Florian Obser
fa328268e2 No need to copy path to a local buffer, use it directly.
Since path is a pointer to a constant string we can make it
point to a different constant string ("/").
2020-12-06 13:18:58 +01:00
Florian Obser
5a238e8666 Use BUFSIZ for the amount of data to copy through stdio.
According to the book of armaments(posix):
BUFSIZ
    Size of <stdio.h> buffers. This shall expand to a positive value.

There is also no need for the buflen variable since the size never
changes during runtime and the compiler can infer the size via
sizeof().
2020-12-06 13:18:58 +01:00
Solene Rapenne
8c5e344707 Enhance README with install instructions and tell about chroot for everyone 2020-12-05 20:12:13 +01:00
Florian Obser
bfd1f66350 Return a constant string from the mimes database.
We are not modifying it so there is no need to copy memory around.
This also prevents file_mime getting out of sync as had already
happend. It had a size of 50 while the mime types database type used
to have a size of 70.
2020-12-05 18:05:17 +01:00
Florian Obser
519de783b6 Declare and initialize the mime database in one statement.
This way the compiler can figure out the correct sizing of the strings
for us and we won't forget to increase the char arrays if a longer
mime type gets declared.
While here introduce nitems macro to simplify for loop.
2020-12-05 18:05:17 +01:00
Solene Rapenne
da225e1adc Add a check for OpenBSD unveil() 2020-12-05 17:51:15 +01:00
Solene Rapenne
16657e070c Fix file path after chroot() 2020-12-05 17:51:15 +01:00
Florian Obser
f28f906b6a stat(2) can fail, rearange error handling to handle this 2020-12-05 09:39:12 +01:00
Florian Obser
75cf996cec safely drop privs 2020-12-05 09:39:12 +01:00
Florian Obser
8d69d84784 errno is not set here 2020-12-05 09:39:12 +01:00
Florian Obser
27bc29da7a sys/ includes go at the front 2020-12-05 09:39:12 +01:00
Florian Obser
3d18122b7e main does not need a prototype 2020-12-05 09:39:12 +01:00
Florian Obser
5b3dc1dd02 Do not include c sources 2020-12-05 09:39:12 +01:00