Simon Cruanes
89344f46f0
feat(server-sent): add a close() function
2021-12-11 10:01:55 -05:00
Simon Cruanes
dc72dad5db
revert: remove timeout handling for now
...
This reverts commit 6536bfeeb3 .
2021-12-11 09:32:55 -05:00
Simon Cruanes
6536bfeeb3
fix: when reading from unix FD, use a loop to handle signals
2021-12-11 09:13:16 -05:00
Simon Cruanes
f316e66c15
switch from "available" to "active" connections
2021-12-11 09:10:29 -05:00
craff
c3265af08f
moved back acquire before accept but inside the try ... with ... one never knowns
2021-12-10 12:49:51 -10:00
craff
97eeaf96dc
make accessible to the end user the number of available connections
2021-12-08 17:54:08 -10:00
craff
9b4a1b1197
remove mutex to get available_connections
2021-12-08 17:47:53 -10:00
craff
e87428ae51
release semaphore does not return anything anymore
2021-12-08 16:38:59 -10:00
craff
9e9fe32347
only set non blocking for reading request, not to write answer
2021-12-08 12:07:35 -10:00
craff
4c7d27dadd
Added a max_keep_alive and moved to a non blocking reading of request not to loose connection slot.
...
Default is max_keep_alive = -1.0 which keeps the original behaviour.
2021-12-08 11:46:01 -10:00
craff
19a4bad231
use _debug and better message
2021-11-29 23:38:28 -10:00
craff
6ccd8314a3
Unix.accept may raise an exception (typicall Unix.EINTR, even with sigpipe blocked ?)
...
This avoids the server to stop
2021-11-29 15:35:41 -10:00
Simon Cruanes
0e05b8cac6
Update src/Tiny_httpd.ml
2021-09-25 14:41:42 -04:00
Yawar Amin
8414efc3e0
Adjust implementation
...
Only do things that are relevant for binding a socket if we actually
should.
2021-09-25 02:03:28 -04:00
Yawar Amin
ce61ac2afd
feat: allow socket activation
...
This enables passing in an existing socket e.g. from systemd,[1] instead
of creating a new socket when running the server.
[1] https://github.com/juergenhoetzel/ocaml-systemd
2021-09-25 01:41:32 -04:00
Simon Cruanes
95d9bd10ef
fix: do not set content-length for server-sent events
2021-07-17 22:09:45 -04:00
Simon Cruanes
62d583553e
allow extra headers in server-sent events
2021-07-17 22:09:45 -04:00
Simon Cruanes
17d8f37c93
feat: remove async for now, finish server sent events
2021-07-17 22:09:45 -04:00
Simon Cruanes
2e0f08366f
wip: feat: server-sent events, and asynchronous handlers
2021-07-16 01:12:39 -04:00
Anurag Soni
6b57540b50
Validate header key's character set ( #15 )
...
* Validate header key's character set
2021-05-14 12:10:33 -04:00
Simon Cruanes
ddd337cc61
perf: simpler parsing of headers
2021-05-03 12:39:19 -04:00
Simon Cruanes
2a955bcbb4
feat: add rest_of_path_urlencoded and rename rest to rest_of_path
2020-11-17 10:43:05 -05:00
Simon Cruanes
2ed9131bdc
feat: add Route.rest to match the rest of the path
2020-11-17 09:16:28 -05:00
Simon Cruanes
aa66e172e8
feat: printing routes
2020-08-04 19:16:15 -04:00
Simon Cruanes
6e54ee69b5
fix: avoid spamming response
2020-05-27 22:30:50 -04:00
Simon Cruanes
6d01b5347e
fix: do not output a content-length for a chunked response
2020-05-27 22:25:13 -04:00
Simon Cruanes
fdd97744e0
feat: use chunked encoding for large string responses, too
2020-05-27 22:16:36 -04:00
Simon Cruanes
4f730ec7b6
fix: set transfer-encoding header when returning a chunked stream
2020-05-27 21:39:43 -04:00
Simon Cruanes
4a83a2f07f
fix(zip): handle case where camlzip consumes 0 bytes
2020-05-27 21:27:25 -04:00
Simon Cruanes
b640c0da30
feat: add Route.t construct, deprecate scanf, add more structured path
...
- Request now contains a path split into components
- Request now contains the query part already transformed into an assoc list
- Route.t uses a simple GADT for mapping `/`-split paths into routes,
passing some components of type string or int to the handler
- deprecate scanf-based routing, as being too error prone
2020-05-27 19:56:23 -04:00
Simon Cruanes
eaa2c9b3b7
accept http1.0
2020-05-27 13:23:02 -04:00
Simon Cruanes
5c56cb7f1e
debug msg
2020-05-27 13:11:32 -04:00
Simon Cruanes
2435e33df4
feat: expose Headers.empty
2020-03-25 23:23:06 -04:00
Simon Cruanes
59829264a5
wip: zlib bridge library
2020-03-25 23:23:06 -04:00
Simon Cruanes
f8a5968984
fix: use the non-query path for routing
2020-02-26 19:55:49 -06:00
Simon Cruanes
b3f254446d
strip whitespace
2020-02-08 09:37:12 -06:00
Simon Cruanes
130608d924
feat: easy accessor to the query parameters in path
2019-12-09 14:28:57 -06:00
Anurag Soni
057d5c9f0c
header field names are case insensitive
...
Reference: https://tools.ietf.org/html/rfc2616#section-4.2
2019-12-09 09:42:56 -06:00
Simon Cruanes
aa35e324e6
refactor
2019-12-03 17:38:56 -06:00
Simon Cruanes
948b5e6389
test: add a unit test for parsing http req
2019-12-03 17:32:12 -06:00
Simon Cruanes
de7acbaf6d
refactor: logerror when closing client socket
2019-12-03 17:19:41 -06:00
Simon Cruanes
8d33f84022
fix: missing crlf between chunks
2019-12-02 21:15:18 -06:00
Simon Cruanes
c16e386338
fix: read_all must return rather than blocking when done
2019-12-02 21:15:18 -06:00
Simon Cruanes
51519fec1f
fix: proper amortized O(1) push in Buf.push
2019-12-02 21:15:18 -06:00
Simon Cruanes
45bc589e00
feat: allow handlers to take streams
...
close #9
2019-12-02 21:15:13 -06:00
Simon Cruanes
6af39da3a6
tweak debug messages
2019-11-27 16:23:25 -06:00
Simon Cruanes
98642811bc
feat: autodetect ipv6 address
2019-11-26 18:09:46 -06:00
Simon Cruanes
b7e458c0c4
feat: support ipv6 address
2019-11-26 18:02:18 -06:00
Simon Cruanes
20275c164f
improve docs and opam, tidy up for 0.1; rename stream
2019-11-18 23:18:46 -06:00
Simon Cruanes
8bfcf3673a
feat: add host field to request
2019-11-18 23:04:23 -06:00