marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
2.99k stars 790 forks source link

Chapter 20 : use of legacy url.parse is discouraged #569

Closed hkiame closed 4 months ago

hkiame commented 2 years ago

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.

marijnh commented 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.

marijnh commented 4 months ago

Closed by https://github.com/marijnh/Eloquent-JavaScript/commit/d7885683626b43145eb763f02622bdfea4d277f6. Not sure why GitHub isn't picking that up automatically.