luvit/luvit

url.parse and url.format doesn't behave correctly with whitespaces

Bilal2453 opened this issue · 6 comments

Nodejs's url lib behavior would be:

Nodejs

Luvit's url lib behavior is:

Luvit


Q: What is the results am i expecting?
A: Same as nodejs results.

I think this might be a difference in url.parse rather than url.format (the url gets run through url.parse at the start of url.format).

I think this might be a difference in url.parse rather than url.format (the url gets run through url.parse at the start of url.format).

Not sure about this, cause

url.format{ href = 'www.google.com/Search?q= a a a', search = '?q= a a a', query = 'q= a a a', path = 'www.google.com/Search?q= a a a', pathname = 'www.google.com/Search' }

would result the same

Strange, I don't see where that would be happening in the node implementation:

https://github.com/nodejs/node/blob/e767ed0558a17b87e543b79d1f842821fbdb8e6b/lib/url.js#L575-L660

i believe it is the encodeStr part which is defined here

That only affects the auth portion (the user:pass of http://user:pass@blah.com)

couldn't we just pass the pathname encoding part ?
as spaces in there are invalid anyways, and just implementing that cause nodejs do too doesn't make that much sense.

the queries are probably encoded at the querystring part tho.