Http misc

http 204

http协议中,经常会遇到的状态码200404500等等,大家应该比较熟悉。但是对于这个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

https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs

 

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值