src/server/util/io.h

branch
webdav
changeset 334
a55491f66003
parent 333
bb536d4bc174
child 335
5234c57b8759
--- a/src/server/util/io.h	Fri May 06 22:45:53 2022 +0200
+++ b/src/server/util/io.h	Sat May 07 12:54:19 2022 +0200
@@ -93,17 +93,55 @@
 struct HttpStream {
     IOStream st;
     IOStream *fd;
+    
+    /*
+     * content-length or current chunk size
+     */
     uint64_t max_read;
+    /*
+     * total bytes read (with content-length) or bytes read of current chunk
+     */
     uint64_t read;
+    /*
+     * total bytes read with chunked transfer encoding
+     */
     uint64_t read_total;
+    /*
+     * read buffer (used only with chunked transfer encoding)
+     */
     char     *readbuf;
+    /*
+     * readbuf size
+     */
     size_t   bufsize; // allocated buffer size
+    /*
+     * number of bytes currently stored in readbuf
+     */
     size_t   buflen;  // currently number of bytes in the buffer
+    /*
+     * current position in the read buffer
+     */
     int      *bufpos; // current buffer position
+    /*
+     * current chunk_buf position
+     */
     int      chunk_buf_pos;
+    /*
+     * buffer used only for parsing chunk headers
+     */
     char     chunk_buf[HTTP_STREAM_CBUF_SIZE];
+    /*
+     * after the chunk header is parsed, the content of chunk_buf
+     * will be moved to remaining_buf
+     */
     char     remaining_buf[HTTP_STREAM_CBUF_SIZE];
+    /*
+     * number of bytes currently stored in remaining_buf
+     */
     int      remaining_len;
+    /*
+     * 
+     */
     int      remaining_pos;
     WSBool   chunked_enc;
     WSBool   read_eof;

mercurial