ocaml http/1, http/2 and websocket client and server library
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

release: prepare v0.1.0

- Set version to 0.1.0 in dune-project
- Remove climate from runtime dependencies (CLI-only dep)
- Remove duplicate Date_cache module from h1_server.ml
- Update README.md with missing modules and plugs
- Fix broken docs/plugs/reference.md link

+12 -33
+7
README.md
··· 10 10 | [Server](lib/server.ml) | HTTP server with multi-domain parallelism | 11 11 | [Router](lib/router.ml) | Radix trie router with path parameters | 12 12 | [Plug](lib/plug.ml) | Phoenix-style middleware composition | 13 + | [Endpoint](lib/endpoint.ml) | Application bootstrap tying router, plugs, and server | 13 14 | [Websocket](lib/websocket.ml) | WebSocket client and server (RFC 6455) | 15 + | [Sse](lib/sse.ml) | Server-Sent Events | 16 + | [Pubsub](lib/pubsub.ml) | Lock-free topic-based pub/sub messaging | 17 + | [Channel](lib/channel.ml) | WebSocket channel abstraction with topic subscriptions | 14 18 | [Pool](lib/pool.ml) | Connection pool data structure | 15 19 | [Stream](lib/stream.ml) | Sync and async streaming | 16 20 | [Codec](lib/codec.ml) | Codec signature for serialization | ··· 48 52 | `Plug.Retry` | Retry with backoff | 49 53 | `Plug.Basic_auth` | HTTP Basic authentication | 50 54 | `Plug.Csrf` | CSRF token validation | 55 + | `Plug.Negotiate` | Content negotiation (Accept header parsing) | 56 + | `Plug.Token` | Signed/encrypted token generation and validation | 57 + | `Plug.Session` | Cookie-based session management | 51 58 52 59 ### Usage 53 60
-1
docs/README.md
··· 44 44 45 45 - [Overview](plugs/overview.md) - What plugs are and how they compose 46 46 - [Writing Plugs](plugs/writing-plugs.md) - Create custom middleware 47 - - [Reference](plugs/reference.md) - All built-in plugs 48 47 49 48 ## Recipes 50 49
+3 -2
dune-project
··· 2 2 3 3 (name hcs) 4 4 5 + (version 0.1.0) 6 + 5 7 (generate_opam_files true) 6 8 7 9 (source 8 10 ; (tangled @gdiazlo.tngl.sh/hcs) 9 - (uri https://tangled.org/gdiazlo.tngl.sh/hcs)) 11 + (uri git+https://tangled.org/gdiazlo.tngl.sh/hcs)) 10 12 11 13 (authors "Gabriel Díaz") 12 14 ··· 42 44 (bigstringaf (>= 0.10)) 43 45 (faraday (>= 0.8)) 44 46 (kcas (>= 0.7)) 45 - (climate (>= 0.9)) 46 47 (zlib (>= 0.8)) 47 48 (zstd (>= 0.4)) 48 49 (http-multipart-formdata (>= 3.0))
+2 -2
hcs.opam
··· 1 1 # This file is generated by dune, edit dune-project instead 2 2 opam-version: "2.0" 3 + version: "0.1.0" 3 4 synopsis: "Eio based HTTP client/server library for OCaml 5+" 4 5 description: 5 6 "HCS is a HTTP client/server library for OCaml 5+ supporting HTTP/1.1, HTTP/2, and WebSocket. Built on Eio." ··· 29 30 "bigstringaf" {>= "0.10"} 30 31 "faraday" {>= "0.8"} 31 32 "kcas" {>= "0.7"} 32 - "climate" {>= "0.9"} 33 33 "zlib" {>= "0.8"} 34 34 "zstd" {>= "0.4"} 35 35 "http-multipart-formdata" {>= "3.0"} ··· 53 53 "@doc" {with-doc} 54 54 ] 55 55 ] 56 - dev-repo: "https://tangled.org/gdiazlo.tngl.sh/hcs" 56 + dev-repo: "git+https://tangled.org/gdiazlo.tngl.sh/hcs" 57 57 x-maintenance-intent: ["(latest)"]
-28
lib/h1_server.ml
··· 134 134 gc_tuned := true 135 135 end 136 136 137 - (** {1 Cached Date Header} *) 138 - 139 - module Date_cache : sig 140 - val get : unit -> string 141 - end = struct 142 - let cached_date = Atomic.make "" 143 - let cached_time = Atomic.make 0. 144 - 145 - let format_date () = 146 - let t = Unix.gettimeofday () in 147 - let tm = Unix.gmtime t in 148 - Buf.build64 (fun b -> 149 - Buf.http_date b ~wday:tm.Unix.tm_wday ~mday:tm.Unix.tm_mday 150 - ~mon:tm.Unix.tm_mon ~year:(1900 + tm.Unix.tm_year) 151 - ~hour:tm.Unix.tm_hour ~min:tm.Unix.tm_min ~sec:tm.Unix.tm_sec) 152 - 153 - let get () = 154 - let now = Unix.gettimeofday () in 155 - let last = Atomic.get cached_time in 156 - if now -. last >= 1.0 then begin 157 - let date = format_date () in 158 - Atomic.set cached_date date; 159 - Atomic.set cached_time now; 160 - date 161 - end 162 - else Atomic.get cached_date 163 - end 164 - 165 137 (** {1 Cached Prebuilt Response} *) 166 138 167 139 type cached_prebuilt = {