lmproxy guide

Overview

lmproxy embeds the complete upstream Squid 7 caching proxy and HTTP/1.x parsing engine together with the lmcode-cpp bytecode VM and the 226-signature lmcode_std_v3 standard library inside one self-contained executable. It eliminates external squid.conf files, MIME tables, icon directories, and separate certificate-generator helper binaries while providing both live HTTP/HTTPS traffic interception and deterministic parser scripting.

Embedded Squid 7 engine and single-binary architecture

Standard Squid deployments require multiple auxiliary helper binaries and static configuration trees on disk. lmproxy consolidates the entire stack at compile time and runtime:

Traffic tapping, recording, routing, and redirect swapping

Both lmproxy forward (standard forward proxy, default port 3128) and lmproxy intercept (transparent interception proxy, default port 3129) support four composable traffic engineering flags across plain HTTP and SSL-bumped HTTPS:

URL decomposition and HTTP/1.x message parsing in LMScript

For fast, deterministic protocol validation without opening network sockets, lmproxy exposes Squid 7's internal URL and HTTP/1.x parser classes directly to the CLI (parse-url, parse-request, parse-response) and to _lmcode_ scripts via context proxy: Proxy:

Standard lmcode_std_v3 REST and CLI interfaces

In addition to context proxy: Proxy, lmproxy embeds the full 226-signature lmcode_std_v3 standard catalog. Scripts can wrap Squid 7 parsing logic inside standard HTTP endpoints or stateless CLI tools:

p = _lmcode_ cli="lmproxy" install="github:lmctl-ai/lmproxy@latest";
@"--header"
fn opt_hdr(x: RestExchange) -> void implements CliOption {
  x.set("hdr", x.query("header"));
}

@"extract-header"
fn cmd_extract(x: RestExchange) -> void implements CliCommand {
  let msg = proxy.parse_request(x.body());
  x.send(msg.header(x.get("hdr")));
}

@"/decode"
fn post_decode(x: RestExchange) -> void implements RestPost {
  x.json("{\"decoded\":\"" + proxy.percent_decode(x.body()) + "\"}");
}

rest_config("session", "global");
let raw_req = "GET /v1/data HTTP/1.1\r\nHost: edge.internal\r\nX-Trace: tr-99\r\n\r\n";
assert_eq(rest_cli(str_split("--header=x-trace extract-header -- " + raw_req, " ")), "tr-99");
end _lmcode_