Show More
@@ -127,17 +127,32 b' class VcsHttpProxy(object):' | |||
|
127 | 127 | |
|
128 | 128 | |
|
129 | 129 | def _maybe_stream_request(environ): |
|
130 | if environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked': | |
|
130 | path = environ['PATH_INFO'] | |
|
131 | stream = _is_request_chunked(environ) | |
|
132 | log.debug('handling request `%s` with stream support: %s', path, stream) | |
|
133 | ||
|
134 | if stream: | |
|
131 | 135 | return environ['wsgi.input'] |
|
132 | 136 | else: |
|
133 | 137 | return environ['wsgi.input'].read() |
|
134 | 138 | |
|
135 | 139 | |
|
140 | def _is_request_chunked(environ): | |
|
141 | stream = environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked' | |
|
142 | if not stream: | |
|
143 | # git lfs should stream for PUT requests which are upload | |
|
144 | stream = ('git-lfs' in environ.get('HTTP_USER_AGENT', '') | |
|
145 | and environ['REQUEST_METHOD'] == 'PUT') | |
|
146 | return stream | |
|
147 | ||
|
148 | ||
|
136 | 149 | def _maybe_stream_response(response): |
|
137 | 150 | """ |
|
138 | 151 | Try to generate chunks from the response if it is chunked. |
|
139 | 152 | """ |
|
140 |
|
|
|
153 | stream = _is_chunked(response) | |
|
154 | log.debug('returning response with stream: %s', stream) | |
|
155 | if stream: | |
|
141 | 156 | return response.raw.read_chunked() |
|
142 | 157 | else: |
|
143 | 158 | return [response.content] |
General Comments 0
You need to be logged in to leave comments.
Login now