Closed hkiame closed 4 months ago
Shame that new URL
isn't capable of parsing request.host
unless you feed it some nonsense domain name, making the resulting code a bit more confusing. But I guess since the official Node docs deprecate url.parse
, this is what we have to do.
Closed by https://github.com/marijnh/Eloquent-JavaScript/commit/d7885683626b43145eb763f02622bdfea4d277f6. Not sure why GitHub isn't picking that up automatically.
url.parse() method is discouraged as it uses a non-standard algorithm that can introduce security issues such as host name spoofing and incorrect handling of usernames and passwords. We are encouraged to rather use WHATWG URL API.