Closed gc-victor closed 3 months ago
Thanks! I see that port should also not be included if it's the protocols default port. Taking a look
You are right!
I have checked it again and I think the best option should be:
&self.protocol, user_info, &self.host, &self.pathname, &search, &hash
Either option will work, but using "host", the "port" part of the function adding the ":" can be removed.
Example:
const url = new URL("https://developer.mozilla.org:443/en-US/docs/Web/API/URL/host");
console.log(url.toString()) // https://developer.mozilla.org/en-US/docs/Web/API/URL/host
console.log(url.host) // developer.mozilla.org
console.log(url.port) // empty-string
References: https://developer.mozilla.org/en-US/docs/Web/API/URL/toString https://url.spec.whatwg.org/#url-serializing https://url.spec.whatwg.org/#url-miscellaneous
In the URL to_string method, there is a bug in line 115:
https://github.com/awslabs/llrt/blob/808084b8cbef50218be3a17b110e8c438490e013/src/http/url.rs#L115
Should be:
&self.protocol, user_info, &self.hostname, port, &self.pathname, &search, &hash
Should be changed
&self.host
by&self.hostname
.Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/host https://developer.mozilla.org/en-US/docs/Web/API/URL/hostname