为什么GET方法比HTTP中的POST更快? [英] Why is the GET method faster than POST in HTTP?

查看:112
本文介绍了为什么GET方法比HTTP中的POST更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Web编程的新手,只是想知道将数据从一页发送到另一页的GET和POST方法.

I am new to web programming and just curious to know about the GET and POST methods of sending data from one page to another.

据说GET方法比POST更快,但我不知道为什么. 我能找到的一个原因是GET只能使用255个字符? 还有其他原因吗?请有人向我解释.

It is said that the GET method is faster than POST but I don't know why. One reason I could find is that GET can take only 255 characters? Is there any other reason? Please someone explain to me.

推荐答案

与速度无关.在很多情况下,POST更适用.例如,搜索引擎将为GET URL编制索引,浏览器可以为它们添加书签并使其显示在历史记录中.结果,如果您采取诸如基于GET请求修改数据库之类的操作,则这可能是有害的,因为某些漫游器可能还会遍历URL.

It's not much about speed. There are plenty of cases where POST is more applicable. For example, search engines will index GET URLs and browsers can bookmark them and make them show up in history. As a result, if you take actions like modifying a DB based on a GET request, it might be harmful as some bots might also traverse the URL.

另一种情况可能是安全问题.如果您使用GET发布凭据,它将在浏览器历史记录和服务器日志文件中列出.

The other case can be security issue. If you post credentials using GET, it'll get listed in browser history and server log files.

这篇关于为什么GET方法比HTTP中的POST更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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