695695module Server_connection : sig
696696 module Config : sig
697697 type t =
698- { read_buffer_size : int (* * Default is [4096] *)
699- ; response_buffer_size : int (* * Default is [1024] *)
698+ { response_buffer_size : int (* * Default is [1024] *)
700699 ; response_body_buffer_size : int (* * Default is [4096] *)
701700 }
702701
@@ -723,27 +722,29 @@ module Server_connection : sig
723722 (* * [create ?config ?error_handler ~request_handler] creates a connection
724723 handler that will service individual requests with [request_handler]. *)
725724
726- val next_read_operation : _ t -> [ `Read of Bigstring .t | `Yield | `Close ]
725+ val next_read_operation : _ t -> [ `Read | `Yield | `Close ]
727726 (* * [next_read_operation t] returns a value describing the next operation
728727 that the caller should conduct on behalf of the connection. *)
729728
730- val report_read_result : _ t -> [`Ok of int | `Eof ] -> unit
731- (* * [report_read_result t result] reports the result of the latest read
732- attempt to the connection. {report_read_result} should be called after a
733- call to {next_read_operation} that returns a [`Read buffer] value.
734-
735- {ul
736- {- [`Ok n] indicates that the caller successfully received [n] bytes of
737- input and wrote them into the the read buffer that the caller was
738- provided by {next_read_operation}. }
739- {- [`Eof] indicates that the input source will no longer provide any
740- bytes to the read processor. }} *)
729+ val read : _ t -> Bigstring .t -> off :int -> len :int -> int
730+ (* * [read t bigstring ~off ~len] reads bytes of input from the provided range
731+ of [bigstring] and returns the number of bytes consumed by the
732+ connection. {!read} should be called after {!next_read_operation}
733+ returns a [`Read] value and additional input is available for the
734+ connection to consume. *)
741735
742736 val yield_reader : _ t -> (unit -> unit ) -> unit
743737 (* * [yield_reader t continue] registers with the connection to call
744738 [continue] when reading should resume. {!yield_reader} should be called
745739 after {next_read_operation} returns a [`Yield] value. *)
746740
741+ val shutdown_reader : _ t -> unit
742+ (* * [shutdown_reader t] shutds own the read processor for the connection. All
743+ subsequent calls to {!next_read_operations} will return [`Close].
744+ {!shutdown_reader} should be called after {!next_read_operation} returns
745+ a [`Read] value and there is no further input available for the
746+ connection to consume. *)
747+
747748 val next_write_operation : _ t -> [
748749 | `Write of Bigstring .t IOVec .t list
749750 | `Yield
@@ -808,21 +809,23 @@ module Client_connection : sig
808809 -> response_handler:response_handler
809810 -> [`write ] Body. t * t
810811
811- val next_read_operation : t -> [ `Read of Bigstring .t | `Close ]
812+ val next_read_operation : t -> [ `Read | `Close ]
812813 (* * [next_read_operation t] returns a value describing the next operation
813814 that the caller should conduct on behalf of the connection. *)
814815
815- val report_read_result : t -> [`Ok of int | `Eof ] -> unit
816- (* * [report_read_result t result] reports the result of the latest read
817- attempt to the connection. {report_read_result} should be called after a
818- call to {next_read_operation} that returns a [`Read buffer] value.
819-
820- {ul
821- {- [`Ok n] indicates that the caller successfully received [n] bytes of
822- input and wrote them into the the read buffer that the caller was
823- provided by {next_read_operation}. }
824- {- [`Eof] indicates that the input source will no longer provide any
825- bytes to the read processor. }} *)
816+ val read : t -> Bigstring .t -> off :int -> len :int -> int
817+ (* * [read t bigstring ~off ~len] reads bytes of input from the provided range
818+ of [bigstring] and returns the number of bytes consumed by the
819+ connection. {!read} should be called after {!next_read_operation}
820+ returns a [`Read] value and additional input is available for the
821+ connection to consume. *)
822+
823+ val shutdown_reader : t -> unit
824+ (* * [shutdown_reader t] shutds own the read processor for the connection. All
825+ subsequent calls to {!next_read_operations} will return [`Close].
826+ {!shutdown_reader} should be called after {!next_read_operation} returns
827+ a [`Read] value and there is no further input available for the
828+ connection to consume. *)
826829
827830 val next_write_operation : t -> [
828831 | `Write of Bigstring .t IOVec .t list
0 commit comments