refactor: network - harden TCP/IP and unify HTTP clients
This commit is contained in:
@@ -376,7 +376,10 @@ The optional `AbortCheckFn` callback (e.g., `bool check_quit()`) lets terminal/G
|
||||
|
||||
### HTTP Wrapper (`http/http.hpp`)
|
||||
|
||||
The MontaukAI dev environment includes a higher-level HTTP wrapper built on top of `tls::https_fetch()`. It handles DNS, request building, TLS, and response parsing automatically. See the "Networking and HTTPS" section in `gui-apps.md` for full documentation and examples.
|
||||
The MontaukOS SDK includes a higher-level HTTP client built on top of the TLS
|
||||
and socket layers. It handles DNS, request construction, transport, response
|
||||
framing, and parsing. See the "Networking and HTTPS" section in `gui-apps.md`
|
||||
for full documentation and examples.
|
||||
|
||||
```cpp
|
||||
#include <http/http.hpp>
|
||||
@@ -384,7 +387,9 @@ The MontaukAI dev environment includes a higher-level HTTP wrapper built on top
|
||||
tls::TrustAnchors tas = tls::load_trust_anchors();
|
||||
|
||||
auto resp = http::get("api.example.com", "/v1/data", tas);
|
||||
if (resp.status == 200) { /* resp.body, resp.body_len */ }
|
||||
if (resp.error == http::Error::NONE && resp.status == 200) {
|
||||
/* resp.body, resp.body_len */
|
||||
}
|
||||
http::free_response(&resp);
|
||||
|
||||
auto resp2 = http::post("api.example.com", "/v1/submit",
|
||||
|
||||
Reference in New Issue
Block a user