summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tls: fix crash when opening priv key for writingWilliam Casarin2020-11-081-1/+1
| | | | | | | | | | | | | | | | | | | The open syscall will return a negative value if the call fails. Switch the check to look for this instead of 0. before: [gmnisrv] generating certificate for localhost gmnisrv: src/tls.c:68: tls_host_gencert: Assertion `pf' failed. abort (core dumped) ./gmnisrv -C config.ini after: [gmnisrv] generating certificate for localhost [gmnisrv] opening private key for writing failed: No such file or directory [gmnisrv] TLS initialization failed Signed-off-by: William Casarin <jb55@jb55.com>
* Don't memmove one past clientsTom Lebreux2020-11-081-1/+3
|
* Fix not moving all fdsTom Lebreux2020-11-081-1/+1
|
* Fix memory leaksTom Lebreux2020-11-082-0/+5
|
* config/routing: fix maybe-uninitialized errorsWilliam Casarin2020-11-021-0/+2
| | | | | | | | | | | | | | | | | Trivial fix to silence compilation errors on gcc 9.3.0: src/config.c: In function ‘conf_ini_handler’: src/config.c:154:23: error: ‘routing’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 154 | enum gmnisrv_routing routing; | ^~~~~~~ src/config.c:197:18: error: ‘spec’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 197 | route->path = strdup(spec); | ^~~~~~~~~~~~ Signed-off-by: William Casarin <jb55@jb55.com>
* Add mailcap to dependenciesDrew DeVault2020-11-011-0/+1
|
* Implement URL rewrites with regex capture groupsDrew DeVault2020-11-016-28/+151
|
* gmnisrv.ini(5): clarify tokens in route configDrew DeVault2020-11-011-4/+4
|
* Change meaning of root (backwards incompatible!)Drew DeVault2020-11-012-12/+16
| | | | | | | | | This takes the nginx approach to the "root" directive, which is simpler to implement and more consistent with more complex routing behaviors like regexp. The path component of the URL is now simply appended to the root to form the path to the file which should be served to the client.
* It's actually ECMAScript 2018 compatibleDrew DeVault2020-11-011-2/+2
|
* regexp.c: ditch unused test codeDrew DeVault2020-11-011-170/+0
|
* Clarify regex details in gmnisrv.ini(5)Drew DeVault2020-11-011-0/+5
|
* Implement regex route matchingDrew DeVault2020-11-011-2/+16
|
* Drop most of the unicode tablesDrew DeVault2020-10-291-4210/+0
|
* Initial pass on regex routing supportDrew DeVault2020-10-297-5/+7561
| | | | | | | | | All this does is parse the regexes out of the config file. I've vendored libregexp from Bellard's quickjs project, because it's reasonably small and self-contained, and POSIX regexes don't support captures. We're eventually going to want captures for URL rewrites, so this'll do for now.
* Fail gracefully if mime database is not presentDrew DeVault2020-10-281-1/+7
|
* config: free more routing information on finishDrew DeVault2020-10-281-0/+11
|
* Implement MIME database supportDrew DeVault2020-10-285-13/+110
|
* server: handle write errorsDrew DeVault2020-10-281-1/+5
|
* CGI: Fix SCRIPT_NAME variableDrew DeVault2020-10-261-3/+6
|
* CGI: set PATH_INFODrew DeVault2020-10-251-16/+48
|
* Initial support for CGI scriptsDrew DeVault2020-10-254-0/+146
|
* Initial implementation of a routing tableDrew DeVault2020-10-254-25/+183
|
* Overhaul network I/O to be async for realDrew DeVault2020-10-255-108/+249
| | | | | Had to totally cut off OpenSSL from the network fd because obviously OpenSSL is just going to wreck our shit
* add a missing "/" to autoindex pathsio mintz2020-10-151-2/+1
| | | | | | | | | | | | | | | | | | | | With the following directory structure: /srv/gmni: baz/ foo/ /srv/gmni/baz: a /srv/gmni/foo: bar/ /srv/gmni/foo/bar: b trying to access gemini://somesite/ with autoindex=on works, but accessing /foo fails because it tries to stat /srv/gmni/foobar instead of /srv/gmni/foo/bar. This commit fixes that by adding a trailing slash.
* serve: fix gcc-9.3.0 error in serve_autoindexWilliam Casarin2020-10-151-1/+1
| | | | | | | | | | | | | gcc 9.3.0 catches an off-by-one error with strncat in serve_autoindex where it might not write a 0 byte: In function ‘strncat’, inlined from ‘serve_autoindex’ at src/serve.c:60:3: /nix/store/...glibc-2.31-dev/include/bits/string_fortified.h:136:10: error: ‘__builtin___strncat_chk’ specified bound 4097 equals destination size [-Werror=stringop-overflow=] Signed-off-by: William Casarin <jb55@jb55.com>
* return false on request_validate errorsChris Vittal2020-10-121-1/+4
| | | | | This will report proper errors to clients rather than continuing on with request processing.
* Change assert to 2-param version to comply with C11.Kevin Sangeelee2020-09-291-1/+1
|
* Bubble up client disconnect stateDrew DeVault2020-09-271-23/+36
| | | | This will fix the segfaults but won't fix slowlorris
* Break after processing polled clientDrew DeVault2020-09-271-0/+3
| | | | Otherwise we might not grok it, ya jive
* Only handle one client per poll iterationDrew DeVault2020-09-271-8/+4
| | | | | This is a bit of a hack but it avoids some problems with invalid reads when a client gets disconnected
* mime: add .xml -> text/xmlDrew DeVault2020-09-271-0/+3
|
* server.c: re-locate definitions to appropriate scopeDrew DeVault2020-09-261-7/+7
|
* README.md: update example configDrew DeVault2020-09-261-2/+5
|
* Set SO_REUSEADDRDrew DeVault2020-09-261-1/+2
|
* server.c: appease GCC's magic pixie bullshitDrew DeVault2020-09-261-2/+2
|
* server.c: import netinet/in.hDrew DeVault2020-09-261-0/+1
|
* config.ini: change suggested root directoryDrew DeVault2020-09-261-1/+1
|
* Fix size of in{,6}_addrDrew DeVault2020-09-261-2/+2
|
* Document (and tweak) log formatDrew DeVault2020-09-262-3/+16
|
* README.md: formattingDrew DeVault2020-09-261-2/+3
|
* Add dependency listDrew DeVault2020-09-261-0/+6
|
* DocumentationDrew DeVault2020-09-266-8/+150
|
* Remove [:tls] email directiveDrew DeVault2020-09-263-4/+0
|
* Free up resources throughoutDrew DeVault2020-09-265-14/+38
|
* disconnect_client: free more client resourcesDrew DeVault2020-09-261-0/+7
|
* Implement autoindex optionDrew DeVault2020-09-265-27/+176
|
* Rehome some logic from server.c -> serve.cDrew DeVault2020-09-264-119/+141
|
* Okay, time to quit fucking around with BUFSIZDrew DeVault2020-09-261-1/+2
|
* Turns out BUFSIZ is small sometimesDrew DeVault2020-09-261-2/+1
|