Skip to content

Commit 4aeab61

Browse files
committed
Fixed calculation of remaining request body length, resolve #28
1 parent 40dc03c commit 4aeab61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/HTTPRequest.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ size_t HTTPRequest::readBytes(byte * buffer, size_t length) {
6060

6161
size_t bytesRead = 0;
6262
if (length > 0) {
63-
_con->readBuffer(buffer, length);
63+
bytesRead = _con->readBuffer(buffer, length);
6464
}
6565

6666
if (_contentLengthSet) {
@@ -106,6 +106,9 @@ bool HTTPRequest::requestComplete() {
106106
void HTTPRequest::discardRequestBody() {
107107
byte buf[16];
108108
while(!requestComplete()) {
109+
delay(500);
110+
Serial.println("Discarding 16 bytes of request body...");
111+
Serial.printf("Remaining content is %i bytes\n", _remainingContent);
109112
readBytes(buf, 16);
110113
}
111114
}

0 commit comments

Comments
 (0)