Sfoglia il codice sorgente

Read \r\n terminator after chunked encoding

Scott Graham 8 anni fa
parent
commit
87c673fd67
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      httplib.h

+ 6 - 0
httplib.h

@@ -828,6 +828,12 @@ bool read_content_chunked(Stream& strm, T& x)
         chunk_len = std::stoi(reader.ptr(), 0, 16);
     }
 
+    if (chunk_len == 0) {
+        // Reader terminator after chunks
+        if (!reader.getline() || strcmp(reader.ptr(), "\r\n"))
+            return false;
+    }
+
     return true;
 }