1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-06-08 17:30:43 +00:00
Commit Graph

26 Commits

Author SHA1 Message Date
René Wagner
32913c35cd implement handling of ROUTE_EXACT definitions
This patchset implements the handling of exact routes
as described in gmnisrvini(5).
2021-01-29 08:55:43 -05:00
Zach DeCook
ea360fa4c1 Routing: Fix non-ascii paths 2021-01-22 08:15:03 -05:00
Zach DeCook
fbef1d34a1 autoindex: fix off-by-one buffer size 2020-12-27 08:13:09 -05:00
Zach DeCook
eac874b925 autoindex: end directories with trailing slash 2020-12-24 09:05:28 -05:00
William Casarin
10662cac46 serve: handle return value from chdir
Fixes a compile error on gcc 9.3.0:

src/serve.c: In function 'serve_cgi':
src/serve.c:150:3: error: ignoring return value of 'chdir', declared
with attribute warn_unused_result [-Werror=unused-result]
  150 |   chdir(dirname(cwd));
      |   ^~~~~~~~~~~~~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
2020-11-20 11:17:43 -05:00
Eyal Sawady
cb042d6263 CGI: Don't hang on directory with no index 2020-11-15 11:33:16 -05:00
Eyal Sawady
0646fd020c CGI: Fix paths which end in '/' 2020-11-15 10:55:48 -05:00
Drew DeVault
ea2914efff Set CWD to cgi-bin when executing scripts 2020-11-08 12:16:59 -05:00
Drew DeVault
57f4fcdc41 Fix double free 2020-11-08 12:12:43 -05:00
René Wagner
02a386b568 check if file served as cgi is executable
if not, send a response 50 to the client
fixes ~sircmpwn/gmni#47
2020-11-08 10:59:35 -05:00
dbandstra
c145ac6a65 fix typo in GATEWAY_INTERFACE value 2020-11-08 09:38:52 -05:00
Tom Lebreux
4f12abfbc2 Fix memory leaks 2020-11-08 09:37:55 -05:00
Drew DeVault
dc6e4e80c0 Implement URL rewrites with regex capture groups 2020-11-01 11:19:51 -05:00
Drew DeVault
16e55c6262 Change meaning of root (backwards incompatible!)
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.
2020-11-01 10:32:44 -05:00
Drew DeVault
f15bea6583 Implement regex route matching 2020-11-01 09:43:46 -05:00
Drew DeVault
becc4460b6 Implement MIME database support 2020-10-28 12:38:32 -04:00
Drew DeVault
da6f7e9f05 CGI: Fix SCRIPT_NAME variable 2020-10-26 18:16:05 -04:00
Drew DeVault
5d725ff4ee CGI: set PATH_INFO 2020-10-25 23:55:42 -04:00
Drew DeVault
cc1bd152e3 Initial support for CGI scripts 2020-10-25 23:16:50 -04:00
Drew DeVault
8baeb5a51c Initial implementation of a routing table 2020-10-25 21:46:01 -04:00
Drew DeVault
1fe107875b Overhaul network I/O to be async for real
Had to totally cut off OpenSSL from the network fd because obviously
OpenSSL is just going to wreck our shit
2020-10-25 14:50:07 -04:00
io mintz
a22bec5149 add a missing "/" to autoindex paths
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.
2020-10-15 15:44:45 -04:00
William Casarin
e77f354ca3 serve: fix gcc-9.3.0 error in serve_autoindex
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>
2020-10-15 12:06:19 -04:00
Chris Vittal
9d17ce46b0 return false on request_validate errors
This will report proper errors to clients rather than continuing on with
request processing.
2020-10-12 21:25:45 -04:00
Drew DeVault
6bc9c4deb9 Implement autoindex option 2020-09-26 15:51:28 -04:00
Drew DeVault
165e3c02fc Rehome some logic from server.c -> serve.c 2020-09-26 15:08:25 -04:00