MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / host_is_loopback

Function host_is_loopback

src/ui/http_server.c:1628–1632  ·  view source on GitHub ↗

True when the Host header names the loopback interface the server binds to * (with or without a port). Anything else means the request reached us under a * name that is not loopback — a rebinding DNS host or a proxy pointed at the * local port — which is the DNS-rebinding / cross-site vector against a * localhost-only service. */

Source from the content-addressed store, hash-verified

1626 * local port — which is the DNS-rebinding / cross-site vector against a
1627 * localhost-only service. */
1628static bool host_is_loopback(const char *host) {
1629 return cbm_http_path_match(host, "localhost") || cbm_http_path_match(host, "localhost:*") ||
1630 cbm_http_path_match(host, "127.0.0.1") || cbm_http_path_match(host, "127.0.0.1:*") ||
1631 cbm_http_path_match(host, "[::1]") || cbm_http_path_match(host, "[::1]:*");
1632}
1633
1634static void dispatch_request(cbm_http_server_t *srv, cbm_http_conn_t *c,
1635 const cbm_http_req_t *req) {

Callers 1

dispatch_requestFunction · 0.85

Calls 1

cbm_http_path_matchFunction · 0.85

Tested by

no test coverage detected