Commit graph

593 commits

Author SHA1 Message Date
Simon Cruanes
8cf59ffed1
Merge branch 'eio-fixes' into simon/use-eio-round2
* eio-fixes:
  eio: add 60s shutdown backstop, protect Flow.close from raising
  eio: fix semaphore acquisition, graceful stop, and time source
2026-02-15 16:28:54 -05:00
Simon Cruanes
c6468dced8 eio: add 60s shutdown backstop, protect Flow.close from raising 2026-02-15 21:26:25 +00:00
Simon Cruanes
3b631b7e4c eio: fix semaphore acquisition, graceful stop, and time source
- Acquire semaphore BEFORE spawning handler fiber: replace
  Eio.Net.accept_fork with manual accept + Semaphore.acquire + Fiber.fork
  so we bound the number of in-flight fibers rather than spawning
  unlimited fibers that all block on the semaphore.

- Graceful stop: remove Eio.Switch.fail sw Exit from stop(), just set
  running to false so existing handlers can complete naturally instead
  of being cancelled immediately.

- Replace Unix.gettimeofday with Eio.Time.now clock to use the Eio
  clock abstraction instead of direct Unix calls.
2026-02-15 21:22:39 +00:00
Simon Cruanes
2a3cfa015a
CI 2026-02-15 16:14:49 -05:00
Simon Cruanes
ffdcc1139c
format 2026-02-15 16:13:24 -05:00
Simon Cruanes
32421a26bc
go back to eio.unix 2026-02-15 16:08:59 -05:00
Simon Cruanes
97c4e4dc08 chore: upgrade qcheck to 0.91, fix deprecation warnings
- small_list -> list_small
- bytes_of_size -> bytes_size
- small_nat -> nat_small
- prefix unused Frame_type constants with underscore
2026-02-15 21:00:48 +00:00
Simon Cruanes
6c3e705df5 ci: only build/test eio on OCaml 5.x 2026-02-15 20:59:50 +00:00
Simon Cruanes
28f7ddd74f fix(eio): address review feedback
- Add closed flag to ic_of_flow/oc_of_flow to prevent double-release of
  pool cstructs and double-shutdown
- Enforce max_connections with Eio.Semaphore to limit concurrent connections
- Fix port 0 detection using Eio.Net.listening_addr to return actual port
- Use pool_size for cstruct pool max_size (was computed but unused)
- Set TCP_NODELAY on accepted connections for low latency
2026-02-15 20:59:50 +00:00
Simon Cruanes
f0aadc0307
disable warning 2026-02-15 15:54:03 -05:00
Simon Cruanes
5e32ce7bcc
fix dune 2026-02-15 15:46:31 -05:00
Simon Cruanes
98385b43a9
format 2026-02-15 15:39:56 -05:00
Simon Cruanes
93c08944bf
fix CI 2026-02-15 15:23:22 -05:00
Simon Cruanes
46d30392b9
delete gh-pages action 2026-02-15 15:23:18 -05:00
Simon Cruanes
94ed68c30c
fix warnings 2026-02-15 15:13:25 -05:00
Simon Cruanes
a11ed88522
chore: bounds on eio 2026-02-15 15:12:30 -05:00
Simon Cruanes
55dac0fa0b
CI 2026-02-15 15:12:30 -05:00
Simon Cruanes
0e35e38c09
example with eio 2026-02-15 15:12:30 -05:00
Simon Cruanes
3e7c73093e
feat: tiny_httpd_eio library
provides a tiny_httpd server that relies on Eio for non-blocking
sockets and for concurrency using eio fibers.
2026-02-15 15:12:30 -05:00
Simon Cruanes
ba19880d75
hardening bugfixes
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.13.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
* fix: use realpath to validate filesystem paths against traversal

- add string_prefix helper to check path containment
- compute root_canonical once per add_vfs_ call
- use realpath only for filesystem (on_fs=true), keeping simple
  contains_dot_dot check for VFS
- paths are already URL-decoded by Route.rest_of_path_urlencoded

* fix: add header size limits to prevent memory exhaustion

add optional limits to Headers.parse_:
- max_headers: 100 (default)
- max_header_size: 16KiB per header (default)
- max_total_size: 256KiB total (default)

