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

Avoid Uri creation in HttpRuleParser.IsValidHostName #63640

Open
geoffkizer opened this issue Jan 11, 2022 · 3 comments
Open

Avoid Uri creation in HttpRuleParser.IsValidHostName #63640

geoffkizer opened this issue Jan 11, 2022 · 3 comments

Comments

@geoffkizer
Copy link
Contributor

This function validates the given host name by actually trying to create a Uri object and seeing if it fails. It also has to construct and allocate a string to pass to the Uri.TryCreate method.

We should be able to validate a hostname directly, without actually constructing a Uri.

The main place this is used is when setting the Host property on the request message headers.

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Jan 11, 2022
@ghost
Copy link

ghost commented Jan 11, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

This function validates the given host name by actually trying to create a Uri object and seeing if it fails. It also has to construct and allocate a string to pass to the Uri.TryCreate method.

We should be able to validate a hostname directly, without actually constructing a Uri.

The main place this is used is when setting the Host property on the request message headers.

Author: geoffkizer
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@ghost
Copy link

ghost commented Jan 11, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

This function validates the given host name by actually trying to create a Uri object and seeing if it fails. It also has to construct and allocate a string to pass to the Uri.TryCreate method.

We should be able to validate a hostname directly, without actually constructing a Uri.

The main place this is used is when setting the Host property on the request message headers.

Author: geoffkizer
Assignees: -
Labels:

area-System.Net.Http, untriaged

Milestone: -

@MihaZupan
Copy link
Member

And since the test Uri we use also contains a user info ("u@"), we'll end up allocating a substring for that as well.

@jeffschwMSFT jeffschwMSFT removed the untriaged New issue has not been triaged by the area owner label Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants