Skip to content

Commit 07c63a3

Browse files
committed
Fixed printf format inconsistency, added test for bad encoding
1 parent a81aa91 commit 07c63a3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

examples/ChunkRequest/ChunkRequest.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ using namespace asyncsrv;
4141
// curl -T bigfile.txt -H 'Transfer-Encoding: chunked' -H 'X-Expected-Entity-Length: 99999999' http://192.168.4.1/
4242
// ** Note: MacOS WebDAVFS supplies the X-Expected-Entity-Length header with its
4343
// ** chunked PUTs
44+
// Malformed chunk (triggers abort)
45+
// printf 'PUT /bad HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n5\r\n12345\r\nZ\r\n' | nc 192.168.4.1 80
4446

4547
// This struct is used with _tempObject to communicate between handleBody and a subsequent handleRequest
4648
struct RequestState {
@@ -141,7 +143,7 @@ void handleBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_
141143
#endif
142144
avail = (avail >= 4096) ? avail - 4096 : avail; // Reserve a block for overhead
143145
if (total > avail) {
144-
Serial.printf("PUT %u bytes will not fit in available space (%u).\n", total, avail);
146+
Serial.printf("PUT %zu bytes will not fit in available space (%zu).\n", total, avail);
145147
request->send(507, "text/plain", "Too large for available storage\r\n");
146148
return;
147149
}

0 commit comments

Comments
 (0)