diff -ru libcsoap-1.1.0.bak/nanohttp/nanohttp-socket.c libcsoap-1.1.0/nanohttp/nanohttp-socket.c
--- libcsoap-1.1.0.bak/nanohttp/nanohttp-socket.c	2009-07-19 13:27:14.000000000 +1000
+++ libcsoap-1.1.0/nanohttp/nanohttp-socket.c	2009-07-19 13:45:15.000000000 +1000
@@ -552,7 +552,7 @@
       {
         memcpy(&buffer[totalRead], sock->read_buf, total - totalRead);
         *received = total;
-        sock->buf_used = count - total - totalRead;
+        sock->buf_used = count - (total - totalRead);
         sock->buf_start = total - totalRead;
         return H_OK;
       }
