summaryrefslogtreecommitdiff
path: root/lib/http/session.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http/session.myr')
-rw-r--r--lib/http/session.myr13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/http/session.myr b/lib/http/session.myr
index d641cda..2b6f65a 100644
--- a/lib/http/session.myr
+++ b/lib/http/session.myr
@@ -9,6 +9,7 @@ pkg http =
const freesession : (s : session# -> void)
pkglocal const ioput : (s : session#, fmt : byte[:], args : ... -> bool)
+ pkglocal const iowrite : (s : session#, buf : byte[:] -> bool)
pkglocal const ioflush : (s : session# -> void)
;;
@@ -64,6 +65,18 @@ const ioput = {s, fmt, args
-> s.err
}
+const iowrite = {s, buf
+ if s.err
+ -> false
+ ;;
+ match bio.write(s.f, buf)
+ | `bio.Ok _: /* nothing */
+ | `bio.Err _: s.err = true
+ | `bio.Eof: s.err = true
+ ;;
+ -> s.err
+}
+
const ioflush = {s
bio.flush(s.f)
}