-
Notifications
You must be signed in to change notification settings - Fork 29
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
http.request(url.parse(href)) fails #5
Comments
I can fix this on saturday. Those properties simply need to be changed from lazy to eager like they are in node url.
|
yeah it's not "supposed" to be the parsed object, but it's designed to be compatible with them like with |
Node's code is using Object.keys to copy the URL's properties to the plain options object. But the properties in this implementation are actually getters on the prototype so they are not picked up by that. https://github.com/joyent/node/blob/master/lib/_http_agent.js#L291-L294 https://github.com/joyent/node/blob/master/lib/util.js#L584-L594 |
oh so why not just make the getters enumerable? would that work? |
Well no, because |
errr right. forgot this was a prototype. i should look at code more before speaking :P |
So turns out it's not actually that much performance lost if they were normal eager properties (400k -> 230k parses per second on the benchmark). However by now refactoring is probably going to mean full rewrite level of effort (damn me for not doing it on that saturday I promised). |
@petkaantonov i would wait to see what the io.js tc decides on the issue above. might save you some work :) i like the current implementation personally |
should be fixed in iojs :D |
i'm not totally sure what's going on, but if i use this parser,
url.parse(href)
is no longer a valid object to pass to node'shttp.request()
. just from looking at the difference, it looks like you don't set thepath
andhref
property on the parsed object, whichhttp.request()
might need.i just stopped using this module - too lazy to debug right now.
The text was updated successfully, but these errors were encountered: