# HG changeset patch # User Marcin Kuzminski # Date 2016-06-28 10:41:11 # Node ID 1c30a359a38701ef29f35c5627627a62de3eba04 # Parent f9e2ba9bf4f9fc421ec58cc5d4041948d6b90429 # Parent 5d91eb8d64e238590427691d741c2b0a17976d2e merged stable into default diff --git a/rhodecode/lib/middleware/simplesvn.py b/rhodecode/lib/middleware/simplesvn.py --- a/rhodecode/lib/middleware/simplesvn.py +++ b/rhodecode/lib/middleware/simplesvn.py @@ -39,10 +39,10 @@ class SimpleSvnApp(object): request_headers = self._get_request_headers(environ) data = environ['wsgi.input'] - # johbo: On Gunicorn, we end up with a 415 response if we pass data - # to requests. I think the request is usually without payload, still - # reading the data to be on the safe side. - if environ['REQUEST_METHOD'] == 'MKCOL': + # johbo: Avoid that we end up with sending the request in chunked + # transfer encoding (mainly on Gunicorn). If we know the content + # length, then we should transfer the payload in one request. + if environ['REQUEST_METHOD'] == 'MKCOL' or 'CONTENT_LENGTH' in environ: data = data.read() response = requests.request( diff --git a/rhodecode/tests/lib/middleware/test_simplesvn.py b/rhodecode/tests/lib/middleware/test_simplesvn.py --- a/rhodecode/tests/lib/middleware/test_simplesvn.py +++ b/rhodecode/tests/lib/middleware/test_simplesvn.py @@ -178,7 +178,7 @@ class TestSimpleSvnApp(object): ] request_mock.assert_called_once_with( self.environment['REQUEST_METHOD'], expected_url, - data=self.wsgi_input, headers=expected_request_headers) + data=self.data, headers=expected_request_headers) response_mock.iter_content.assert_called_once_with(chunk_size=1024) args, _ = start_response.call_args assert args[0] == '200 OK'