Method TryNormalize
- Namespace
- MailFathom.Infrastructure.Security.Transport
- Assembly
- MailFathom.Infrastructure.dll
TryNormalize(string?, out string)
Normalizes a configured origin into the form a browser sends.
public static bool TryNormalize(string? configuredValue, out string normalizedOrigin)
Parameters
configuredValuestringThe configured origin, for example
https://client.example.test.normalizedOriginstringThe serialized origin when the value is accepted; otherwise an empty string.
Returns
Remarks
A browser sends the serialized origin of RFC 6454: a lowercase scheme and host, and the port only when it is not
the scheme's default. Configuration is normalized to that same form so a comparison is an equality test rather
than a set of special cases, and so https://Client.Example.Test:443/ and https://client.example.test
cannot be two different entries in one list. A path, a query, a fragment, or user information means the operator
wrote a URL where an origin belongs, and is refused rather than silently discarded.