Commit Graph

9 Commits

Author SHA1 Message Date
prx 4972df5999 Fix virtualhost support changing the way request is parsed 2021-03-22 21:44:23 +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 4e82f1e44c remove unused extension and fix warnings 2020-12-09 21:29:15 +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
Florian Obser 5b3dc1dd02 Do not include c sources 2020-12-05 09:39:12 +01:00
Solene Rapenne 345215fa9b Code refactoring: get_file_mime got into mime.c and all security code moved into a procedure 2020-12-04 19:08:36 +01:00
Solene Rapenne cbcf526d76 Make the MIME database as a global variable, it's a lot more cleaner. (thanks to oa for recommendation) 2020-12-03 21:06:17 +01:00
Solene Rapenne 1e0bb0368c Add MIME support + according tests 2020-12-02 19:59:52 +01:00