simpler eof handling

This commit is contained in:
Daniel Barlow 2023-02-15 19:50:00 +00:00
parent b84a6e0aa5
commit 1b372bcb2b

View file

@ -33,15 +33,9 @@
(values (values
(fn handler [reqlen] (fn handler [reqlen]
(let [bytes (f:read reqlen)] (let [bytes (f:read reqlen)]
(if eof? (if bytes
false
bytes
(values true bytes) (values true bytes)
(do (values false nil))))
;; if the file length is divisible by the block
;; length, need to send an empty block at eof
(set eof? true)
(values true "")))))
size)) size))
(error "host not allowed"))) (error "host not allowed")))
nil nil