-
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 constructor cannot parse http://hostname:port/ when hostname is * or + #77464
Comments
As far as I can tell, those are not valid HTTP URIs, so I think it's correct that the Why do you think the current behavior is incorrect? |
I didn't say it's incorrect, I say it should parse it. While it's true that * and + are not valid in a URI, I need the Uri class to support parsing of this, so that I don't have to parse it on my own, or duplicate an entire class just to parse * and + into the host field. |
Tagging the area experts @dotnet/ncl for proper response, please move to runtime if needed |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescription
|
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescription
|
Feature request for System.Uri area owners. |
We've seen similar requests to relax the hostname parsing restrictions in the past (#36595). It is worth noting that RFC 3986 allows such hostnames under the We would be open to relaxing these requirements if there is enough interest in this. |
Duplicate of #64707 |
Description
On the "new Uri(url)" line, the following exception occurred
System.UriFormatException
HResult=0x80131537
Message=Invalid URI: The hostname could not be parsed.
Source=System.Private.Uri
StackTrace:
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at HttpListenerSegments.Program..ctor() in K:\Development\CSharp\HttpListenerSegments\Program.cs:line 18
at HttpListenerSegments.Program.Main(String[] args) in K:\Development\CSharp\HttpListenerSegments\Program.cs:line 79
The Uri constructor should parse * or + into the DnsSafeHost, Host and IdnHost properties/fields (and whatever fields that currently holds the hostname).
.NET Core 2.1
Windows 11
x64
The text was updated successfully, but these errors were encountered: