Skip to content

Commit

Permalink
web_server: Complain if sendChunk is called with a zero-length chunk.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtrbt committed Nov 27, 2024
1 parent 6a0e4b9 commit 6f81cc6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions software/src/modules/web_server/web_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ int WebServerRequest::sendChunk(const char *chunk, ssize_t chunk_len)
break;
}

if (chunk_len == 0)
logger.printfln("BUG: sendChunk was called with chunk_len == 0! Use endChunkedResponse!");

auto result = httpd_resp_send_chunk(req, chunk, chunk_len);
if (result != ESP_OK) {
chunkedResponseState = ChunkedResponseState::Failed;
Expand Down

0 comments on commit 6f81cc6

Please sign in to comment.