moonraker: configure the tornado http client to use the curl backend

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-09-21 08:32:24 -04:00
parent 73d3eae8ae
commit e76e83d8c1
2 changed files with 6 additions and 3 deletions

View File

@ -460,8 +460,6 @@ class CommandHelper:
self.scmd_error = shell_cmd.error self.scmd_error = shell_cmd.error
self.build_shell_command = shell_cmd.build_shell_command self.build_shell_command = shell_cmd.build_shell_command
self.pkg_updater: Optional[PackageDeploy] = None self.pkg_updater: Optional[PackageDeploy] = None
AsyncHTTPClient.configure(None, defaults=dict(user_agent="Moonraker"))
self.http_client = AsyncHTTPClient() self.http_client = AsyncHTTPClient()
self.github_request_cache: Dict[str, CachedGithubResponse] = {} self.github_request_cache: Dict[str, CachedGithubResponse] = {}

View File

@ -7,7 +7,6 @@
from __future__ import annotations from __future__ import annotations
import argparse import argparse
from asyncio.events import new_event_loop
import sys import sys
import importlib import importlib
import os import os
@ -21,6 +20,7 @@ import confighelper
import utils import utils
import asyncio import asyncio
from tornado import iostream from tornado import iostream
from tornado.httpclient import AsyncHTTPClient
from eventloop import EventLoop from eventloop import EventLoop
from app import MoonrakerApp from app import MoonrakerApp
from utils import ServerError, SentinelClass from utils import ServerError, SentinelClass
@ -56,6 +56,11 @@ CORE_COMPONENTS = [
SENTINEL = SentinelClass.get_instance() 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: class Server:
error = ServerError error = ServerError
def __init__(self, def __init__(self,