mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-14 06:46:12 -05:00
add stdlibshims + catch EBADF
This commit is contained in:
parent
91ca51ea42
commit
47d9ace8fd
3 changed files with 7 additions and 2 deletions
|
|
@ -39,8 +39,12 @@ let rec write_out ({buf;fd;_} as oc) i len =
|
||||||
with Sys_blocked_io
|
with Sys_blocked_io
|
||||||
| Unix.Unix_error((EAGAIN|EWOULDBLOCK),_,_) ->
|
| Unix.Unix_error((EAGAIN|EWOULDBLOCK),_,_) ->
|
||||||
write_out oc i len
|
write_out oc i len
|
||||||
| Unix.Unix_error(EPIPE,_,_) ->
|
| Unix.Unix_error((EPIPE|EBADF),_,_) ->
|
||||||
raise (Sys_error "broken pipe")
|
raise (Sys_error "broken pipe")
|
||||||
|
| e ->
|
||||||
|
Printf.eprintf "unexpected exception in write_out: %s\n%!"
|
||||||
|
(Printexc.to_string e);
|
||||||
|
assert false
|
||||||
|
|
||||||
let rec output ({buf;pos;_} as oc) s i len =
|
let rec output ({buf;pos;_} as oc) s i len =
|
||||||
let buf_len = Bytes.length buf in
|
let buf_len = Bytes.length buf in
|
||||||
|
|
|
||||||
2
src/dune
2
src/dune
|
|
@ -2,6 +2,6 @@
|
||||||
(library
|
(library
|
||||||
(name tiny_httpd)
|
(name tiny_httpd)
|
||||||
(public_name tiny_httpd)
|
(public_name tiny_httpd)
|
||||||
(libraries threads)
|
(libraries threads stdlib-shims)
|
||||||
(flags :standard -safe-string -warn-error -a+8)
|
(flags :standard -safe-string -warn-error -a+8)
|
||||||
(wrapped false))
|
(wrapped false))
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ build: [
|
||||||
]
|
]
|
||||||
depends: [
|
depends: [
|
||||||
"dune" { >= "2.0" }
|
"dune" { >= "2.0" }
|
||||||
|
"stdlib-shims"
|
||||||
"base-threads"
|
"base-threads"
|
||||||
"ocaml" { >= "4.04.0" }
|
"ocaml" { >= "4.04.0" }
|
||||||
"odoc" {with-doc}
|
"odoc" {with-doc}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue