Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

404 correctly on missing paths via NoResource #3022

Merged
merged 1 commit into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions synapse/app/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.appservice")

Expand Down Expand Up @@ -64,7 +64,7 @@ def _listen_http(self, listener_config):
if name == "metrics":
resources[METRICS_PREFIX] = MetricsResource(self)

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/client_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.client_reader")

Expand Down Expand Up @@ -88,7 +88,7 @@ def _listen_http(self, listener_config):
"/_matrix/client/api/v1": resource,
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/event_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.event_creator")

Expand Down Expand Up @@ -104,7 +104,7 @@ def _listen_http(self, listener_config):
"/_matrix/client/api/v1": resource,
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/federation_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.federation_reader")

Expand Down Expand Up @@ -77,7 +77,7 @@ def _listen_http(self, listener_config):
FEDERATION_PREFIX: TransportLayerServer(self),
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/federation_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import defer, reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.federation_sender")

Expand Down Expand Up @@ -91,7 +91,7 @@ def _listen_http(self, listener_config):
if name == "metrics":
resources[METRICS_PREFIX] = MetricsResource(self)

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/frontend_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import defer, reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.frontend_proxy")

Expand Down Expand Up @@ -142,7 +142,7 @@ def _listen_http(self, listener_config):
"/_matrix/client/api/v1": resource,
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from synapse.util.versionstring import get_version_string
from twisted.application import service
from twisted.internet import defer, reactor
from twisted.web.resource import EncodingResourceWrapper, Resource
from twisted.web.resource import EncodingResourceWrapper, NoResource
from twisted.web.server import GzipEncoderFactory
from twisted.web.static import File

Expand Down Expand Up @@ -126,7 +126,7 @@ def _listener_http(self, config, listener_config):
if WEB_CLIENT_PREFIX in resources:
root_resource = RootRedirect(WEB_CLIENT_PREFIX)
else:
root_resource = Resource()
root_resource = NoResource()

root_resource = create_resource_tree(resources, root_resource)

Expand Down
4 changes: 2 additions & 2 deletions synapse/app/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.media_repository")

Expand Down Expand Up @@ -84,7 +84,7 @@ def _listen_http(self, listener_config):
),
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import defer, reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.pusher")

Expand Down Expand Up @@ -94,7 +94,7 @@ def _listen_http(self, listener_config):
if name == "metrics":
resources[METRICS_PREFIX] = MetricsResource(self)

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/synchrotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from synapse.util.stringutils import random_string
from synapse.util.versionstring import get_version_string
from twisted.internet import defer, reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.synchrotron")

Expand Down Expand Up @@ -269,7 +269,7 @@ def _listen_http(self, listener_config):
"/_matrix/client/api/v1": resource,
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/app/user_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from synapse.util.manhole import manhole
from synapse.util.versionstring import get_version_string
from twisted.internet import reactor
from twisted.web.resource import Resource
from twisted.web.resource import NoResource

logger = logging.getLogger("synapse.app.user_dir")

Expand Down Expand Up @@ -116,7 +116,7 @@ def _listen_http(self, listener_config):
"/_matrix/client/api/v1": resource,
})

root_resource = create_resource_tree(resources, Resource())
root_resource = create_resource_tree(resources, NoResource())

_base.listen_tcp(
bind_addresses,
Expand Down
4 changes: 2 additions & 2 deletions synapse/util/httpresourcetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from twisted.web.resource import Resource
from twisted.web.resource import NoResource

import logging

Expand Down Expand Up @@ -45,7 +45,7 @@ def create_resource_tree(desired_tree, root_resource):
for path_seg in full_path.split('/')[1:-1]:
if path_seg not in last_resource.listNames():
# resource doesn't exist, so make a "dummy resource"
child_resource = Resource()
child_resource = NoResource()
last_resource.putChild(path_seg, child_resource)
res_id = _resource_id(last_resource, path_seg)
resource_mappings[res_id] = child_resource
Expand Down