| 95 | static char g_cors_html[512]; /* CORS + Content-Type: text/html */ |
| 96 | |
| 97 | static 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 | |
| 106 | static 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 |
no outgoing calls
no test coverage detected