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

Function origin_is_same_server

src/ui/http_server.c:97–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95static char g_cors_html[512]; /* CORS + Content-Type: text/html */
96
97static bool origin_is_same_server(const char *origin, int port) {
98 char expected[128];
99 int length = snprintf(expected, sizeof(expected), "http://127.0.0.1:%d", port);
100 if (length > 0 && (size_t)length < sizeof(expected) && strcmp(origin, expected) == 0)
101 return true;
102 length = snprintf(expected, sizeof(expected), "http://localhost:%d", port);
103 return length > 0 && (size_t)length < sizeof(expected) && strcmp(origin, expected) == 0;
104}
105
106static bool origin_matches_host(const char *origin, const char *host, int port) {
107 /* Two literal loopback forms only — spelled out so the static URL audit

Callers 2

update_corsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected