每个 URI 指向的资源可以是任何事物,可以有多种不同的表述,例如一份文档可以有不同语言的翻译、不同的媒体格式、可以针对不同的浏览器提
供不同的压缩编码等
二、Proactive 主动式内容协商
三、Reactive 响应式内容协商
四、常见的协商要素 1、常见协商要素1 2、常见协商要素2 内容编码:主要指压缩算法
响应中的压缩方式 五、国际化与本地化 六、资源表述的元数据头部 六、cURL工具使用
1、--compressed 将结果解压缩
命令
curl ‘https://www.baIDu.com/‘ -H ‘Connection: keep-alive‘ -H ‘Pragma: no-cache‘ -H ‘Cache-Control: no-cache‘ -H ‘upgrade-insecure-requests: 1‘ -H ‘User-Agent: Mozilla/5.0 (windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/73.0.3683.86 Safari/537.36‘ -H ‘Accept: text/HTML,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3‘ -H ‘Accept-EnCoding: gzip,deflate,br‘ -H ‘Accept-Language: zh-CN,zh;q=0.9‘ -H ‘cookie: BDUSS=Y3Ty0zbfdrbTBIWWdlZ0UtRjZpOGNzdFFtVXVzNTJIEmxXNzdyc1lNak45ZkJJsVFBQUFBJCQAAAAAAAAAAAEAAACumLcCbHVvYWhvbmcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM1oyVzNaMlcRH; A^`=1570252928jMyG000154233; BAIDUID=D3466420B11AEE8C6DCE1776E360E57C:FG=1; PSTM=1570252049; BIDUPSID=9ED37D1EFAB864BCB9197CD7637AB8CC; BD_UPN=12314353; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; H_PS_645EC=a521LDhJX1l%2BFB6jUNwQI7xetFq3k3%2FLeU6yK%2Fb70nZrV8c%2B%2FpIMx8OkrgfHWtqdpDC8; BD_HOME=1; H_PS_PSSID=1430_21124_29522_29720_29568_29220; sugstore=1‘ --compressed
运行结果
bds.comm.dpquery=""; bds.comm.samSugAPI=s_session.sID === "25219" ? 1 : 0; var index_content = $(‘#head‘); var index_foot= $(‘#ftCon‘); var index_CSS= $(‘#style_super_inline‘); var index_is_CSS = $(‘#s_is_index_CSS‘); var index_CSS_content = index_CSS.HTML(); var index_u= $(‘#u_sp‘); var result_u= $(‘#u‘); window.index_links = []; var result_head = $("#head"); window.index_on=function(){ s_session.index_off = false; }; window.index_off=function(){ s_session.index_off = true; $(document.body).attr(‘link‘,‘#0000cc‘); index_links = []; $("head").find("link").each(function(){ index_links.push(this); $(this).remove(); }); index_CSS.remove(); index_is_CSS.remove(); $(‘#head_wrapper‘).CSS(‘wIDth‘,‘‘); $(‘#kw‘).CSS(‘Font-family‘,‘‘); $(‘head‘).append($.decodeHTML($(‘#s_index_off_CSS‘).HTML())); $(‘head‘).append($.decodeHTML($(‘#s_is_result_CSS‘).HTML())); $(‘.s-tips-skin‘).remove(); $(‘.s-skin-container‘).remove(); $(‘#s_mancard_newmusic‘).remove(); };2、去掉--compressed 结果是二进制文件
curl ‘https://www.baIDu.com/‘ -H ‘Connection: keep-alive‘ -H ‘Pragma: no-cache‘ -H ‘Cache-Control: no-cache‘ -H ‘upgrade-insecure-requests: 1‘ -H ‘User-Agent: Mozilla/5.0 (windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML,zh;q=0.9‘ -H ‘cookie: BDUSS=Y3Ty0zbfdrbTBIWWdlZ0UtRjZpOGNzdFFtVXVzNTJIEmxXNzdyc1lNak45ZkJJsVFBQUFBJCQAAAAAAAAAAAEAAACumLcCbHVvYWhvbmcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM1oyVzNaMlcRH; A^`=1570252928jMyG000154233; BAIDUID=D3466420B11AEE8C6DCE1776E360E57C:FG=1; PSTM=1570252049; BIDUPSID=9ED37D1EFAB864BCB9197CD7637AB8CC; BD_UPN=12314353; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; H_PS_645EC=a521LDhJX1l%2BFB6jUNwQI7xetFq3k3%2FLeU6yK%2Fb70nZrV8c%2B%2FpIMx8OkrgfHWtqdpDC8; BD_HOME=1; H_PS_PSSID=1430_21124_29522_29720_29568_29220; sugstore=1‘
截图如下
3、去掉头部的压缩-H ‘Accept-EnCoding: gzip,br‘ 总结
以上是内存溢出为你收集整理的Web协议详解与抓包实战:HTTP1协议-内容协商是怎样进行的(8)全部内容,希望文章能够帮你解决Web协议详解与抓包实战:HTTP1协议-内容协商是怎样进行的(8)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)