The current implementation of the proxy setting in the search function does not handle proxies correctly. Specifically, if a proxy is set with the format http://proxy_host:port, it does not handle https requests to proxy, which is required for Google search.
Related Issues
73
Solution
This PR updates the proxy setting logic to correctly configure the proxy for both http and https protocols when the proxy URL starts with http:// or https://. This ensures that https requests are properly routed through the proxy even when the proxy URL is specified with http://.
Changes Made
Updated the proxy setting logic to configure proxies for both http and https protocols properly.
Old Code
if proxy:
if proxy.startswith("https"):
proxies = {"https": proxy}
else:
proxies = {"http": proxy}
New Code
if proxy.startswith("http://") or proxy.startswith("https://"):
proxies = {
"https": proxy,
"http": proxy
}
Description
The current implementation of the proxy setting in the
search
function does not handle proxies correctly. Specifically, if a proxy is set with the formathttp://proxy_host:port
, it does not handlehttps
requests to proxy, which is required for Google search.Related Issues
73
Solution
This PR updates the proxy setting logic to correctly configure the proxy for both
http
andhttps
protocols when the proxy URL starts withhttp://
orhttps://
. This ensures thathttps
requests are properly routed through the proxy even when the proxy URL is specified withhttp://
.Changes Made
Updated the proxy setting logic to configure proxies for both
http
andhttps
protocols properly.Old Code
New Code