# HG changeset patch # User Marcin Kuzminski # Date 2017-04-18 07:31:49 # Node ID ae28d33d97c2329aa9d3544c25991454f168dd19 # Parent bdf7d7ec9accc7af74a93456c22ba0bd24be9a74 http-app: simplify detection of chunked encoding. - since we now properly use chunked requests git client reports this in nicer way. we no longer need to rely on hacks to detect chunked streams. diff --git a/rhodecode/lib/middleware/utils/scm_app_http.py b/rhodecode/lib/middleware/utils/scm_app_http.py --- a/rhodecode/lib/middleware/utils/scm_app_http.py +++ b/rhodecode/lib/middleware/utils/scm_app_http.py @@ -126,6 +126,11 @@ class VcsHttpProxy(object): return _maybe_stream_response(response) +def _is_request_chunked(environ): + stream = environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked' + return stream + + def _maybe_stream_request(environ): path = environ['PATH_INFO'] stream = _is_request_chunked(environ) @@ -137,15 +142,6 @@ def _maybe_stream_request(environ): return environ['wsgi.input'].read() -def _is_request_chunked(environ): - stream = environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked' - if not stream: - # git lfs should stream for PUT requests which are upload - stream = ('git-lfs' in environ.get('HTTP_USER_AGENT', '') - and environ['REQUEST_METHOD'] == 'PUT') - return stream - - def _maybe_stream_response(response): """ Try to generate chunks from the response if it is chunked.