It might be nicer to use environment variables rather than python string
global variables, for example how Python does it:

$ http_proxy=http://10.0.0.1 python -c "import urllib; print
urllib.getproxies()"
{'http': 'http://10.0.0.1'}

We could also get fancier and have OS specific lookup like Python does for
OS X and Windows as a fallback:

https://docs.python.org/2/library/urllib.html#urllib.getproxies


On Thu, Feb 4, 2016 at 8:48 AM, Jon Harper <jon.harpe...@gmail.com> wrote:

> Hi list,
> I'm planning to add http proxy support to http.client. Here's the API
> I thought of, please feel free to give some feedback :)
>
> - add a "proxy" slot to the request object. (Or maybe subclass request
> as client-request and only add that slot to client ? I think that
> would be better for maintenance, but it's a bigger change. What do you
> think ?)
>
> - use string global variables (*not* SYMBOL:, so that one can set it
> from the command line) or set the request slot directly so that one
> can do:
> ./factor -http.proxy=http://localhost:3128
> or "http://localhost:3128"; "http.proxy" set-global
> or "http://localhost:3128"; "http.proxy" [ ... http-get ] with-variable
> or <request> ... URL" http://localhost:3128"; >>proxy
>
> - the "http.proxy", "https.proxy" and "no_proxy" variables are used to
> fill the proxy slot of the request when using  <client-request> (so
> http-get, etc all have it)
>
> - use the "http_proxy" "https_proxy" "no_proxy" environnement variable
> as a last resort. I don't know about windows and macosx ?
>
> As far as the code for *http* (not https) access goes, I think the
> following patch is all that there is to do (it's missing checking the
> non proxy host list, and setting the http or https proxy depending on
> the url) ? http://paste.factorcode.org/paste?id=3826
>
> For https, I need to do an HTTP connect first, then send regular http
> request I think. Will try that later.
>
> Cheers,
> Jon
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to