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

Too much intimacy between this, request, and http.Agent #9

Open
isaacs opened this issue May 22, 2013 · 4 comments
Open

Too much intimacy between this, request, and http.Agent #9

isaacs opened this issue May 22, 2013 · 4 comments

Comments

@isaacs
Copy link

isaacs commented May 22, 2013

ForeverAgent has a addRequest method, and also an addRequestnoreuse method. This overrides the http.Agent's addRequest method.

I'd really like to change the signature of agent.addRequest so that it takes an options object rather than a set of positional arguments. The reason for this is that it would allow us to reuse more of the code between http and https, where there are many more things that separate reusability buckets than just the host and port. You can reuse connections with https, but only if all the following fields are matching: host, port, ca, cert, ciphers, key, passphrase, pfx, and rejectUnauthorized.

However, because request and forever-agent use this undocumented API, we can't change it, and it'll break on the upgrade to 0.12. Making things worse, you can't chnage forever-agent's API, because request dives into its guts and sniffs for a addRequestnoreuse method.

Is there any way to refactor this so that it doesn't rely on internals in this way? What if I open source the new 0.12 http.Agent that has built-in keepAlive if you turn it on?

@mikeal
Copy link
Member

mikeal commented May 22, 2013

I would be in favor of a direction that obviates this package rather than modifies it since all these features are going to be in core soon anyway.

@isaacs
Copy link
Author

isaacs commented May 22, 2013

Sure, but I'm mostly concerned that 0.12 is going to bust request and make headaches for both of us.

What if I open source the new 0.12 http.Agent that has built-in keepAlive if you turn it on?

Hah, obviously I meant "push to npm", not "open source", since Node is all open source already :)

@mikeal
Copy link
Member

mikeal commented May 22, 2013

That's what I figured.

I'll adopt it as the default Agent in request once you release it.

-Mikeal

On May 21, 2013, at 10:39PM, "Isaac Z. Schlueter" [email protected] wrote:

Sure, but I'm mostly concerned that 0.12 is going to bust request and make headaches for both of us.

What if I open source the new 0.12 http.Agent that has built-in keepAlive if you turn it on?

Hah, obviously I meant "push to npm", not "open source", since Node is all open source already :)


Reply to this email directly or view it on GitHub.

@isaacs
Copy link
Author

isaacs commented May 22, 2013

Cool, then I will go ahead and make the breaking change. I'm pretty sure that the API in question is only used by you anyway :)

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

2 participants