Closed
Description
Background and Motivation
Named pipe endpoints should be parsable from Kestrel url arg.
Proposed API
namespace Microsoft.AspNetCore.Http;
public class BindingAddress
{
+ public bool IsNamedPipe { get; }
+ public string NamedPipePath { get; }
}
Usage Examples
var parsedAddress = BindingAddress.Parse("http://pipe:PipeName");
if (parsedAddress.IsNamedPipe)
{
return new ListenOptions(new NamedPipeEndPoint(parsedAddress.NamedPipePath));
}
Alternative Designs
There are IsUnixPipe
and UnixPipePath
properties already on this type. Is "Named" vs "Unix" clear enough about which is which? We refer to them as name pipes everywhere else.
Named pipes have a format for the name, e.g. \\.\pipe\PipeName
- https://learn.microsoft.com/en-us/windows/win32/ipc/pipe-names. I chose not to use it, and simply anything after pipe:
is the pipe name. This is consistent with unix:/
for UDS and keeps the URL simpler.
If we did use the known format, then the usage example would look like this:
var parsedAddress = BindingAddress.Parse(@"http://\\.\pipe\PipeName");
public string NamedPipePath { get; }
could be changed to public string NamedPipeName { get; }
. NamedPipeName
is a little awkward, but more accurate to named pipe terms.