Stéphane Lavergne
763f7e50a4
Remove window in which threads still got SIGINT/SIGHUP
...
At least on OCaml 4.13.1's runtime, signals are spooled until any thread
unblocks them, so we block them just before cloning, letting the thread
inherit the mask, then we unblock.
2023-08-07 15:05:55 -04:00
Stéphane Lavergne
8f30c0dc9d
Don't let threads handle SIGINT/SIGHUP
...
It's common for applications to use these signals to trigger a graceful
shutdown.
2023-08-07 10:49:42 -04:00
Stéphane Lavergne
60dc366bd2
Stop listening after accept loop
2023-08-07 10:49:04 -04:00
Simon Cruanes
6560d4b865
fix: wait for threads to terminate when shutting down server
2023-08-07 10:16:09 -04:00
Simon Cruanes
b3b99af7ae
Merge pull request #68 from c-cube/wip-writer
...
introduce writer streams, use them in responses
2023-08-07 10:08:06 -04:00
Simon Cruanes
6070b36955
perf: use TCP_NODELAY for client sockets
...
(work with @vphantom)
2023-08-04 09:43:03 -04:00
Simon Cruanes
1060158192
do not flush after headers
2023-07-18 15:48:03 -04:00
Simon Cruanes
e3d8cf9fdd
server: use available buffer when writing body with chunk encoding
...
there's already a buffer nearby, we can use it to write streams/writer
bodies to the output channel
2023-07-18 15:40:56 -04:00
Simon Cruanes
098bf10466
add ?buf param to IO.Out_channel.chunk_encoding
...
If we can write individual chars to a channel, buffering becomes very
important (esp. considering that we might directly stream a HTML
document, tag by tag, into a channel). Thus it's a better default to
provide chunk encoding with a buffer.
2023-07-18 15:38:11 -04:00
Simon Cruanes
db40e291ab
buf: add add_char
2023-07-18 15:37:53 -04:00
Simon Cruanes
3280c9422f
fix: removed a \n by mistake
2023-07-18 14:36:11 -04:00
Simon Cruanes
3332fa906b
add Tiny_httpd_html.to_writer
2023-07-18 14:27:48 -04:00
Simon Cruanes
4a78eeb69c
html: ability to write a html document to an IO.Out_channel.t
2023-07-18 14:14:22 -04:00
Simon Cruanes
41be8908d3
feat: add IO.Out_channel.output_char function
2023-07-18 14:14:05 -04:00
Simon Cruanes
29de702c55
add IO.Out_channel.of_buffer
2023-07-18 13:57:12 -04:00
Simon Cruanes
355cc4d004
add example for Writer.t response body
2023-07-18 12:51:45 -04:00
Simon Cruanes
6137c20801
doc
2023-07-12 20:20:14 -04:00
Simon Cruanes
7b094b55ad
many fixes
2023-07-11 11:31:06 -04:00
Simon Cruanes
de23d9b2a3
wip: add IO.Writer.t, a push based stream
...
This is more convenient than our existing streams when it comes to
writing a body. The user can just get an output channel and write to it,
flush it, etc. as they please. This should also simplify compression…
once it works.
2023-07-11 10:57:08 -04:00
Simon Cruanes
832c4bd4df
more docs
2023-07-11 10:01:39 -04:00
Simon Cruanes
ec2f2f6f2e
add Server.run_exn
2023-07-11 10:01:33 -04:00
Simon Cruanes
ecc9f07748
doc
2023-07-11 09:52:55 -04:00
Simon Cruanes
c5060711ca
try to fix CI
2023-07-05 22:02:25 -04:00
Simon Cruanes
b927f98490
Merge pull request #64 from c-cube/wip-eio
...
support running on Eio
2023-07-05 21:53:07 -04:00
Simon Cruanes
bc4bce8083
doc
2023-06-26 16:05:48 -04:00
Simon Cruanes
9a587918fb
doc
2023-06-26 16:04:13 -04:00
Simon Cruanes
e1f0c58065
echo examples: add alice endpoint; use eio_posix
2023-06-23 17:58:11 -04:00
Simon Cruanes
6c8c24ea40
chore: opam dep
2023-06-23 17:58:11 -04:00
Simon Cruanes
38789de89c
require OCaml 4.05
2023-06-23 17:58:11 -04:00
Simon Cruanes
0adebc304b
fix issue for 4.04
2023-06-23 17:58:11 -04:00
Simon Cruanes
4138b1885a
detail in makefile
2023-06-23 17:58:11 -04:00
Simon Cruanes
b9faebffe4
use a resource pool to recycle buffers
2023-06-23 17:58:11 -04:00
Simon Cruanes
5ba1ff0de4
add Tiny_httpd_pool
2023-06-23 17:58:11 -04:00
Simon Cruanes
3f3d3e3464
add shims for Atomic on OCaml < 4.12
2023-06-23 17:58:11 -04:00
Simon Cruanes
911db76864
fix CI
2023-06-21 01:07:32 -04:00
Simon Cruanes
f845f1265b
compat: use Eio_unix.Stdenv.base
2023-06-21 00:23:35 -04:00
Simon Cruanes
6c499584b8
cleanup eio
2023-06-21 00:23:35 -04:00
Simon Cruanes
d2b89eee50
echo_eio: make quit into a button, to use POST
2023-06-21 00:23:34 -04:00
Simon Cruanes
55ef988aa4
details in example
2023-06-21 00:23:34 -04:00
Simon Cruanes
072a6041be
example eio: re-enable camlzip
2023-06-21 00:23:11 -04:00
Simon Cruanes
5e0a634c10
tiny_httpd_eio: do not use Eio's clock for our internals
2023-06-21 00:23:11 -04:00
Simon Cruanes
79cbcca4c1
cleanup: remove unused function in Tiny_httpd_server.IO_BACKEND
2023-06-21 00:23:11 -04:00
Simon Cruanes
d6402faf94
example: detail
2023-06-21 00:23:10 -04:00
Simon Cruanes
8620fe688d
eio: reimplement some buffering
2023-06-21 00:23:10 -04:00
Simon Cruanes
bfe5e9c358
copy example echo for eio backend
2023-06-21 00:23:09 -04:00
Simon Cruanes
e00c3a5d63
wip: tiny_httpd_eio, an alternative IO/concurrency backend based on Eio
2023-06-21 00:23:09 -04:00
Simon Cruanes
80ed51576b
Merge pull request #65 from c-cube/wip-cleanup-2023-06-20
...
cleanup and IO backend
2023-06-21 00:12:42 -04:00
Simon Cruanes
04f17262b6
example: add super stupid http auth endpoints to echo.ml
...
the endpoint /protected requires user:foobar login to see the content.
2023-06-20 23:04:44 -04:00
Simon Cruanes
56bb2db880
doc
2023-06-20 23:04:43 -04:00
Simon Cruanes
ed0f016f27
chore: makefile runs everything in release mode
2023-06-20 23:03:32 -04:00