kriswallsmith/Buzz — pull request #54 by simensen (2012-03-14 19:27:26+00:00)
Title: Proxy Support (revisited)

I am not sure what happened to #17 but it has been sitting for many months without any activity. Recent changes would have likely conflicted with that PR anyway so I made these changes off of master.

Features included:

* Added support for proxies (with tests).
* Added `ProxyUtil` (with tests).
* Added fluent interface for `AbstractClient` options.
* Refactored `AbstractStreamTest` to make creating requests and expected
results DRY.

Ideas behind proxy implementation that either were not accounted for or conflict with the proposed changes in #17:

* System defined proxy should be used by all clients if detected. (`HTTP_PROXY` or
`http_proxy`, in that order)
* Proxy should be able to be specified as a URL (potentially included auth),
not as IP and port independently.
* Proxy should be able to be enabled/disabled explicitly so that the system
proxy can be ignored if needed. (in lieu of implementing `NO_PROXY` which
IMHO is limited anyway)
* Downside to this is that merely calling `->setProxy()` will no longer enable
proxy. This can be changed such that `setProxy()` can flip `proxyEnabled`
to true. *Please let me know if you want to see this changed.*
* cURL does not use `CURLOPT_HTTPPROXYTUNNEL` as that uses `CONNECT` and is
a different behavior from the stream driver.

Happy to discuss changes to this PR or trying to find a way to get this one and #17 playing nicely.