AddressValidatingHttpMessageHandler Class
The message-handler half of protecting a server-initiated request whose address came from outside: it refuses redirects and re-checks the address immediately before every send, leaving only the policy - which addresses are refused - to the derived handler.
public abstract class AddressValidatingHttpMessageHandler : System.Net.Http.DelegatingHandlerInheritance System.Object → System.Net.Http.HttpMessageHandler → System.Net.Http.DelegatingHandler → AddressValidatingHttpMessageHandler
Remarks
Two properties make this the right place for the check rather than a pre-flight in front of the client.
Redirects are not followed. A receiver that answers a delivery with a 3xx to an internal address would otherwise have the request re-sent there, past any address the caller vetted, so this is the difference between a check and a bypass. With the follow disabled the 3xx comes back as an ordinary non-success response and the caller decides what to do with it.
The address is judged here, one call before the connection, rather than only when the request was scheduled. A name that resolved to a public address a moment ago can resolve to an internal one now, so the resolution a derived handler performs in Abblix.Utils.AddressValidatingHttpMessageHandler.GuardAsync(System.Uri,System.Threading.CancellationToken) is the one whose answer the socket actually uses.