|
cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
|
One HTTPS JSON POST, shared by every RPC client in the firmware. More...
#include <stdbool.h>#include <stddef.h>Go to the source code of this file.
Functions | |
| bool | https_post_json (const char *url, const char *body, char *resp_buf, size_t resp_buf_size, const char *user, const char *pass, const char *ca_pem) |
| POST a JSON body over HTTPS and read the response. | |
One HTTPS JSON POST, shared by every RPC client in the firmware.
Moved out of eth_rpc.cpp when the Tron client arrived: the response-Date clock cross-check that defends against a spoofed SNTP clock must have a single implementation, or one endpoint ends up without it.
Definition in file https_post.h.
| bool https_post_json | ( | const char * | url, |
| const char * | body, | ||
| char * | resp_buf, | ||
| size_t | resp_buf_size, | ||
| const char * | user, | ||
| const char * | pass, | ||
| const char * | ca_pem ) |
POST a JSON body over HTTPS and read the response.
The response is read until EOF or buffer-full and is always NUL-terminated. The server's Date header is cross-checked against the system clock; a parseable header that disagrees by more than five minutes fails the call (see https_post.cpp for why that is the right verdict).
| [in] | url | Full HTTPS endpoint URL. |
| [in] | body | JSON request body (NUL-terminated). |
| [out] | resp_buf | Response buffer, NUL-terminated on return. |
| [in] | resp_buf_size | Capacity of resp_buf. |
| [in] | user | HTTP Basic Auth username, or NULL/"" for none. |
| [in] | pass | HTTP Basic Auth password, or NULL/"" for none. |
| [in] | ca_pem | PEM certificate to validate against instead of the Mozilla CA bundle, or NULL for the bundle. |
Definition at line 140 of file https_post.cpp.
References clock_corroborated(), resp_hdrs_t::date, http_event_cb(), RESP_LOG_MAX, TAG, and wdt_feed().
Referenced by do_post(), and tron_post().