src/server/util/io.c

branch
webdav
changeset 235
4990147c58d0
parent 205
b8515afa450a
child 251
f727a21497bb
--- a/src/server/util/io.c	Sat Jan 18 16:48:03 2020 +0100
+++ b/src/server/util/io.c	Sun Jan 19 09:01:39 2020 +0100
@@ -269,8 +269,10 @@
         io[1].iov_len = nbytes;
         io[2].iov_base = "\r\n";
         io[2].iov_len = 2;
+        // TODO: FIXME: if r < sum of iov_len, everything would explode
+        // we need to store the chunk state and remaining bytes
         ssize_t r = fd->writev(fd, io, 3);
-        return r - io[0].iov_len;
+        return r - io[0].iov_len - io[2].iov_len;
     } else {
         return fd->write(fd, buf, nbytes);
     }

mercurial