# HG changeset patch # User Marcin Kuzminski # Date 2017-07-28 00:43:24 # Node ID 55f1a7349a7892ad7b69fd610a7d96471b80d8ab # Parent 73f3558e9f337d96026af7f271f9446e39997844 vcsserver: added stream EchoApp for testing diff --git a/vcsserver/echo_stub/echo_app.py b/vcsserver/echo_stub/echo_app.py --- a/vcsserver/echo_stub/echo_app.py +++ b/vcsserver/echo_stub/echo_app.py @@ -26,6 +26,26 @@ class EchoApp(object): return ["ECHO"] +class EchoAppStream(object): + + def __init__(self, repo_path, repo_name, config): + self._repo_path = repo_path + log.info("EchoApp initialized for %s", repo_path) + + def __call__(self, environ, start_response): + log.debug("EchoApp called for %s", self._repo_path) + log.debug("Content-Length: %s", environ.get('CONTENT_LENGTH')) + environ['wsgi.input'].read() + status = '200 OK' + headers = [('Content-Type', 'text/plain')] + start_response(status, headers) + + def generator(): + for _ in xrange(1000000): + yield "ECHO" + return generator() + + def create_app(): """ Allows to run this app directly in a WSGI server.