8000 Fix to the chunk sending system · headcloudmonkey/esp32-snippets@9087614 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9087614

Browse files
committed
Fix to the chunk sending system
1 parent aeaeddf commit 9087614

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp_utils/WebServer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,13 +621,14 @@ void WebServer::continueConnection(struct mg_connection* mgConnection) {
621621

622622
FILE* file = unfinishedConnection[mgConnection->sock];
623623
auto pData = (char*) malloc(MAX_CHUNK_LENGTH);
624-
size_t length = fread(pData, MAX_CHUNK_LENGTH, 1, file);
624+
size_t length = fread(pData, 1, MAX_CHUNK_LENGTH, file);
625625

626626
httpResponse.sendChunk(pData, length);
627627
if(length < MAX_CHUNK_LENGTH) {
628628
fclose(file);
629629
httpResponse.closeConnection();
630630
unfinishedConnection.erase(mgConnection->sock);
631+
httpResponse.sendChunk("", 0);
631632
}
632633
free(pData);
633634
}

0 commit comments

Comments
 (0)
0