Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Unreleased

- cohttp-eio: Don't blow up `Server.callback` on connection timeout. (mefyl #1021)
- cohttp-eio: Don't blow up `Server.callback` on client disconnections. (mefyl #1015)
- http: Fix assertion in `Source.to_string_trim` when `pos <> 0` (mefyl #1017)

Expand Down
15 changes: 10 additions & 5 deletions cohttp-eio/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ let callback { conn_closed; handler } ((_, peer_address) as conn) input output =
in
conn_closed (conn, id)
| exception Eio.Io (Eio.Net.E (Connection_reset _), _) ->
let () =
Logs.info (fun m ->
m "%a: connection reset" Eio.Net.Sockaddr.pp peer_address)
in
()
Logs.info (fun m ->
m "%a: connection reset" Eio.Net.Sockaddr.pp peer_address)
| exception
Eio.Io
( Eio.Exn.X _
(* To catch the backend-specific Eio_unix.Unix_error
(ETIMEDOUT, _, _), at least *),
_ ) ->
Logs.info (fun m ->
m "%a: connection timed out" Eio.Net.Sockaddr.pp peer_address)
| `Invalid e ->
write output
(Http.Response.make ~status:`Bad_request ())
Expand Down