# HG changeset patch # User Marcin Kuzminski # Date 2017-07-26 14:19:06 # Node ID 2c6364ff262901352ed50525a418d50c45a8d14d # Parent 062a6c2ddf4b22724b3f07ebb1650672d822981d events: make sure we propagate our dummy request with proper application_url. - handles proper proxy prefix - handles https and reverse proxies diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -534,9 +534,13 @@ def add_events_routes(config): pattern='/{repo_name}/files/{commit_id}/{f_path}') -def bootstrap_request(): +def bootstrap_request(**kwargs): import pyramid.testing - request = pyramid.testing.DummyRequest() + request = pyramid.testing.DummyRequest(**kwargs) + request.application_url = kwargs.pop('application_url', 'http://example.com') + request.host = kwargs.pop('host', 'example.com:80') + request.domain = kwargs.pop('domain', 'example.com') + config = pyramid.testing.setUp(request=request) add_events_routes(config) diff --git a/rhodecode/lib/hooks_daemon.py b/rhodecode/lib/hooks_daemon.py --- a/rhodecode/lib/hooks_daemon.py +++ b/rhodecode/lib/hooks_daemon.py @@ -213,7 +213,8 @@ class Hooks(object): extras = AttributeDict(extras) pylons_router = get_routes_generator_for_server_url(extras.server_url) pylons.url._push_object(pylons_router) - extras.request = bootstrap_request() + extras.request = bootstrap_request( + application_url=extras['server_url']) try: result = hook(extras)