在werkzeug请求中检索URL定位点 [英] Retrieving the url anchor in a werkzeug request

查看:120
本文介绍了在werkzeug请求中检索URL定位点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个DAV协议,用于存储url锚点中的带外数据。 中的 ghi > DELETE /abc.def#ghi 。服务器是一个Flask应用程序。



我可以通过 tcpdump 看到请求进来,但是当我查看werkzeug Request对象(比如url()或者base_url()),我得到的只是 /abc.def #ghi 已被删除。

是否有方法返回这个信息,还是我必须子类请求来处理这个自己?如果是这样,是否有一个例子可以作为一个灵感?

Fragment Identifier )(没有时间在RFC中找到它):


片段标识符的功能与URI的其余部分不同:即,它的处理完全是客户端,没有来自服务器的参与



因此,Flask或任何其他框架无法访问 #ghi


I have a DAV protocol that stores out-of-band data in the url anchor, e.g. the ghi in DELETE /abc.def#ghi. The server is a Flask application.

I can see the request come in on the wire via tcpdump, but when I look at the werkzeug Request object (such as url() or base_url()), all I get back is /abc.def. The #ghi has been stripped out.

Is there a method that returns this information, or do I have to subclass Request to handle this myself? If so, is there an example I can use as an inspiration?

解决方案

From Wikipedia (Fragment Identifier) (don't have the time to find it in the RFC):

The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server

So Flask - or any other framework - doesn't have access to #ghi.

这篇关于在werkzeug请求中检索URL定位点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