##// END OF EJS Templates
http-proto: in case incoming requests come in as chunked stream the data to VCSServer....
marcink -
r1434:59cf3775 stable
parent child Browse files
Show More
@@ -93,7 +93,6 b' class VcsHttpProxy(object):'
93 'X-RC-Locked-Status-Code': rhodecode.CONFIG.get('lock_ret_code')
93 'X-RC-Locked-Status-Code': rhodecode.CONFIG.get('lock_ret_code')
94 })
94 })
95
95
96 data = environ['wsgi.input'].read()
97 method = environ['REQUEST_METHOD']
96 method = environ['REQUEST_METHOD']
98
97
99 # Preserve the query string
98 # Preserve the query string
@@ -104,7 +103,7 b' class VcsHttpProxy(object):'
104
103
105 response = session.request(
104 response = session.request(
106 method, url,
105 method, url,
107 data=data,
106 data=_maybe_stream_request(environ),
108 headers=request_headers,
107 headers=request_headers,
109 stream=True)
108 stream=True)
110
109
@@ -120,10 +119,17 b' class VcsHttpProxy(object):'
120 reason_phrase=response.reason)
119 reason_phrase=response.reason)
121
120
122 start_response(status, response_headers)
121 start_response(status, response_headers)
123 return _maybe_stream(response)
122 return _maybe_stream_response(response)
124
123
125
124
126 def _maybe_stream(response):
125 def _maybe_stream_request(environ):
126 if environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked':
127 return environ['wsgi.input']
128 else:
129 return environ['wsgi.input'].read()
130
131
132 def _maybe_stream_response(response):
127 """
133 """
128 Try to generate chunks from the response if it is chunked.
134 Try to generate chunks from the response if it is chunked.
129 """
135 """
General Comments 0
You need to be logged in to leave comments. Login now