http.py (salt-3002.1) | : | http.py (salt-3002.2) | ||
---|---|---|---|---|
skipping to change at line 564 | skipping to change at line 564 | |||
if proxy_password: | if proxy_password: | |||
# tornado requires a str, cannot be unicode str in py2 | # tornado requires a str, cannot be unicode str in py2 | |||
proxy_password = salt.utils.stringutils.to_str(proxy_password) | proxy_password = salt.utils.stringutils.to_str(proxy_password) | |||
no_proxy = opts.get("no_proxy", []) | no_proxy = opts.get("no_proxy", []) | |||
# Since tornado doesnt support no_proxy, we'll always hand it empty prox ies or valid ones | # Since tornado doesnt support no_proxy, we'll always hand it empty prox ies or valid ones | |||
# except we remove the valid ones if a url has a no_proxy hostname in it | # except we remove the valid ones if a url has a no_proxy hostname in it | |||
if urlparse(url_full).hostname in no_proxy: | if urlparse(url_full).hostname in no_proxy: | |||
proxy_host = None | proxy_host = None | |||
proxy_port = None | proxy_port = None | |||
proxy_username = None | ||||
proxy_password = None | ||||
# We want to use curl_http if we have a proxy defined | # We want to use curl_http if we have a proxy defined | |||
if proxy_host and proxy_port: | if proxy_host and proxy_port: | |||
if HAS_CURL_HTTPCLIENT is False: | if HAS_CURL_HTTPCLIENT is False: | |||
ret["error"] = ( | ret["error"] = ( | |||
"proxy_host and proxy_port has been set. This requires pycur l and tornado, " | "proxy_host and proxy_port has been set. This requires pycur l and tornado, " | |||
"but the libraries does not seem to be installed" | "but the libraries does not seem to be installed" | |||
) | ) | |||
log.error(ret["error"]) | log.error(ret["error"]) | |||
return ret | return ret | |||
salt.ext.tornado.httpclient.AsyncHTTPClient.configure( | salt.ext.tornado.httpclient.AsyncHTTPClient.configure( | |||
"tornado.curl_httpclient.CurlAsyncHTTPClient" | "tornado.curl_httpclient.CurlAsyncHTTPClient" | |||
) | ) | |||
client_argspec = salt.utils.args.get_function_argspec( | client_argspec = salt.utils.args.get_function_argspec( | |||
salt.ext.tornado.curl_httpclient.CurlAsyncHTTPClient.initialize | salt.ext.tornado.curl_httpclient.CurlAsyncHTTPClient.initialize | |||
) | ) | |||
else: | else: | |||
salt.ext.tornado.httpclient.AsyncHTTPClient.configure(None) | ||||
client_argspec = salt.utils.args.get_function_argspec( | client_argspec = salt.utils.args.get_function_argspec( | |||
salt.ext.tornado.simple_httpclient.SimpleAsyncHTTPClient.initial ize | salt.ext.tornado.simple_httpclient.SimpleAsyncHTTPClient.initial ize | |||
) | ) | |||
supports_max_body_size = "max_body_size" in client_argspec.args | supports_max_body_size = "max_body_size" in client_argspec.args | |||
req_kwargs.update( | req_kwargs.update( | |||
{ | { | |||
"method": method, | "method": method, | |||
"headers": header_dict, | "headers": header_dict, | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added |