Stéphane Lavergne
d8234b0189
Don't let threads handle SIGINT/SIGHUP
...
It's common for applications to use these signals to trigger a graceful
shutdown.
2023-08-08 14:30:39 -04:00
Stéphane Lavergne
a7516689b1
Stop listening after accept loop
2023-08-08 14:30:39 -04:00
Simon Cruanes
1ca1f3dff9
fix: wait for threads to terminate when shutting down server
2023-08-08 14:30:39 -04:00
Simon Cruanes
25eb8b765a
rename IO.{In,Out}_channel to avoid confusion
...
these are not the standard in/out_channels so we should just use
different names.
2023-08-08 12:57:12 -04:00
Simon Cruanes
a3f5dde2f1
format
2023-08-08 12:37:19 -04:00
Stéphane Lavergne
1b7939c17a
Pass code to response makers
...
Error codes still override it.
2023-08-08 12:35:42 -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
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
ec2f2f6f2e
add Server.run_exn
2023-07-11 10:01:33 -04:00
Simon Cruanes
b9faebffe4
use a resource pool to recycle buffers
2023-06-23 17:58: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
5d7637becc
server: add IO_BACKEND abstraction; implement a unix version of it
...
this doesn't change the `create`+`run` version, but makes it possible to
create a server that doesn't use unix IOs.
2023-06-20 23:03:31 -04:00
Simon Cruanes
ee310b5262
fix: description for 401 code
2023-06-20 23:03:29 -04:00
Simon Cruanes
88bfb9c109
feat: Server.run takes ?after_init parameter
...
also use it in http_of_dir to print the actual port.
2023-05-24 15:38:38 -04:00
Simon Cruanes
0908d71e19
ocamlformat
2023-05-23 17:40:18 -04:00
Simon Cruanes
30a355da5a
fix: SSE requires no body
2023-05-23 17:39:19 -04:00
Simon Cruanes
997f7aa868
expose Response.make_void
...
it only has no body if the http code is compatible with it.
close #62
2023-05-23 17:18:05 -04:00
Stephane Legrand
9c2cf0900d
Add OPTIONS method
2023-05-07 20:55:46 -04:00
Simon Cruanes
53032c993e
fix: get addr/port from the current socket
2023-04-03 12:32:13 -04:00
craff
095487ce85
close stream after Response.output
2023-01-18 17:06:25 -10:00
craff
8c7b764b30
forgot to catch Unix_error
2022-12-09 07:36:05 -10:00
craff
915317438f
use directly file descriptor for input to avoid stacking buffers
2022-12-09 03:17:51 -10:00
Simon Cruanes
d5f9eacc81
split code into more modules
2022-03-16 20:40:38 -04:00