细粒度其余 HTTP 动词浏览器支持
是否有关于浏览器如何实际支持 Rest http 动词(尤其是 PUT、DELETE)的数据。这个问题主要是由于许多来源(例如这个 stackoverflow 答案)告知大多数浏览器不支持 PUT 和 DELETE,但没有说明是哪一个。
Rails 解决了这在客户端上使用补丁,并在服务器上反转补丁,但我想知道,例如,哪些浏览器不需要这样的黑客攻击。
Is there any data regarding how browsers actually support rest http verbs (especially PUT, DELETE). This question is mostly motivated by the fact that many sources (such as this stackoverflow answer) inform that most browsers don't suport PUT and DELETE but don't say which.
Rails solves this using a patch on the client, and reversing the patch on the server, but I wonder, for instance, which browsers wouldn't need such hack.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如有疑问,请询问安妮:
http://annevankesteren.nl/2007/10/http-method-support
这已经有几年了旧的,但它为 PUT 和 DELETE 提供了干净的健康证明,但它也尝试了更晦涩的动词的不同情况,例如 TRACE 和 PROPFIND:
Van Kesteren 测试了 Firefox 3、Opera 9.5 和 Internet Explorer 7,这是预发行版和发布。 GET 和 POST 按预期工作,并且都支持 RFC 2616 中的标准 http 方法集。存在一些大小写问题,因此您应该尝试始终坚持使用大写; TRACE 和 OPTIONS 分别是 Firefox 和 Opera 中存在问题的边缘情况。 CONNECT、TRACE 和 SEARCH 对于 IE 来说是有问题的。请记住,这是 2007 年写的,所以 YMMV。
我认为浏览器不支持 GET 和 POST 之外的所有混乱源于这样一个事实:HTML 规范仅在 HTML
这就是为什么浏览器在 HTML 中只原生支持 GET 和 POST 的原因;因为标准是这么说的。
当前(2014 年 1 月)XMLHttpRequest 规范另一方面明确指出,请求方法应该允许通过,但有一些例外(CONNECT、TRACE 或 TRACK),并且 RFC2616 方法应该大写:
编辑 另一个来源或多或少得出了相同的结论: XMLHttpRequest 支持 PUT 和 DELETE: http://jshirley.vox.com/library/post/xmlhttprequest-and-rest.html(警告,截至 2014 年 5 月的链接已损坏)。
编辑问题是当然之前问过,但两年前的答案仍然有效。
编辑 Anne van Kesteren 2007 年页面的简短简历,并添加了有关 HTML 与 XMLHttpRequest 的部分
When in doubt, ask Anne:
http://annevankesteren.nl/2007/10/http-method-support
It's a couple of years old, but it gives a clean bill of health to PUT and DELETE, but it also tries different cases of more obscure verbs like TRACE and PROPFIND:
Van Kesteren tested Firefox 3, Opera 9.5 and Internet Explorer 7, a mix of pre-release and releases. GET and POST worked as expected, and all supported the standard set of http methods from RFC 2616. There are some casing issues, so you should try to stick with uppercase always; TRACE and OPTIONS are edge cases with problems found in Firefox and Opera, respectively. CONNECT and TRACE and SEARCH are problematic for IE. Bear in mind that this was written in 2007 so YMMV.
I think the whole confusion over browsers not supporting other than GET and POST stems from the fact that the HTML specification lists only these two in the HTML
<form>
element:This is the reason why browsers only support GET and POST natively in HTML; since the standard says so.
The current (January 2014) XMLHttpRequest specification on the other hand states explicitly that request methods should be allowed through with some exceptions (CONNECT, TRACE or TRACK), and that RFC2616 methods should be uppercased:
EDIT Another source that has come to more or less the same conclusion: That XMLHttpRequest supports PUT and DELETE: http://jshirley.vox.com/library/post/xmlhttprequest-and-rest.html (warning, broken link as of May 2014).
EDIT The question has been asked before of course, but the two year old answers are still valid.
EDIT Short resume of Anne van Kesteren's page from 2007, and added section on HTML vs XMLHttpRequest
请参阅 Atom Wiki 的 PutDeleteSupport 页面。您可能有兴趣浏览与 HTTP 相关的其他 Atom Wiki 页面。
See the PutDeleteSupport page of the Atom Wiki. You might be interested in browsing other Atom Wiki pages related to HTTP.