Skip to content

Parse named pipe endpoint from URL with BindingAddress #45056

Closed
@JamesNK

Description

@JamesNK

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.

Risks

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved in API review, it can be implementedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions