HTTP Methods: GET vs. POST
Two commonly used methods for a request-response between a client and server are: GET and POST.
- GET - Requests data from a specified resource
- POST - Submits data to be processed to a specified resource
The GET Method
Note that query strings (name/value pairs) is sent in the URL of a GET request:
/test/demo_form.asp?name1=value1&name2=value2
Some other notes on GET requests:
- GET requests can be cached/GET请求可以被缓存
- GET requests remain in the browser history/GET请求保存在浏览器历史中
- GET requests can be bookmarked/GET请求可以被保存为书签
- GET requests should never be used when dealing with sensitive data/GET请求不能用来处理敏感数据
- GET requests have length restrictions/GET请求有数据长度限制
- GET requests should be used only to data/GET请求应该被用来获取数据
The POST Method
Note that query strings (name/value pairs) is sent in the HTTP message body of a POST request:
Host: w3schools.com
name1=value1&name2=value2
Some other notes on POST requests:
- POST requests are never cached/POST请求不会被缓存
- POST requests do not remain in the browser history/POST请求不会保存在浏览器历史中
- POST requests cannot be bookmarked/POST请求不能被存为标签
- POST requests have no restrictions on data length/POST请求没有数据长度限制
Compare GET vs. POST
The following table compares the two HTTP methods: GET and POST.
| GET | POST | |
|---|---|---|
| BACK button/Reload | Harmless | Data will be re-submitted (the browser should alert the user that the data are about to be re-submitted) |
| Bookmarked | Can be bookmarked | Cannot be bookmarked |
| Cached | Can be cached | Not cached |
| Encoding type | application/x-www-form-urlencoded | application/x-www-form-urlencoded or multipart/form-data. Use multipart encoding for binary data |
| History | Parameters remain in browser history | Parameters are not saved in browser history |
| Restrictions on data length | Yes, when sending data, the GET method adds the data to the URL; and the length of a URL is limited (maximum URL length is 2048 characters) | No restrictions |
| Restrictions on data type | Only ASCII characters allowed | No restrictions. Binary data is also allowed |
| Security | GET is less secure compared to POST because data sent is part of the URL
Never use GET when sending passwords or other sensitive information! |
POST is a little safer than GET because the parameters are not stored in browser history or in web server logs |
| Visibility | Data is visible to everyone in the URL | Data is not displayed in the URL |
源地址:http://www.w3schools.com/tags/ref_httpmethods.asp
HTTP Methods: GET vs. POST的更多相关文章
- How to implement equals() and hashCode() methods in Java[reproduced]
Part I:equals() (javadoc) must define an equivalence relation (it must be reflexive, symmetric, and ...
- Sort Methods
heyheyhey ~~ It has been a long time since i come here again...whatever today i will summerize some ...
- Top 10 Methods for Java Arrays
作者:X Wang 出处:http://www.programcreek.com/2013/09/top-10-methods-for-java-arrays/ 转载文章,转载请注明作者和出处 The ...
- Don’t Use Accessor Methods in Initializer Methods and dealloc 【初始化和dealloc方法中不要调用属性的存取方法,而要直接调用 _实例变量】
1.问题: 在dealloc方法中使用[self.xxx release]和[xxx release]的区别? 用Xcode的Analyze分析我的Project,会列出一堆如下的提示:Inco ...
- C# Extension Methods
In C#, extension methods enable you to add methods to existing class without creating a new derived ...
- CLR via C# 3rd - 08 - Methods
Kinds of methods Constructors Type constructors Overload operators Type con ...
- 转 Dynamics CRM Alert and Notification JavaScript Methods
http://www.powerobjects.com/2015/09/23/dynamics-crm-alert-and-notification-javascript-methods/ Befor ...
- AX7: HOW TO USE CLASS EXTENSION METHODS
AX7: HOW TO USE CLASS EXTENSION METHODS To create new methods on a standard AX class without custo ...
- Keeping Async Methods Alive
Consider a type that will print out a message when it’s finalized, and that has a Dispose method whi ...
- 增强学习(四) ----- 蒙特卡罗方法(Monte Carlo Methods)
1. 蒙特卡罗方法的基本思想 蒙特卡罗方法又叫统计模拟方法,它使用随机数(或伪随机数)来解决计算的问题,是一类重要的数值计算方法.该方法的名字来源于世界著名的赌城蒙特卡罗,而蒙特卡罗方法正是以概率为基 ...
随机推荐
- SDUT1607:Number Sequence(矩阵快速幂)
题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1607 题目描述 A number seq ...
- Jmeter 之下载图片
利用Jmeter实现文件图片下载 步骤: 1. 新建线程组 2. 线程组右键新建HTTP请求: 添加服务器名称或IP, 路径,协议,方法,端口等信息 3. 线程组右键新建 BeanShell Samp ...
- FileLoadTools
/** * Created by dev013 on 9/9/14. */ var FileLoadTools = (function () { var my = {}; var htmlFile = ...
- Teleport Ultra 垃圾代码 tppabs的清理<转>
在使用整站下载软件Teleport Pro或Teleport Ultra下载的离线文件里会包含大量垃圾代码,下载后就需要清除整站下载文件中的冗余代码:tppabs等.这些代码本是Teleport自动添 ...
- 【转】C#操作xml
XML文件是一种常用的文件格式,例如WinForm里面的app.config以及Web程序中的web.config文件,还有许多重要的场所都有它的身影.Xml是Internet环境中跨平台的,依赖于内 ...
- Linux 磁盘
一台物理服务器通常有好几块磁盘(/dev/sda,/dev/sdb),每个磁盘上都可以进行分区(例如对sda进行分区操作:fdisk /dev/sda,可以将sda分成sda1,sda2,sda5等分 ...
- Web前端页面的浏览器兼容性测试心得(一)搭建测试用本地静态服务器
自从实习以来,我体验了由一个人编程再到多人协作编程的转换.同时也接触了很多新鲜事物,学到了很多东西.工作时,常常需要多个人协同测试一张H5页面(PC.手机.平板等跨设备测试),也会经常把页面给PM或老 ...
- python、pip、whl安装和使用
1 python的安装 首先,从python的官方网站 www.python.org下载需要的python版本,地址是这个: http://www.python.org/ftp/python/2.7. ...
- Docker入门简明教程
Docker简介 概念 Docker是基于Go语言实现的云开源项目,是基于Linux的多项开源技术提供高效.敏捷和轻量级的容器方案.创建于2013年初.自从开源后就受到了广泛的关注,从长远的眼光来看, ...
- 根据iframe获取window
今天使用layui弹出窗口,需要将函数写在弹出的窗口,但是按钮事件是在父层窗口绑定的,这样就要在父层窗口调用子层窗口的函数. 子层函数与父层函数 function topup() { console. ...