returns 431 status code when limits exceeded per RFC 6585.
2026-02-10 19:57:21 -05:00
Simon Cruanes
8a8aadfbb0
doc
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
2025-06-24 21:13:18 -04:00
Simon Cruanes
9a1343aef7
remove global withlock builder, pass it as argument instead
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
2025-06-23 10:08:07 -04:00
Simon Cruanes
f10992ec32
feat WS: abstraction for critical section
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
can be replaced with a proper cooperative lock
2025-06-20 18:03:40 -04:00
Simon Cruanes
0f917ddf72
format
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
2025-06-06 22:25:48 -04:00
Simon Cruanes
03c3e09f12
feat route: add to_url, to produce a URL path from a route
provide arguments and get the corresponding path, which makes
it easy to build a full URL if needed.
2025-06-06 22:25:01 -04:00
Simon Cruanes
023805232f
fix warnings in C stubs 2025-06-06 22:24:52 -04:00
Simon Cruanes
022a495de3
fix warnings 2025-06-06 22:24:39 -04:00
Simon Cruanes
6203e7a4a7
prepare for 0.19
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
2025-04-18 09:37:27 -04:00
Simon Cruanes
d7a5cca1d4
feat(headers): set will not reallocate whole list if not needed 2025-04-18 09:37:27 -04:00
Simon Cruanes
cdac33689a
add basic test for response 2025-04-18 09:37:27 -04:00
Simon Cruanes
4c8cc8ba5a
test: update test 2025-04-18 09:37:27 -04:00
Simon Cruanes
173e5fef6e
feat(headers): use case insensitive comparison 2025-04-18 09:37:27 -04:00
Simon Cruanes
94c9239d64
fix(response): do not override "content-length" in raw response
close #92
2025-04-18 09:37:27 -04:00
Simon Cruanes
c55e3a2dfc
feat pool: expose acquire/release 2025-04-18 09:37:27 -04:00
Simon Cruanes
f6daff24c0
prepare for 0.18 2025-04-18 09:37:27 -04:00
Simon Cruanes
3c9e505a45
fix test 2025-04-18 09:37:27 -04:00
Simon Cruanes
44002fc355
detail 2025-03-25 15:01:17 -04:00
Simon Cruanes
f3461cfd21
detail in example 2025-03-21 08:37:16 -04:00
Simon Cruanes
075ad0825a
feat: add ?head_middlewares to create 2025-03-19 13:40:49 -04:00
Simon Cruanes
75d90559bd
fix warnings 2025-03-19 13:39:15 -04:00
Simon Cruanes
e177153f10
remove dead comment 2025-03-14 11:12:11 -04:00
Jonah Beckford
1e0bbc7f39 Processing to fix incompatible -O and gcc flags
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
Two changes:
1. Accept BUILD_TINY_HTTPD_OPTLEVEL envvar to adjust the -O<num> level. Defaults to 2. Can be negative to remove it entirely, which fixes errors with MSVC which will bail on incompatible options.
2. Do not use -fPIC with MSVC
2025-02-15 20:06:44 -05:00
Simon Cruanes
1f60d6165d
add content-type header for prometheus endpoint
Some checks failed
github pages / deploy (push) Has been cancelled
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
2025-02-10 20:38:04 -05:00
Simon Cruanes
55eb9c2a2f
fix CI
Some checks failed
build / build (4.08.x, ubuntu-latest) (push) Has been cancelled
build / build (4.14.x, ubuntu-latest) (push) Has been cancelled
build / build (5.03.x, ubuntu-latest) (push) Has been cancelled
github pages / deploy (push) Has been cancelled
2025-01-29 22:29:38 -05:00
Simon Cruanes
92999d56e8
typo 2025-01-29 22:25:22 -05:00
Simon Cruanes
09ff4f98ed
fix percent encoding for < 0x10 chars 2024-12-25 11:12:42 -05:00
Simon Cruanes
a86eac85bf
add a HEAD endpoint to echo 2024-12-25 10:59:32 -05:00
Simon Cruanes
1318d46efa
fix percent encoding on control chars 2024-12-06 14:42:17 -05:00
Simon Cruanes
1c61c39172
new flag ?enable_logging to disable regular logs (not debug) 2024-12-04 15:52:32 -05:00
Simon Cruanes
7639acfc19
perf: force a lazy in the branch where it is used 2024-12-04 15:10:57 -05:00