Merge pull request #55 from craff/close_stream

close stream after Response.output
This commit is contained in:
Simon Cruanes 2023-01-19 00:24:23 -05:00 committed by GitHub
commit c81ca48fbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -406,7 +406,12 @@ module Response = struct
begin match body with begin match body with
| `String "" | `Void -> () | `String "" | `Void -> ()
| `String s -> output_string oc s; | `String s -> output_string oc s;
| `Stream str -> Byte_stream.output_chunked oc str; | `Stream str ->
try
Byte_stream.output_chunked oc str;
Byte_stream.close str
with
e -> Byte_stream.close str; raise e
end; end;
flush oc flush oc
end end