Class BowireServerUrl

Namespace
Kuestenlogik.Bowire
Assembly
Kuestenlogik.Bowire.dll

Parses Bowire's optional hint@url form for server URLs. A plugin hint tells the discovery + invoke endpoints which protocol plugin to consult — without one Bowire still probes every plugin in turn, which is fine in practice but slow when one of them needs a long network round-trip to discover that the URL isn't theirs (e.g. the gRPC plugin opens an HTTP/2 channel against an HTTP/1.1 GraphQL server and waits for the handshake to time out).

Examples:

  • grpc@https://api.example.com:443 → hint=grpc, url=https://api.example.com:443
  • signalr@https://api.example.com/hubs/chat → hint=signalr, url=https://api.example.com/hubs/chat
  • https://alice:pwd@host.com → no hint, url stays intact (the @ is URI userinfo)
  • https://api.example.com → no hint, url stays intact
  • udp://239.0.13.37:8137 → no hint, the URL scheme itself already routes the plugin
public static class BowireServerUrl
Inheritance
BowireServerUrl
Inherited Members

Methods

Parse(string?)

Split a raw raw server URL into an optional plugin hint and the bare URL. Falls back to (null, raw) when the input doesn't match the hint pattern, so callers can pass the result straight through their existing URL plumbing.

public static (string? PluginHint, string Url) Parse(string? raw)

Parameters

raw string

Returns

(string PluginHint, string Url)

Remarks

Three rules together keep the parse unambiguous against URI userinfo (user:pass@host), bare email-style strings, and arbitrary plugin scheme URLs:

  1. The hint token (everything before the first @) must contain only ASCII letters, digits, or hyphens. Anything with : or / in it is URI userinfo.
  2. The remainder after the @ must contain :// (i.e. look like a URL with a scheme). This rejects bare alice@example.com — that's not a URL at all and should fall through to the plugin's own URL parser.
  3. The hint is otherwise opaque: validation that the hint names an actually-loaded plugin happens at the call site, not here, so adding a new plugin doesn't have to update this helper.

StripHint(string?)

Convenience accessor that returns just the bare URL — equivalent to Parse(raw).Url. Useful where the call site needs only the URL and doesn't care whether a hint was present.

public static string StripHint(string? raw)

Parameters

raw string

Returns

string