Closed aisk closed 8 years ago
Thanks for the report. This ought to be relatively easy to clear up.
Actually this won't be as straightforward as I initially thought. The problem is that requests+urllib3 have already made the decision, prior to wsgi intercept getting involved, to make the socket call to the proxy host (as shown in your kwarg output above). No intercept has been set for that. So even if the code goes to the trouble of removing the unexpected socket_options
keyword, the test code will still not work unless the caller set an intercept for the proxy host too.
I can go ahead and remove the keyword, but it feels like it leaves a bit of a gaping hole that needs to be acknowledged somehow. (the other libraries don't have this problem, more magic from requests...)
Can we add some document to point out that wsgi-intercept don't works with $http_proxy, and check is there http proxy is set when running, then throw a warning exception?
I think most wsgi-intercept use cases don't need proxy, but once it is set, user got a strange exception, and have to dig it into source code to find what happened.
(I have got the same problem one year after this issue was opened, and I've forgot it, then googled the error message and find this issue 😂)
This sounds like a good idea, but let me make sure I understand your suggestion. Your idea is that when running add_wsgi_intercept
the code would check to see if http_proxy
is set in the os.environ
and if so raise either a warning or an exception?
Some questions on that:
add_wsgi_intercept
or when the intercept module is installed?@aisk if you could have a look at #35 and see if it will suit your needs, that would be very helpful. Thanks.
:+1:
and run the requests example, I got this error:
and the kwargs of wsgi_intercept/requests_intercept.py:HTTP_WSGIInterceptor.init is