c# Uri cannot have asterisk in domain name but Jav

2019-09-16 03:23发布

Hi I am confused by this discrepancy of URI/URL parsing between C#, Java and PHP. For example, I have string url = "http://*.bar.com"

In C#: new Uri(url) will throw a System.UriFormatException error,

But in Java new URL(url) will pass, same as in PHP using parse_url(url)(with $url = "http://*.bar.com")

Is that the C# is wrong or Java & PHP are wrong?

Update: I've consulted this page,even I put string url = "http://%2A.bar.com", the new Uri(url) would fail. But interestingly, string url = "http://foo.domain.com/something/*" will pass new Uri()

标签: java c# php url
0条回答
登录 后发表回答