-
Notifications
You must be signed in to change notification settings - Fork 41
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
node-xhr2 behind a proxy - food for thoughts #1
Comments
How about using Would this work? |
This is what I had in mind: In my locally modified xhr2, this is what I am doing, with the following change:
If you are Ok with this, then I'll move forward & propose a patch (likely tomorrow in my timezone) |
Just uploaded #2 |
Thank you for #2, I merged it! How would you feel about a This way, you can use the following in your code that uses dropbox.js Dropbox.Xhr.Request.nodejsSetAgents(....) The nice thing about this approach is that if dropbox.js ever switches to another XHR library, proxy-setting code will fail right away during development, instead of silently ignoring the agent-related properties. |
In my local copy of Dropbox-js, I rather added a dependency on node-tunnel & gave additional Client instanciation parameter then passed down to xhr2. But I admit that I could rather leaver Dropbox-js un-modified & use the shortcut you propose. (1) Less code is always better than the opposite and (2) that lets dropbox-js of an additional dependency. I think that the additional interface you propose is fine, but I would rather let you implent it, if you do not mind. |
Sweet, I'll get that in soon, and I will release 0.0.4 once I get some tests for events in. |
I hope this works now! |
I am working on this topic right now.
Browser's XMLHttpRequest objects do not have an API to set an egress proxy, because everything is cabled by the Browser's internals. Node-speaking, the HTTP & HTTPS Agents are managed by the Browser, not by the XMLHttpRequest root object.
I think it would be good to keep the same principles, by adding a
setAgents
method (or anagents
construction time-option) rather than asetProxy
. The HTTP and/or HTTPS agents would be created by the upper layer (dropbox-js in this case), depending on the needs.Opinion?
The text was updated successfully, but these errors were encountered: