src/server/util/io.c

changeset 714
fe4d14625245
parent 707
5fb102d2c745
--- a/src/server/util/io.c	Tue Mar 03 22:01:27 2026 +0100
+++ b/src/server/util/io.c	Wed Mar 04 21:42:25 2026 +0100
@@ -297,6 +297,7 @@
     st->chunked_enc = WS_FALSE;
     st->read_eof = WS_TRUE;
     st->write_eof = WS_FALSE;
+    st->raw = WS_FALSE;
     return (IOStream*)st;
 }
 
@@ -559,7 +560,9 @@
     if(r < 0) {
         st->st.io_errno = st->fd->io_errno;
     }
-    st->read += r;
+    if(!st->raw) {
+        st->read += r;
+    }
     return r;
 }
 
@@ -584,7 +587,9 @@
             // amount of bytes we copy
             size_t chunk_available = httpstr->max_read - httpstr->read;
             cplen = cplen > chunk_available ? chunk_available : cplen;
-            httpstr->read += cplen;
+            if(!httpstr->raw) {
+                httpstr->read += cplen;
+            }
         }
         memcpy(buf, httpstr->readbuf + pos, cplen);
         *httpstr->bufpos += cplen;
@@ -808,10 +813,6 @@
     return rd;
 }
 
-ssize_t net_http_read_raw(HttpStream *st, void *buf, size_t nbytes) {
-    return st->fd->read(st->fd, buf, nbytes);
-}
-
 ssize_t net_http_sendfile(HttpStream *st, sendfiledata *sfd) {
     if(st->write_eof) return 0;
     ssize_t ret = 0;

mercurial