A host that is a service of the repository: one DNS label or a * ` . .svc...` name whose first label names a Kubernetes Service of * it. Its Route is the path alone, where that service's handler of the path * meets it, as code clients do; any other host -- a download, a * port-forwarded localhost -- stays in the Route, so it never meets a * handler it does not reach. (Not a compose ser
| 3668 | * those after this one in a full run, while a repair holds them already; |
| 3669 | * the QN tells them apart, as a repair's proxies carry no properties.) */ |
| 3670 | static bool sh_http_service(cbm_pipeline_ctx_t *ctx, const char *host) { |
| 3671 | const char *first_dot = strchr(host, '.'); |
| 3672 | const char *svc = first_dot ? strchr(first_dot + SKIP_ONE, '.') : NULL; |
| 3673 | bool dns_form = !first_dot || (svc && sh_starts(svc, ".svc") && |
| 3674 | (svc[strlen(".svc")] == '\0' || svc[strlen(".svc")] == '.')); |
| 3675 | if (!dns_form || strcmp(host, "localhost") == 0) { |
| 3676 | return false; |
| 3677 | } |
| 3678 | char name[CBM_SZ_256]; |
| 3679 | snprintf(name, sizeof(name), "Service/%.*s", |
| 3680 | (int)(first_dot ? (size_t)(first_dot - host) : strlen(host)), host); |
| 3681 | const cbm_gbuf_node_t **nodes = NULL; |
| 3682 | int n = 0; |
| 3683 | if (cbm_gbuf_find_by_name(ctx->gbuf, name, &nodes, &n) != 0) { |
| 3684 | return false; |
| 3685 | } |
| 3686 | for (int i = 0; i < n; i++) { |
| 3687 | if (nodes[i]->label && strcmp(nodes[i]->label, "Resource") == 0 && |
| 3688 | nodes[i]->qualified_name && !strstr(nodes[i]->qualified_name, "::compose/")) { |
| 3689 | return true; |
| 3690 | } |
| 3691 | } |
| 3692 | return false; |
| 3693 | } |
| 3694 | |
| 3695 | /* An HTTP request a script makes: HTTP_CALLS {via: curl | wget, method, |
| 3696 | * url_path, host} to its Route (sh_http_service). */ |
no test coverage detected