Stop accessing the maybe-deprecated Request.channel attribute

This commit is contained in:
Jean-Paul Calderone 2020-01-17 11:45:08 -05:00
parent d5d507a385
commit 5dd355fbfa
2 changed files with 4 additions and 6 deletions
setup.py
src/allmydata

View File

@ -88,6 +88,9 @@ install_requires = [
# bcrypt. It is nice to avoid that if the user ends up with an older
# version of Twisted. That's hard to express except by using the extra.
#
# * Twisted 18.4.0 adds `client` and `host` attributes to `Request` in the
# * initializer, needed by logic in our custom `Request` subclass.
#
# In a perfect world, Twisted[conch] would be a dependency of an "sftp"
# extra. However, pip fails to resolve the dependencies all
# dependencies when asked for Twisted[tls] *and* Twisted[conch].
@ -97,7 +100,7 @@ install_requires = [
# `pip install tahoe-lafs[sftp]` would not install requirements
# specified by Twisted[conch]. Since this would be the *whole point* of
# an sftp extra in Tahoe-LAFS, there is no point in having one.
"Twisted[tls,conch] >= 16.6.0",
"Twisted[tls,conch] >= 18.4.0",
# We need Nevow >= 0.11.1 which can be installed using pip.
"Nevow >= 0.11.1",

View File

@ -49,11 +49,6 @@ class MyRequest(appserver.NevowRequest, object):
self.path, argstring = x
self.args = parse_qs(argstring, 1)
# cache the client and server information, we'll need this later to be
# serialized and sent with the request so CGIs will work remotely
self.client = self.channel.transport.getPeer()
self.host = self.channel.transport.getHost()
# Adding security headers. These will be sent for *all* HTTP requests.
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
self.responseHeaders.setRawHeaders("X-Frame-Options", ["DENY"])