delvedor / hpagent

A ready to use http and https agent for working with proxies that keeps connections alive!
MIT License
183 stars 36 forks source link

Add support for proxyRequestOptions #72

Closed mbargiel closed 2 years ago

mbargiel commented 2 years ago

This PR adds a new property to the constructor options, proxyRequestOptions, which allows callers to provide options for the CONNECT request made against the proxy. There are various reasons to do this:

Implements #69 Note: this PR introduces a merge conflict with #71. Whichever lands first will require a manual merge before the other can land.

mbargiel commented 2 years ago

Hi @delvedor ! I see you reviewed #81 which is practically the same as this PR (with subtle differences, and this one has tests) but not this one. Is there anything missing to this one?

mbargiel commented 2 years ago

@delvedor Will do! Expect an update within a day or two.

mbargiel commented 2 years ago

@delvedor See https://github.com/delvedor/hpagent/pull/72/commits/a112371f1fe74858f049eb3e27765f7c591b2ea0. Please note that I defined a single type for the proxyRequestOptions of both agent types because the proxy options and upstream protocol are orthogonal: for instance, you may need to pass custom TLS connect options to a proxy agent of either types HttpProxyAgent or HttpsProxyAgent, since either can be used over an HTTPS proxy connection.

EDIT: Sorry for the force-pushes, I realized the new interface was misnamed. I think I found a relevant name in the end, but I'm open to renaming it if needed.

delvedor commented 2 years ago

Released in v1.1.0, thanks for contributing!