Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse named pipe endpoint from URL with BindingAddress #45056

Closed
JamesNK opened this issue Nov 13, 2022 · 5 comments
Closed

Parse named pipe endpoint from URL with BindingAddress #45056

JamesNK opened this issue Nov 13, 2022 · 5 comments
Labels
api-approved API was approved in API review, it can be implemented area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Comments

@JamesNK
Copy link
Member

JamesNK commented Nov 13, 2022

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

@JamesNK JamesNK added area-runtime api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews labels Nov 13, 2022
@ghost
Copy link

ghost commented Nov 13, 2022

Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:

  • The PR contains changes to the reference-assembly that describe the API change. Or, you have included a snippet of reference-assembly-style code that illustrates the API change.
  • The PR describes the impact to users, both positive (useful new APIs) and negative (breaking changes).
  • Someone is assigned to "champion" this change in the meeting, and they understand the impact and design of the change.

@Tratcher
Copy link
Member

Or just PipeName or NamedPipe?

@adityamandaleeka adityamandaleeka added this to the .NET 8 Planning milestone Nov 14, 2022
@ghost
Copy link

ghost commented Nov 14, 2022

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@halter73
Copy link
Member

halter73 commented Dec 8, 2022

API Review Notes:

  1. Is "http://pipe:PipeName" ambiguous with a normal HTTP server an port? And a pipe have a fully numeric name? Yes.
  • Should we require a forward slash like Unix domain sockets (e.g. "http://unix:/path/to.socket")?
  • We'll get back to this with email API review.
  1. NamedPipePath isn't really a path. Let's use "NamedPipeName".
namespace Microsoft.AspNetCore.Http;

public class BindingAddress
{
+    public bool IsNamedPipe { get; }
+    public string NamedPipeName { get; }
}

API Approved!

@halter73 halter73 added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for formal API review - https://github.com/dotnet/apireviews labels Dec 8, 2022
@JamesNK
Copy link
Member Author

JamesNK commented Jun 6, 2023

Done with #44426

@JamesNK JamesNK closed this as completed Jun 6, 2023
@dotnet dotnet locked as resolved and limited conversation to collaborators Jul 6, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

5 participants