arduino-libraries / ArduinoHttpClient

Arduino HTTP Client library
282 stars 170 forks source link

responseBody gets stuck in an infinite loop #37

Closed jameshowe closed 6 years ago

jameshowe commented 6 years ago

Using in conjunction with TinyGSM library, whenever I try to consume the body from any request this call gets stuck in an infinite loop

Code

HttpClient client("server", 443);
...
client.connectionKeepAlive();
client.get("/resource");
int status = client.responseStatusCode();
String body = sasClient.responseBody();

Log

AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,99,224
*** omitted for brevity ***
OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,99,125
*** omitted for brevity ***
OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,99,26
*** omitted for brevity ***
OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,26,0
*** omitted for brevity ***
OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,0,0

OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,0,0

OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,0,0

OK
AT+CIPRXGET=2,1,99

+CIPRXGET: 2,1,0,0
...

Seems to still think there is data to be consumed. Tried various combinations e.g. skipResponseHeaders before responseBody, trying responseBody on it's own (so no call to responseStatusCode). Nothing seems to fix it.

jameshowe commented 6 years ago

It appears this issue was related to not having enough RAM, reducing the memory consumption in other places seemed to fix this issue.