HTTPClient fixed timeout sending payload HTTPC_ERROR_SEND_PAYLOAD_FAILED
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 13.1k
- PR merge metrics
- No merged PRs in 30d
Description
ESP8266HTTPClient.cpp does
```
int HTTPClient::sendRequest(const char * type, const uint8_t * payload, size_t size)
...
// transfer all of it, with send-timeout
if (size && StreamConstPtr(payload, size).sendAll(_client.get()) != size)
return returnError(HTTPC_ERROR_SEND_PAYLOAD_FAILED);
```
StreamConstPtr derives from Stream which defines
```
protected:
unsigned long _timeout = 1000; // number of milliseconds to wait for the next char before aborting timed read
```
So no matter what your HTTPClient.setTimeout is, 1 second pause on your server side causes a HTTPC_ERROR_SEND_PAYLOAD_FAILED.
It's obvious, but httpclient should create the StreamConstPtr, set its timeout to either the full or the remaining millisecs, and then issue the sendAll.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.