26 lines
1.3 KiB
C
26 lines
1.3 KiB
C
// calogHttp.h -- calog HTTP client library.
|
|
//
|
|
// Bridges calog scripts to a minimal HTTP/1.1 client so any engine can fetch and post over
|
|
// http:// and https:// without an engine-specific library:
|
|
// httpGet(url) -> { status, body, headers }
|
|
// httpRequest(opts) -> { status, body, headers }
|
|
// where opts is a map { method (default "GET"), url, headers (map of name->value), body }.
|
|
// The result map carries the integer status code, the binary-safe response body, and a
|
|
// headers map keyed by the lowercased header name. Each call opens its own connection
|
|
// ("Connection: close"), reads the whole response to EOF, and decodes the body honoring
|
|
// Transfer-Encoding: chunked / Content-Length / read-to-close. Redirects are NOT followed
|
|
// (a 3xx is returned as-is). For https:// the TLS handshake uses SNI but performs NO
|
|
// certificate verification (v1 -- treat https as transport encoding only, not authenticated).
|
|
// The natives are INLINE (each call is a self-contained connection with no shared state), so
|
|
// there is nothing to shut down.
|
|
|
|
#ifndef CALOG_HTTP_H
|
|
#define CALOG_HTTP_H
|
|
|
|
#include "calog.h"
|
|
|
|
// Register the HTTP natives (httpGet, httpRequest) on a runtime. Stateless: safe to call on
|
|
// any number of runtimes, and there is no matching shutdown.
|
|
int32_t calogHttpRegister(CalogT *calog);
|
|
|
|
#endif
|