requests
requests copied to clipboard
Fix the proxy_bypass_registry function all returning true in some cases.
With the context code,i think we should avoid this situation with empty strings,thx!
There's no clear description of a bug, how to reproduce or even tests to show this fixes something. Further you speak of empty strings and are filtering on None which are not the same thing.
The value of proxyOverride is controlled by a third-party program on the computer, so it is not controllable.
For example, when I use fiddler on my computer, this value is <-loopback>;.(Not all computers)
When proxyOverride splits, it's equal to ['<-loopback>', ''].
So re.match('', host, re.I) will return true,that bypassing the proxy.
And filter(function, iterable) is equivalent to the generator expression (item for item in iterable if item) if function is None,that is, all elements of iterable that are false are removed. Ref:https://docs.python.org/3/library/functions.html#filter
I think should be avoided for code robustness.
The value of proxyOverride is controlled by a third-party program on the computer, so it is not controllable. For example, when I use fiddler on my computer, this value is
<-loopback>;.(Not all computers) When proxyOverride splits, it's equal to['<-loopback>', '']. Sore.match('', host, re.I)will return true,that bypassing the proxy.And filter(function, iterable) is equivalent to the generator expression (item for item in iterable if item) if function is None,that is, all elements of iterable that are false are removed. Ref:https://docs.python.org/3/library/functions.html#filter
I think should be avoided for code robustness.
Yes, I also noticed this situation. This wastes a lot of my time discovering this problem. ProxyOverride sometimes ends with a semicolon and is difficult to reproduce. But it has not yet been merged into the main branch.
The value of proxyOverride is controlled by a third-party program on the computer, so it is not controllable. For example, when I use fiddler on my computer, this value is
<-loopback>;.(Not all computers) When proxyOverride splits, it's equal to['<-loopback>', '']. Sore.match('', host, re.I)will return true,that bypassing the proxy. And filter(function, iterable) is equivalent to the generator expression (item for item in iterable if item) if function is None,that is, all elements of iterable that are false are removed. Ref:https://docs.python.org/3/library/functions.html#filter I think should be avoided for code robustness.Yes, I also noticed this situation. This wastes a lot of my time discovering this problem. ProxyOverride sometimes ends with a semicolon and is difficult to reproduce. But it has not yet been merged into the main branch.
I'm glad someone else is having the same problem as me, but I also hope that no one will waste time on this issue in the future, haha.
@flysee can you add tests for this change so it does not regress?
@flysee can you add tests for this change so it does not regress?
Of course, test cases have been added.