Skip to content
Merged
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
7 changes: 0 additions & 7 deletions async/cohttp_async_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ let read ic len =
| `Ok len' -> String.sub buf 0 len'
| `Eof -> ""

let read_exactly ic len =
let buf = String.create len in
Reader.really_read ic ~pos:0 ~len buf >>|
function
|`Ok -> Some buf
|`Eof _ -> None

let write =
check_debug
(fun oc buf ->
Expand Down
5 changes: 0 additions & 5 deletions lib/s.mli
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ module type IO = sig
request. *)
val read : ic -> int -> string t

(** [read_exactly ic len] will block until exactly [len] characters
are read from the input channel [ic]. If EOF or some other
error condition is reached, then {!None} is returned. *)
val read_exactly : ic -> int -> string option t

(** [write oc s] will block until the complete [s] string is
written to the output channel [oc]. *)
val write : oc -> string -> unit t
Expand Down
2 changes: 0 additions & 2 deletions lib/string_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ module M = struct
Some s
end

let read_exactly x n = return (read_exactly' x n)

let read x n =
match read_exactly' x n with
| None when x.pos >= x.len -> raise End_of_file
Expand Down
22 changes: 0 additions & 22 deletions lwt/cohttp_lwt_unix_io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,6 @@ let read ic count =
else
try_read ()

let read_exactly ic buf off len =
let try_read () =
Lwt.try_bind (fun () -> Lwt_io.read_into_exactly ic buf off len)
(fun () -> Lwt.return_true)
(function
| End_of_file -> Lwt.return_false
| x -> Lwt.fail x) in
if !CD.debug_active then
try_read () >>= fun rd ->
(match rd with
| true -> CD.debug_print "<<< %S" (String.sub buf off len)
| false -> CD.debug_print "<<< <EOF>\n");
return rd
else
try_read ()

let read_exactly ic len =
let buf = Bytes.create len in
read_exactly ic buf 0 len >>= function
| true -> return (Some buf)
| false -> Lwt.return_none

let write oc buf =
if !CD.debug_active then
(CD.debug_print ">>> %s" buf; Lwt_io.write oc buf)
Expand Down
1 change: 0 additions & 1 deletion lwt/string_io_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type conn = Cohttp.String_io.M.conn
let iter = Lwt_list.iter_s
let read_line ic = return (Cohttp.String_io.M.read_line ic)
let read ic n = return (Cohttp.String_io.M.read ic n)
let read_exactly ic n = return (Cohttp.String_io.M.read_exactly ic n)

let write oc str = return (Cohttp.String_io.M.write oc str)
let flush oc = return (Cohttp.String_io.M.flush oc)
Expand Down