Require explicit transfer-encoding: chunked for said parsing to begin

This commit is contained in:
Alex Hultman
2022-10-17 21:34:55 +02:00
parent bcf5034e3c
commit 6cb37f9b00
+6 -1
View File
@@ -305,7 +305,8 @@ private:
consumedTotal += emittable; consumedTotal += emittable;
} }
} else { } else {
/* We are not GET and we have no content-length, so assume transfer-encoding: chunked */ /* We are not GET and we have no content-length */
if (req->getHeader("transfer-encoding").find("chunked") != std::string_view::npos) {
remainingStreamingBytes = STATE_IS_CHUNKED; remainingStreamingBytes = STATE_IS_CHUNKED;
/* If consume minimally, we do not want to consume anything but we want to mark this as being chunked */ /* If consume minimally, we do not want to consume anything but we want to mark this as being chunked */
if (!CONSUME_MINIMALLY) { if (!CONSUME_MINIMALLY) {
@@ -319,6 +320,10 @@ private:
length = (unsigned int) dataToConsume.length(); length = (unsigned int) dataToConsume.length();
consumedTotal += consumed; consumedTotal += consumed;
} }
} else {
/* We have no content-length and no transfer-encoding: chunked */
dataHandler(user, {}, true);
}
} }
} else { } else {
/* Still emit an empty data chunk to signal no data */ /* Still emit an empty data chunk to signal no data */