mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix #66194: Exchange HTTPClient by AsyncHTTPClient in salt.utils.http
This commit is contained in:
parent
ec63293372
commit
0b92bfdf80
2 changed files with 8 additions and 6 deletions
1
changelog/66330.fixed.md
Normal file
1
changelog/66330.fixed.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
fix #66194: Exchange HTTPClient by AsyncHTTPClient in salt.utils.http
|
|
@ -25,7 +25,7 @@ import zlib
|
||||||
import tornado.httpclient
|
import tornado.httpclient
|
||||||
import tornado.httputil
|
import tornado.httputil
|
||||||
import tornado.simple_httpclient
|
import tornado.simple_httpclient
|
||||||
from tornado.httpclient import HTTPClient
|
from tornado.httpclient import AsyncHTTPClient
|
||||||
|
|
||||||
import salt.config
|
import salt.config
|
||||||
import salt.loader
|
import salt.loader
|
||||||
|
@ -43,6 +43,7 @@ import salt.utils.xmlutil as xml
|
||||||
import salt.utils.yaml
|
import salt.utils.yaml
|
||||||
import salt.version
|
import salt.version
|
||||||
from salt.template import compile_template
|
from salt.template import compile_template
|
||||||
|
from salt.utils.asynchronous import SyncWrapper
|
||||||
from salt.utils.decorators.jinja import jinja_filter
|
from salt.utils.decorators.jinja import jinja_filter
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -598,7 +599,7 @@ def query(
|
||||||
salt.config.DEFAULT_MINION_OPTS["http_request_timeout"],
|
salt.config.DEFAULT_MINION_OPTS["http_request_timeout"],
|
||||||
)
|
)
|
||||||
|
|
||||||
tornado.httpclient.AsyncHTTPClient.configure(None)
|
AsyncHTTPClient.configure(None)
|
||||||
client_argspec = salt.utils.args.get_function_argspec(
|
client_argspec = salt.utils.args.get_function_argspec(
|
||||||
tornado.simple_httpclient.SimpleAsyncHTTPClient.initialize
|
tornado.simple_httpclient.SimpleAsyncHTTPClient.initialize
|
||||||
)
|
)
|
||||||
|
@ -629,10 +630,10 @@ def query(
|
||||||
req_kwargs = salt.utils.data.decode(req_kwargs, to_str=True)
|
req_kwargs = salt.utils.data.decode(req_kwargs, to_str=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
download_client = (
|
download_client = SyncWrapper(
|
||||||
HTTPClient(max_body_size=max_body)
|
AsyncHTTPClient,
|
||||||
if supports_max_body_size
|
kwargs={"max_body_size": max_body} if supports_max_body_size else {},
|
||||||
else HTTPClient()
|
async_methods=["fetch"],
|
||||||
)
|
)
|
||||||
result = download_client.fetch(url_full, **req_kwargs)
|
result = download_client.fetch(url_full, **req_kwargs)
|
||||||
except tornado.httpclient.HTTPError as exc:
|
except tornado.httpclient.HTTPError as exc:
|
||||||
|
|
Loading…
Add table
Reference in a new issue