diff --git a/CHANGES.md b/CHANGES.md index dbb90970a..8783208e1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +## Unreleased + +- http: Fix assertion in `Source.to_string_trim` when `pos <> 0` (mefyl #1017) + ## v6.0.0~beta2 (2024-01-05) - cohttp-eio: Don't blow up Server on client disconnections. (mefyl #1011) diff --git a/http/src/http.ml b/http/src/http.ml index f2139d4c0..dd963a720 100644 --- a/http/src/http.ml +++ b/http/src/http.ml @@ -944,7 +944,7 @@ module Parser = struct "Http_parser.Source.substring: Index out of bounds., Requested \ off: %d, len: %d" pos len); - let last = ref (t.pos + len - 1) in + let last = ref (t.pos + pos + len - 1) in let pos = ref (t.pos + pos) in while is_space (String.unsafe_get t.buffer !pos) do incr pos