Add an exc_info parameter that optionally takes an
exception that is passed to the logging function. This
will log the traceback without an additional logging call.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
When possible record the name of the user that requested the
job. The klippy_api's component now takes an optional user
argument in its "start_print" method. This user is broadcast
in an event after a print request successfully returns.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is necessary to perform a cors check before authenticating
the user to make sure that the headers are set if authentication
fails.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
If the upstream DNS server is not available the call to socket.getfqdn()
will block until a timeout occurs. This blocks Moonraker's event loop,
resulting in carnage.
Call getfqdn() in a thread with a timeout of 5 seconds. In addition,
only request the fqdn if the user has one or more trusted domains
configured. Finally, cache resolved FQDNs for 24 hours to limit
repeated DNS queries.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It is possible that Moonraker cannot bind to an address if its
already in use. Handle bind errors and warn/log when they are
encountered.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Moonraker dynamically registers its routes, so we cannot easily
use the routers provided by tornado.Application. Previously
all routes went through tornado.Application, then went to
our mutable router. This refactor avoids that by having our
mutable router contain the tornadoapp instance, only using
it to provide the application delegate.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>