我想使用Flask重定向RTMP流,其中新的流名称包含在30x
重定向的Location
头中。但是,Flask总是在我的重定向中添加主机/方案URL信息:
@app.route("/redirect")
def root():
return redirect("new-stream-name")
结果:
^{pr2}$我想要的位置是:
Location: new-stream-name
谢谢!在
{I publisher使用^ m控件对我的流进行身份验证。在
更新:
子类化Response
的解决方案相当简单:
from flask import Response
class FixedLocationResponse(Response):
autocorrect_location_header = False
@app.route("/redirect")
def root():
return redirect("new-stream-name", Response=FixedLocationResponse)
结果:
HTTP/1.0 302 FOUND
Content-Type: text/html; charset=utf-8
Content-Length: 237
Location: new-stream-name
Server: Werkzeug/0.10.4 Python/2.7.9
Date: Sat, 02 May 2015 19:31:28 GMT
目前没有回答
相关问题 更多 >
编程相关推荐