-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[Uri] Add UriScheme Properties: SSH, FTPS, SFTP, WS, WSS #35180
Comments
Tagging subscribers to this area: @dotnet/ncl |
I'm okay with adding these APIs. We should look to see if any other common schemes could be added at the same time. @MihaZupan what do you think? |
I think it makes sense adding them. Ws, Wss and Telnet already exist, just aren't publicly exposed. The idea of this list of schemes is that Uri has built-in knowledge of them to provide validation and avoid an allocation of the scheme string when parsing. Should any other schemes be considered? |
IANA maintains a list of all official URI schemes. Surprisingly, |
So what is the value of these APIs? Just to save 1 memory allocation? Is it really worth it? |
No, this is to provide a list of common well-known Uri schemes (akin to MediaTypeNames #1489). Whether to use the optimization of saving the scheme allocation is completely up to Uri - an implementation detail that currently holds true for schemes in this list (and ws, wss, telnet). |
@ArthurHNL I've edited your post with the proposal template and the API has been added to the review backlog. |
namespace System
{
public partial class Uri
{
public static readonly string UriSchemeWs;
public static readonly string UriSchemeWss;
public static readonly string UriSchemeSsh;
public static readonly string UriSchemeTelnet;
public static readonly string UriSchemeSftp;
public static readonly string UriSchemeFtps;
}
} |
Hey, I just wanted to let you know that I began working on this in #43375. I’m still struggling a bit with the build system but will add tests later. I would be happy about some early feedback though! |
Thanks @poke, let me assign the issue to you. Please ask questions if you have any! |
The PR was merged so this issue can be closed 😊 |
Thanks! |
Currently, the
System.Uri
class has static fields for the Scheme part of a URI of common protocols:UriSchemeFile
UriSchemeFtp
UriSchemeGopher
UriSchemeHttp
UriSchemeHttps
UriSchemeMailto
UriSchemeNetPipe
UriSchemeNetTcp
UriSchemeNews
UriSchemeNntp
I, however, think that this list is out of date and that the following URI Schemes would be a good addition for the .NET 5 era:
UriSchemeSsh = "ssh"
for secure shell access.UriSchemeFtps = "ftps"
andUriSchemeSftp = "sftp"
for secure filetransfer.UriSchemeWs = "ws"
andUriSchemeWss = "wss"
for (secure) websockets.UriSchemeTelnet = "telnet"
might be considered for interaction with legacy systems.Proposal
Extend the list of well-known Uri schemes with more commonly used schemes.
The text was updated successfully, but these errors were encountered: