Errors#
Every fallible call returns an lwhttp_error_t, and on_complete receives one as the final result.
lwhttp_error_string() turns any of them into a short message.
Result |
Typical cause |
|---|---|
|
Success. A finished request may still carry any HTTP status, including |
|
|
|
The lwIP-CE heap could not satisfy an allocation. See memory. |
|
A request was started while the client was still busy. |
|
The URL has no scheme or host, a bad port, or spaces and control characters. |
|
The host name could not be resolved. |
|
The TCP connection could not be established, or timed out while connecting. |
|
The TLS handshake or certificate check failed. See HTTPS. |
|
lwIP-CE rejected a write on an open connection. |
|
The connection closed, reset or timed out before the response was complete. |
|
The server sent a malformed response: bad status line, bad header, inconsistent lengths, broken chunking. |
|
The server answered with a major HTTP version other than 1. |
|
A scheme other than |
|
A length or chunk size too big to represent, or a URL too long for its buffer. |
|
The response head or a single header line does not fit in the header store. |
|
A |
|
A callback returned |
Synchronous and asynchronous errors#
Errors found before a request goes on the wire are returned by lwhttp_client_request() and never reach
on_complete. Everything after that is reported once, through on_complete, and is also available afterwards from
lwhttp_client_result().
lwhttp_error_t e = lwhttp_client_request(client, &request, &handlers, &state);
if (e) show_error(lwhttp_error_string(e));