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:79–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77static char g_cors_json[512]; /* CORS + Content-Type: application/json */
78
79static bool origin_is_same_server(const char *origin, int port) {
80 char expected[128];
81 int length = snprintf(expected, sizeof(expected), "http://127.0.0.1:%d", port);
82 if (length > 0 && (size_t)length < sizeof(expected) && strcmp(origin, expected) == 0)
83 return true;
84 length = snprintf(expected, sizeof(expected), "http://localhost:%d", port);
85 return length > 0 && (size_t)length < sizeof(expected) && strcmp(origin, expected) == 0;
86}
87
88static bool origin_matches_host(const char *origin, const char *host, int port) {
89 /* 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