From e76e83d8c10371af359c5d9dab372286c1d9247a Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 21 Sep 2021 08:32:24 -0400 Subject: [PATCH] moonraker: configure the tornado http client to use the curl backend Signed-off-by: Eric Callahan --- moonraker/components/update_manager/update_manager.py | 2 -- moonraker/moonraker.py | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/moonraker/components/update_manager/update_manager.py b/moonraker/components/update_manager/update_manager.py index 559ea04..6603b2d 100644 --- a/moonraker/components/update_manager/update_manager.py +++ b/moonraker/components/update_manager/update_manager.py @@ -460,8 +460,6 @@ class CommandHelper: self.scmd_error = shell_cmd.error self.build_shell_command = shell_cmd.build_shell_command self.pkg_updater: Optional[PackageDeploy] = None - - AsyncHTTPClient.configure(None, defaults=dict(user_agent="Moonraker")) self.http_client = AsyncHTTPClient() self.github_request_cache: Dict[str, CachedGithubResponse] = {} diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index c86a768..8cfbf14 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -7,7 +7,6 @@ from __future__ import annotations import argparse -from asyncio.events import new_event_loop import sys import importlib import os @@ -21,6 +20,7 @@ import confighelper import utils import asyncio from tornado import iostream +from tornado.httpclient import AsyncHTTPClient from eventloop import EventLoop from app import MoonrakerApp from utils import ServerError, SentinelClass @@ -56,6 +56,11 @@ CORE_COMPONENTS = [ SENTINEL = SentinelClass.get_instance() +# Configure the http client to use the pycurl based implementation +AsyncHTTPClient.configure( + "tornado.curl_httpclient.CurlAsyncHTTPClient", + defaults=dict(user_agent="Moonraker")) + class Server: error = ServerError def __init__(self,