handler_util.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:icfpc2016-judge 作者: icfpc2016 项目源码 文件源码
def _protect_xsrf_hook():
    """Before-request hook to protect from XSRF attacks."""
    # No need to protect API calls.
    if bottle.request.path.startswith('/api/'):
        return
    if bottle.request.method not in ('GET', 'HEAD'):
        xsrf_token = bottle.request.forms.get('xsrf_token', 'N/A')
        if xsrf_token != get_xsrf_token():
            bottle.abort(400, 'XSRF token is incorrect or not set.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号