Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in parsing URLs #50

Closed
dzrdmwjx opened this issue Apr 9, 2016 · 7 comments
Closed

Bug in parsing URLs #50

dzrdmwjx opened this issue Apr 9, 2016 · 7 comments

Comments

@dzrdmwjx
Copy link

dzrdmwjx commented Apr 9, 2016

While playing with some jquery/ajax stuff in node.js, I think I’ve hit a bug in the whatwg-url module used by jsdom. It’s unable to parse certain valid URLs such as: "https://r3---sn-p5qlsnz6.googlevideo.com/" and throws "TypeError: Invalid URL". I think the problem is with the “r3---sn” part of the hostname.

jsdom version: 8.1.0
whatwg-url version: 1.0.1

Following node.js code reproduces the issue:

var url = "https://r3---sn-p5qlsnz6.googlevideo.com/";
parseURL = require("whatwg-url").parseURL;
var result = parseURL(url);

Output:

../node_modules/whatwg-url/lib/url-state-machine.js:1151
    throw new TypeError("Invalid URL");
    ^
TypeError: Invalid URL
    at Object.module.exports.basicURLParse (../node_modules/whatwg-url/lib/url-state-machine.js:1151:11)
    at module.exports.parseURL (../node_modules/whatwg-url/lib/url-state-machine.js:1189:25)
    at Object.<anonymous> (test.js:5:14)

@domenic
Copy link
Member

domenic commented Apr 15, 2016

Thanks; this is waiting on a spec resolution at whatwg/url#53 (comment).

@dzrdmwjx
Copy link
Author

dzrdmwjx commented Oct 5, 2016

Wondering if there's an update on this issue...
If Google's Youtube CDN host names don't meet the spec, can you provide me a hint as to where exactly this check is implemented in the code? I'll try to tweak it in my installation to hopefully make it work with such URLs. Thanks!

@Sebmaster
Copy link
Member

Seems like with the release of Unicode 9 this has been changed and these labels are now allowed. Will update soon-ish. If you can't wait, the validation is in the tr46 package.

@dzrdmwjx
Copy link
Author

dzrdmwjx commented Oct 5, 2016

That was super-easy! Thanks a lot :)

@patrickhulce
Copy link

Any updates here? It's not clear to me how the line referenced in tr46 solves the issue with the above YouTube URLs as it's this check that seems to be the problem. The latest version of whatwg-url (4.7.0) still throws. There was a proposed allowHyphens option in the spec discussion that would skip this check. Can that be made available?

@TimothyGu
Copy link
Member

This should be fixed in #100.

@Sebmaster
Copy link
Member

Yup. Should be fixed with 6.2.0+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants