File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
app = Flask (__name__ )
8
8
9
+ @app .before_request
10
+ def fix_transfer_encoding ():
11
+ """
12
+ Sets the "wsgi.input_terminated" environment flag, thus enabling
13
+ Werkzeug to pass chunked requests as streams. The gunicorn server
14
+ should set this, but it's not yet been implemented.
15
+ """
16
+
17
+ transfer_encoding = request .headers .get ("Transfer-Encoding" , None )
18
+ if transfer_encoding == u"chunked" :
19
+ request .environ ["wsgi.input_terminated" ] = True
20
+
9
21
@app .route ("/" , defaults = {"path" : "" }, methods = ["POST" , "GET" ])
10
22
@app .route ("/<path:path>" , methods = ["POST" , "GET" ])
11
23
def main_route (path ):
Original file line number Diff line number Diff line change 8
8
9
9
app = Flask (__name__ )
10
10
11
+ @app .before_request
12
+ def fix_transfer_encoding ():
13
+ """
14
+ Sets the "wsgi.input_terminated" environment flag, thus enabling
15
+ Werkzeug to pass chunked requests as streams. The gunicorn server
16
+ should set this, but it's not yet been implemented.
17
+ """
18
+
19
+ transfer_encoding = request .headers .get ("Transfer-Encoding" , None )
20
+ if transfer_encoding == u"chunked" :
21
+ request .environ ["wsgi.input_terminated" ] = True
22
+
11
23
@app .route ("/" , defaults = {"path" : "" }, methods = ["POST" , "GET" ])
12
24
@app .route ("/<path:path>" , methods = ["POST" , "GET" ])
13
25
def main_route (path ):
Original file line number Diff line number Diff line change 8
8
9
9
app = Flask (__name__ )
10
10
11
+ @app .before_request
12
+ def fix_transfer_encoding ():
13
+ """
14
+ Sets the "wsgi.input_terminated" environment flag, thus enabling
15
+ Werkzeug to pass chunked requests as streams. The gunicorn server
16
+ should set this, but it's not yet been implemented.
17
+ """
18
+
19
+ transfer_encoding = request .headers .get ("Transfer-Encoding" , None )
20
+ if transfer_encoding == u"chunked" :
21
+ request .environ ["wsgi.input_terminated" ] = True
22
+
11
23
@app .route ("/" , defaults = {"path" : "" }, methods = ["POST" , "GET" ])
12
24
@app .route ("/<path:path>" , methods = ["POST" , "GET" ])
13
25
def main_route (path ):
You can’t perform that action at this time.
0 commit comments