http 204
在http协议中,经常会遇到的状态码200、404、500等等,大家应该比较熟悉。但是对于这个204状态码可能就不是很了解了。
204状态是指服务器成功处理了客户端请求,但服务器无返回内容。
204是HTTP中数据量最少的响应状态,204的响应中没有body,而且Content-Length=0。
一般情况下,我们在使用ajax提交一些数据给服务器,而不需要服务器返回的时候,常常在服务端使用下面的代码:
response.getWriter().print("")
服务器将返回一个不包含内容的空白页面,同时返回的是200状态。虽然我们没有输出内容,但返回页面它还是有body,而且Content-Length不会等于0。
其实这个时候我们完全可以直接返回204状态
response.setStatus(204)
204状态在一些网站分析的代码中最常用到,只需要把客户端的一些信息提交给服务器而无需关心响应。
https
Websitegenerate a Public key, private key pair
Websiteshould found a way to give public key to browser in a safe way.
SSL isthe protocol of this safe process
http://www.tldp.org/HOWTO/SSL-Certificates-HOWTO/x64.html
User browser shouldalready has some CA's public key
Thegeneral method is to use CA's private key to secure transport the websitepublic key to browser
Certificatecontent = Public key is plain text + expire time + website owner info
Signedcertificate = Certificate content (plain text!!!)+ CA private Key(md5(Certificatecontent))
(Signed certificateis generated by CA)
So, website publickey is always plain text!!!
CA privateKey(md5(Certificate content)) is just used to ensure no hack modification ofthis public key.
If youdon't want ask CA do this, you can self-sign:
Signed certificate =Certificate content (plain text!!!) + Web site private Key(md5(Certificate content))
The browser willprompt it's not a CA certificate, may have security risk.
CA's public isalso stored as certificate and they areall self-signed
Register website: https://ssladmin/Create
Azure config https: https://azure.microsoft.com/en-us/documentation/articles/cloud-services-configure-ssl-certificate/
Cer only containspublic key
Pfx contains privatekey and public key
The azure/web siteneed private key, so you should submit pfx to azure
The machine you makerequest to CA or inner http://ssladmin, it willgenerate private key in your local.
Then you install XX.cer in your local (use local machine, select personallocation)
Then cmd -> mmc-> file add snap in -> select certificated add -> in mmc browser open XXX.cer, you will foundit prompt "You have the private key for this certificate", then youcan output it to be a pfx file