{"id":5397,"date":"2022-10-30T17:47:24","date_gmt":"2022-10-30T09:47:24","guid":{"rendered":"https:\/\/www.chenqing.work\/?p=5397"},"modified":"2022-12-23T13:24:26","modified_gmt":"2022-12-23T05:24:26","slug":"%e9%8f%96%e6%88%98-web-%e6%80%a7%e8%83%bd%ef%bc%9ahttp","status":"publish","type":"post","link":"https:\/\/www.chenqing.work\/?p=5397","title":{"rendered":"Web \u6027\u80fd\u4f18\u5316\uff0cPart 3\uff1aHTTP"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1280\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/esteban-lopez-6yjAC0-OwkA-unsplash.jpg\" alt=\"\" class=\"wp-image-5399\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5728\u7b56\u7565\u5c42\u9762\uff0c\uff08\u56db\u7ef4\u7a7a\u95f4\u9488\u5bf9\u6307\u5b9a\u95ee\u9898\u7edd\u5bf9\u590d\u6742\u6027\u7684\uff09\u666e\u9002\u4f18\u5316\u624b\u6bb5\u6700\u7ec8\u90fd\u662f\u5728\u4e24\u79cd\u7ef4\u5ea6\u4e4b\u95f4\u8fdb\u884c\u53d6\u820d\u8f6c\u6362\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5f53\u65f6\u95f4\u66f4\u5b9d\u8d35\u65f6\uff0c\u7528\u7a7a\u95f4\u6362\u65f6\u95f4\uff1b<\/li>\n\n\n\n<li>\u5f53\u7a7a\u95f4\u66f4\u5b9d\u8d35\u65f6\uff0c\u7528\u65f6\u95f4\u6362\u7a7a\u95f4\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.chenqing.work\/?p=5657\" data-type=\"URL\" data-id=\"https:\/\/www.chenqing.work\/?p=5657\">Web \u6027\u80fd\u4f18\u5316\uff0cPart 1\uff1aTCP<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.chenqing.work\/?p=5891\" data-type=\"URL\" data-id=\"https:\/\/www.chenqing.work\/?p=5891\">Web \u6027\u80fd\u4f18\u5316\uff0cPart 2\uff1aTLS<\/a><\/li>\n\n\n\n<li>\u2693 <strong>Web \u6027\u80fd\u4f18\u5316\uff0cPart 3\uff1aHTTP<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u4ee5 Web \u5e94\u7528\u4e3a\u4ee3\u8868\u7684\u4e92\u8054\u7f51\u8087\u59cb\u4e8e 1991 \u5e74 Tim Berners-Lee \u63d0\u51fa\u7684 HTTP\/0.9 \u534f\u8bae\uff0c\u7ecf\u8fc7 30 \u591a\u5e74\u7684\u53d1\u5c55\uff0c\u4f34\u968f\u7740 IT \u5de8\u5934\u7684<a href=\"https:\/\/webaim.org\/blog\/user-agent-string-history\/\" data-type=\"URL\" data-id=\"https:\/\/webaim.org\/blog\/user-agent-string-history\/\">\u660e\u4e89\u6697\u6597<\/a>\uff0c\u5df2\u7ecf\u9010\u6e10\u6e17\u900f\u8fdb\u6211\u4eec\u751f\u6d3b\u7684\u65b9\u65b9\u9762\u9762\uff0c\u6210\u4e3a\u5f53\u4ee3\u793e\u4f1a\u4e0d\u53ef\u6216\u7f3a\u7684\u7ec4\u6210\u90e8\u5206\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">HTTP \u534f\u8bae\u7684\u5386\u53f2<\/h2>\n\n\n\n<p><strong>1991 \u5e74<\/strong>\uff0cHTTP\uff08HyperText Transfer Protocol\uff0c\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff09\u7b2c\u4e00\u4e2a\u7248\u672c \u2014 HTTP\/0.9\uff0c\u8bde\u751f\u4e86\uff0c\u529f\u80fd\u6bd4\u8f83\u7b80\u964b\uff0c\u8bbe\u8ba1\u76ee\u6807\u5305\u62ec\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u652f\u6301\u6587\u4ef6\u4f20\u8f93\uff1b<\/li>\n\n\n\n<li>\u80fd\u591f\u901a\u8fc7\u7d22\u5f15\u641c\u7d22 HTML\uff1b<\/li>\n\n\n\n<li>\u683c\u5f0f\u5316\u534f\u5546\u673a\u5236\uff1b<\/li>\n\n\n\n<li>\u80fd\u591f\u628a\u5ba2\u6237\u7aef\u5f15\u5bfc\u5230\u4e0d\u540c\u7684\u670d\u52a1\u5668\u3002 <\/li>\n<\/ul>\n\n\n\n<p>HTTP\/0.9 \u5960\u5b9a\u4e86\u6574\u4e2a\u4e92\u8054\u7f51\u4ea4\u4e92\u7684\u5927\u6846\u67b6\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5ba2\u6237\u7aef\uff08\u8bf7\u6c42\uff09\u2014\u670d\u52a1\u5668\uff08\u54cd\u5e94\uff09\u6a21\u5f0f<\/strong>\uff1b<\/li>\n\n\n\n<li><strong>\u57fa\u4e8e TCP\/IP \u534f\u8bae\u6808<\/strong>\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5728 HTTP\/0.9 \u7248\u672c\u4e2d\uff0cTCP \u8fde\u63a5\u5728\u6bcf\u6b21 HTTP \u8bf7\u6c42\u540e\u90fd\u4f1a\u5173\u95ed\u3002<\/p>\n\n\n\n<p><strong>1996 \u5e74<\/strong>\uff0cHTTP\/1.0 \u7248\u672c\uff08<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc1945\" data-type=\"URL\" data-id=\"https:\/\/www.rfc-editor.org\/rfc\/rfc1945\">rfc1945<\/a>\uff09\u53d1\u5e03\uff0c\u4e3b\u8981\u662f\u53c2\u8003\u6027\u8d28\u7684\uff0c\u603b\u7ed3\u4e86\u4e00\u4e9b\u6700\u4f73\u5b9e\u8df5\u548c\u6a21\u5f0f\uff0c\u589e\u52a0\u4e86\u5185\u5bb9\u534f\u5546\uff0c\u54cd\u5e94\u5bf9\u8c61\u4e0d\u518d\u5c40\u9650\u4e8e HTML\uff0c\u5f7c\u65f6\u4e00\u4e2a\u8bf7\u6c42\u4ecd\u7136\u5bf9\u5e94\u4e00\u4e2a TCP \u8fde\u63a5\u3002<\/p>\n\n\n\n<p><strong>1997 \u5e74<\/strong>\uff0cHTTP\/1.1 \u7248\u672c\uff08<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc2068.html\" data-type=\"URL\" data-id=\"https:\/\/www.rfc-editor.org\/rfc\/rfc2068.html\">rfc2068<\/a>\uff09\u6b63\u5f0f\u53d1\u5e03\uff0c\u5398\u6e05\u4e86\u4e4b\u524d\u7248\u672c\u4e2d\u5f88\u591a\u6709\u6b67\u4e49\u7684\u5730\u65b9\uff0c\u5e76\u5bf9\u6027\u80fd\u8fdb\u884c\u4e86\u4f18\u5316\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6301\u4e45\u8fde\u63a5\uff0c\u590d\u7528 TCP \u8fde\u63a5\uff1b<\/li>\n\n\n\n<li>\u5206\u5757\u7f16\u7801\u4f20\u8f93\uff1b<\/li>\n\n\n\n<li>\u5b57\u8282\u8303\u56f4\u8bf7\u6c42\uff1b<\/li>\n\n\n\n<li>\u589e\u5f3a\u7684\u7f13\u5b58\u673a\u5236\uff1b<\/li>\n\n\n\n<li>\u4f20\u8f93\u7f16\u7801\uff1b<\/li>\n\n\n\n<li>\u8bf7\u6c42\u7ba1\u9053\uff0c\u4e0d\u7528\u7b49\u5f85\u524d\u4e00\u4e2a\u8bf7\u6c42\u56de\u5e94\u5c31\u53d1\u9001\u4e0b\u4e00\u4e2a\u8bf7\u6c42\uff0c\u652f\u6301\u7684\u4e0d\u591a\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>2015 \u5e74<\/strong>\uff0cHTTP\/2 \u7248\u672c\uff08<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc7540.html\" data-type=\"URL\" data-id=\"https:\/\/www.rfc-editor.org\/rfc\/rfc7540.html\">rfc7540<\/a>\uff09\u53d1\u5e03\uff0c\u4e3b\u8981\u805a\u7126\u6027\u80fd\uff0c\u5c06\u539f\u6765\u57fa\u4e8e\u6587\u672c\u4f20\u8f93\u7684\u6a21\u5f0f\u6539\u4e3a\u57fa\u4e8e\u4e8c\u8fdb\u5236\u6570\u636e\uff0c\u5728\u4f20\u8f93\u5c42\u4e4b\u4e0a\u5f15\u5165\u4e8c\u8fdb\u5236\u5206\u5e27\u6570\u636e\u5c42\uff0c\u6bcf\u4e2a\u3010\u4e3b\u673a\uff1a\u7aef\u53e3\u3011\u7ec4\u5408\u4ec5\u4e00\u4e2a\u6301\u4e45\u7684 TCP \u8fde\u63a5\uff0c\u5728\u8be5\u8fde\u63a5\u4e0a\u8fdb\u884c\u591a\u8def\u590d\u7528\u3002<\/p>\n\n\n\n<p><strong>2022 \u5e74<\/strong>\uff0cHTTP\/3 \u7248\u672c\uff08<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9114\" data-type=\"URL\" data-id=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9114\">rfc9114<\/a>\uff09\u53d1\u5e03\uff0c\u4f7f\u7528\u7684\u4f20\u8f93\u5c42\u534f\u8bae\u4ece TCP \u6539\u4e3a UDP\u3002<\/p>\n\n\n\n<p>\u4ece HTTP\/0.9 \u5230 HTTP\/3\uff0c\u9488\u5bf9\u4e0d\u540c\u7684\u573a\u666f\u548c\u9700\u6c42\uff0c\u534f\u8bae\u5728\u4e0d\u65ad\u5730\u8fdb\u5316\uff0c\u4f46\u73b0\u5b9e\u4e16\u754c\u4e2d\u96be\u4ee5\u5bf9\u5927\u91cf\u7684\u8f6f\u786c\u4ef6\u8fdb\u884c\u7edf\u4e00\u5347\u7ea7\uff0c\u6240\u4ee5\u65e0\u6cd5\u505a\u5230\u4e00\u952e\u5207\u6362\uff0c\u65b0\u65e7\u534f\u8bae\u7684\u4ea4\u66ff\u5f80\u5f80\u9700\u8981\u6301\u7eed\u4e00\u6bb5\u76f8\u5f53\u957f\u7684\u65f6\u95f4\uff08\u4e00\u822c 5-10 \u5e74\uff09\uff0c\u6240\u4ee5\u5728\u4e00\u6bb5\u65f6\u95f4\u91cc\uff0c\u5ba2\u6237\u7aef\u3001\u4ee3\u7406\u3001\u670d\u52a1\u5668\u4ecd\u7136\u9700\u8981\u540c\u65f6\u652f\u6301\u591a\u79cd\u7248\u672c\u7684 HTTP \u534f\u8bae\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6027\u80fd\u4f18\u5316<\/h2>\n\n\n\n<p>\u5bf9 Web \u5e94\u7528\u6765\u8bf4\uff0c\u6027\u80fd\u4f18\u5316\u53ef\u4ee5\u7b80\u8981\u63cf\u8ff0\u4e3a\uff1a<strong>\u5982\u4f55\u66f4\u5feb\u5730\u5b8c\u6210\u7528\u6237\u8bf7\u6c42<\/strong>\u3002<\/p>\n\n\n\n<p>\u4e2a\u4eba\u7406\u89e3\u7684\u6838\u5fc3\u539f\u5219\u662f\uff1a<strong>\uff08\u5728\u5927\u591a\u6570\u65f6\u5019\uff09\u5c3d\u91cf\u51cf\u5c11\u7f51\u7edc\u8bf7\u6c42<\/strong>\u3002\u2014\u2014 \u6709\u70b9\u50cf\u8f66\u8f71\u8f98\u8bdd \ud83e\udd14\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u624b\u6bb5\u6709\uff1a<\/p>\n\n\n\n<p>1\u3001<strong>\u4f7f\u7528\u538b\u7f29<\/strong><\/p>\n\n\n\n<p>\u901a\u8fc7\u5728\u8bf7\u6c42\u4e2d\u58f0\u660e\u6807\u5934\u3010Accept-Encoding: &lt;\u538b\u7f29\u7b97\u6cd5&gt;\u3011\u6765\u548c\u670d\u52a1\u7aef\u534f\u5546\u5bf9 body \u8fdb\u884c\u538b\u7f29\u540e\u4f20\u8f93\uff0c\u538b\u7f29\u7b97\u6cd5\u6709 gzip\u3001deflate\u3001compress\u3001br\uff0c\u4e00\u822c\u9009\u7528 gzip\u3002\u5982\u679c\u670d\u52a1\u7aef\u540c\u610f\uff0c\u540e\u7eed\u54cd\u5e94\u4e2d\u5c31\u5bf9 body \u8fdb\u884c\u538b\u7f29\uff0c\u5e76\u4e14\u54cd\u5e94\u4e2d\u5305\u542b\u6807\u5934\u3010Content-Encoding: &lt;\u538b\u7f29\u7b97\u6cd5&gt;\u3011\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u538b\u7f29\u53ef\u4ee5\u51cf\u5c11\u9700\u8981\u4f20\u8f93\u7684\u6570\u636e\u91cf\uff0c\u4ece\u800c\u51cf\u5c11\u4e86\u9700\u8981\u4f20\u8f93\u7684\u7f51\u7edc\u5305\uff0c\u589e\u52a0\u4e86\u4e24\u7aef\u7684\u5904\u7406\u65f6\u95f4\uff0c\u51cf\u5c11\u4e86\u4e2d\u95f4\u7684\u4f20\u8f93\u65f6\u95f4\uff0c\u5c5e\u4e8e\u4ee5\u65f6\u95f4\uff08\u4e24\u7aef\u7684 CPU \u65f6\u95f4\uff09\u6362\u7a7a\u95f4\uff08\u4f20\u8f93\u6570\u636e\u91cf\uff09\u7684\u4f18\u5316\u7b56\u7565\u3002<\/p>\n\n\n\n<p>2\u3001<strong>CDN<\/strong><\/p>\n\n\n\n<p>\u5c06\u8d44\u6e90\u670d\u52a1\u5668\u6258\u7ba1\u5230\u9760\u8fd1\u7528\u6237\u7684\u7f51\u7edc\u8fd0\u8425\u5546\u5904\uff0c\u7528\u6237\u8bf7\u6c42\u65f6\u76f4\u63a5\u8bf7\u6c42 CDN\uff0c\u51cf\u5c11\u4e86\u7f51\u7edc\u8df3\u6570\uff0c\u4fdd\u8bc1\u7f51\u7edc\u5ef6\u8fdf\u6700\u5c0f\u3002<\/p>\n\n\n\n<p>3\u3001<strong>\u6761\u4ef6\u5f0f\u8bf7\u6c42<\/strong><\/p>\n\n\n\n<p>\u5f53\u8d44\u6e90\u8fc7\u671f\u540e\uff0c\u901a\u8fc7\u4f20\u9012\u8d44\u6e90\u7684\u7248\u672c\u6807\u8bc6\uff0c\u8be2\u95ee\u670d\u52a1\u7aef\u8be5\u7f13\u5b58\u8d44\u6e90\u662f\u5426\u53ef\u7528\u3002\u5982\u679c\u53ef\u7528\u7684\u8bdd\uff0c\u670d\u52a1\u7aef\u8fd4\u56de\u3010304 Not Modified\u3011\uff0c\u5c31\u6210\u529f\u907f\u514d\u4e86\u4e00\u6b21\u591a\u4f59\u7684\u6570\u636e\u54cd\u5e94\uff0c\u6d4f\u89c8\u5668\u4f1a\u6839\u636e\u573a\u666f\u8c03\u6574\u7f13\u5b58\u7684\u6709\u6548\u6027\u3002<\/p>\n\n\n\n<p>\u8d44\u6e90\u6709\u4e24\u79cd\u6807\u8bc6\u65b9\u5f0f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Last-Modified: &lt;date\/time&gt;<\/strong>\uff0c\u6700\u540e\u4fee\u6539\u65f6\u95f4\uff1b<\/li>\n\n\n\n<li><strong>Etag: &lt;string&gt;<\/strong>\uff0c\u7248\u672c\u53f7\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u670d\u52a1\u7aef\u8fd4\u56de\u8d44\u6e90\u65f6\u643a\u5e26\u8d44\u6e90\u6807\u8bc6\u3002<\/p>\n\n\n\n<p>\u5f53\u8bf7\u6c42\u4e2d\u5305\u542b\u4ee5\u4e0b\u6807\u5934\u65f6\uff0c\u5c31\u662f\u6761\u4ef6\u5f0f\u8bf7\u6c42\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>If-Match: &lt;etag_value&gt;<\/strong>\uff0c\u7248\u672c\u53f7\u5339\u914d\u65f6\u624d\u6267\u884c\uff1b<\/li>\n\n\n\n<li><strong>If-None-Match: &lt;etag_value&gt;<\/strong>\uff0c\u7248\u672c\u53f7\u4e0d\u5339\u914d\u65f6\u624d\u6267\u884c\uff1b<\/li>\n\n\n\n<li><strong>If-Modified-Since: &lt;day-name&gt;, &lt;dd&gt; &lt;mm&gt; &lt;yyyy&gt; &lt;hh&gt;:&lt;mm&gt;:&lt;ss&gt; GMT<\/strong>\uff0c\u5728\u6b64\u65e5\u671f\u4e4b\u540e\u4fee\u6539\u8fc7\u624d\u6267\u884c\uff1b<\/li>\n\n\n\n<li><strong>If-Unmodified-Since:<\/strong> <strong>&lt;day-name&gt;, &lt;dd&gt; &lt;mm&gt; &lt;yyyy&gt; &lt;hh&gt;:&lt;mm&gt;:&lt;ss&gt; GMT<\/strong>\uff0c\u5728\u6b64\u65e5\u671f\u4e4b\u524d\u4fee\u6539\u8fc7\u624d\u6267\u884c\uff1b<\/li>\n\n\n\n<li><strong>If-Range<\/strong>: <strong>&lt;day-name&gt;, &lt;dd&gt; &lt;mm&gt; &lt;yyyy&gt; &lt;hh&gt;:&lt;mm&gt;:&lt;ss&gt; GMT<\/strong>\uff0c\u7528\u4e8e\u65ad\u70b9\u7eed\u4f20\uff1b<\/li>\n\n\n\n<li><strong>If-Range<\/strong>: <strong>&lt;etag_value&gt;<\/strong>\uff0c\u7528\u4e8e\u65ad\u70b9\u7eed\u4f20\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u548c PUT \u65b9\u6cd5\u4e00\u8d77\u7528\u65f6\uff0c\u5c31\u662f\u4e50\u89c2\u9501\u7684\u601d\u8def\u3002<\/p>\n\n\n\n<p>4\u3001<strong>Expires<\/strong><\/p>\n\n\n\n<p>\u5f53\u670d\u52a1\u7aef\u7b2c\u4e00\u6b21\u8fd4\u56de\u8d44\u6e90\u65f6\uff0c\u8bbe\u7f6e\u6807\u5934\u3010Expires: &lt;\u6709\u6548\u65f6\u95f4&gt;\u3011\uff0c\u8be5\u8d44\u6e90\u7f13\u5b58\u5728\u5ba2\u6237\u7aef\uff0c\u5728\u6709\u6548\u65f6\u95f4\u5185\uff0c\u8d44\u6e90\u90fd\u662f fresh \u72b6\u6001\u7684\uff0c\u53ef\u4ee5\u76f4\u63a5\u53d6\u7528\uff0c\u5f53\u8fc7\u671f\u4ee5\u540e\uff0c\u8d44\u6e90\u5c31\u53d8\u4e3a stale \u72b6\u6001\uff0c\u9700\u8981\u91cd\u65b0\u548c\u670d\u52a1\u7aef\u534f\u5546\u83b7\u53d6\u3002<\/p>\n\n\n\n<p>5\u3001<strong>Cache-Control<\/strong><\/p>\n\n\n\n<p>HTTP \u534f\u8bae\u4e2d\u5b9a\u4e49\u4e86\u4e24\u7c7b\u7f13\u5b58\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u79c1\u6709\u7f13\u5b58<\/strong>\uff0c\u7279\u5b9a\u7528\u6237\u6240\u6709\uff0c\u901a\u5e38\u653e\u5728\u6d4f\u89c8\u5668\u7aef\uff1b<\/li>\n\n\n\n<li><strong>\u5171\u4eab\u7f13\u5b58<\/strong>\uff0c\u53ef\u4ee5\u5728\u591a\u4e2a\u7528\u6237\u4e4b\u95f4\u5171\u4eab\uff0c\u53ef\u4ee5\u653e\u5728\u8def\u5f84\u4e0a\u7684\u4ee3\u7406\u3001CDN\u3001\u53cd\u5411\u4ee3\u7406\u3001\u6d4f\u89c8\u5668\u7aef\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u53ef\u4ee5\u901a\u8fc7\u6807\u5934 Cache-Control \u6765\u63a7\u5236\u7f13\u5b58\u7b56\u7565\u3002<\/p>\n\n\n\n<p>Cache-Control \u7684\u6307\u4ee4\u53ef\u4ee5\u7ec4\u5408\u9002\u7528\uff08\u901a\u8fc7\u9017\u53f7\u5206\u9694\uff09\uff0c\u53ef\u9009\u6307\u4ee4\u5305\u542b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>public<\/strong>\uff0c\u58f0\u660e\u4e3a\u5171\u4eab\u7f13\u5b58\uff1b<\/li>\n\n\n\n<li><strong>private<\/strong>\uff0c\u58f0\u660e\u4e3a\u79c1\u6709\u7f13\u5b58\uff0c\u53ea\u80fd\u88ab\u7528\u6237\u6d4f\u89c8\u5668\u7f13\u5b58\uff1b<\/li>\n\n\n\n<li><strong>no-cache<\/strong>\uff0c\u5728\u7528\u7f13\u5b58\u8fdb\u884c\u54cd\u5e94\u524d\uff0c\u5fc5\u987b\u628a\u8bf7\u6c42\u63d0\u4ea4\u7ed9\u670d\u52a1\u5668\u9a8c\u8bc1\u6709\u6548\u6027\uff1b<\/li>\n\n\n\n<li><strong>no-store<\/strong>\uff0c\u7981\u7528\u7f13\u5b58\uff1b<\/li>\n\n\n\n<li><strong>max-age=&lt;\u79d2&gt;<\/strong>\uff0c\u7f13\u5b58\u5230\u671f\u65f6\u95f4\uff1b<\/li>\n\n\n\n<li><strong>s-maxage=&lt;\u79d2&gt;<\/strong>\uff0c\u8986\u76d6 max-aqge \u6216 Expires \u5934\uff0c\u4ec5\u9002\u7528\u5171\u4eab\u7f13\u5b58\uff1b<\/li>\n\n\n\n<li><strong>must-revalidate<\/strong>\uff0c\u8d44\u6e90\u8fc7\u671f\u540e\u5fc5\u987b\u5411\u670d\u52a1\u5668\u9a8c\u8bc1\uff0c\u5426\u5219\u4e0d\u80fd\u4f5c\u4e3a\u54cd\u5e94\uff1b<\/li>\n\n\n\n<li><strong>proxy-revalidate<\/strong>\uff0c\u5171\u4eab\u7f13\u5b58\u4e2d\u7684\u8d44\u6e90\u8fc7\u671f\u540e\u5fc5\u987b\u5411\u670d\u52a1\u5668\u9a8c\u8bc1\uff0c\u5426\u5219\u4e0d\u80fd\u63d0\u4f9b\uff1b<\/li>\n\n\n\n<li><strong>no-transform<\/strong>\uff0c\u4e0d\u5f97\u5bf9\u8d44\u6e90\u8fdb\u884c\u8f6c\u6362\u6216\u8f6c\u53d8\uff0c\u5982\u4ee3\u7406\u4e0d\u80fd\u4fee\u6539 Content-Encoding\u3001Content-Range\u3001Content-Type \u6807\u5934\u3002<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"663\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/image-32.png\" alt=\"\" class=\"wp-image-5650\"\/><figcaption class=\"wp-element-caption\"><sup><em>\u6d4f\u89c8\u5668\u7aef\u7684\u7f13\u5b58\u5c42\u6b21<\/em><\/sup><\/figcaption><\/figure>\n\n\n\n<p>6\u3001<strong>\u6301\u4e45\u8fde\u63a5<\/strong><\/p>\n\n\n\n<p>\u5728 HTTP\/1.1 \u4e4b\u524d\uff0c\u4e00\u4e2a HTTP \u8bf7\u6c42\u4f1a\u7533\u8bf7\u4e00\u4e2a TCP \u8fde\u63a5\uff0c\u8bf7\u6c42\u7ed3\u675f\u5373\u5173\u95ed\u8fde\u63a5\uff0c\u4e0b\u4e00\u4e2a\u8bf7\u6c42\u9700\u8981\u91cd\u65b0\u7533\u8bf7 TCP \u8fde\u63a5\u3002TCP \u8fde\u63a5\u7684\u5efa\u7acb\u662f\u901a\u8fc7\u4e09\u6b21\u63e1\u624b\uff0c\u4e5f\u5c31\u662f\u6bcf\u4e2a\u8bf7\u6c42\u81f3\u5c11\u9700\u8981\u5ef6\u8fdf\u4e00\u4e2a\u7f51\u7edc\u5f80\u8fd4\u65f6\u95f4\u624d\u80fd\u5f97\u5230\u54cd\u5e94\uff0c\u800c\u8fd9\u90e8\u5206\u5ef6\u8fdf\u662f\u53ef\u4ee5\u907f\u514d\u7684\u3002<\/p>\n\n\n\n<p>\u4e8e\u662f\u5728 HTTP\/1.1 \u4e2d\u5f15\u5165\u4e86\u6301\u4e45\u8fde\u63a5\uff0c\u4e00\u4e2a\u8bf7\u6c42\u7ed3\u675f\u540e\u5e76\u4e0d\u4f1a\u7acb\u5373\u5173\u95ed\u8be5 TCP \u8fde\u63a5\uff0c\u5141\u8bb8\u5176\u4ed6 HTTP \u8bf7\u6c42\u7ee7\u7eed\u901a\u8fc7\u5b83\u53d1\u9001\u6570\u636e\u3002\u5728 HTTP\/1.1 \u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b TCP \u8fde\u63a5\u662f\u6301\u4e45\u7684\uff0c\u53ea\u662f\u6709\u4e9b\u7a0b\u5e8f\u5e93\uff08\u51fa\u4e8e\u7b80\u5316\u7f16\u7a0b\u6a21\u578b\u7684\u76ee\u7684\uff09\u5728\u5b9e\u73b0\u65f6\u4f1a\u7b80\u5355\u65b0\u53d1\u8d77\u4e00\u4e2a TCP \u8fde\u63a5\u3002\u6301\u4e45\u8fde\u63a5\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u6807\u5934\u3010Connection: close\u3011\u6765\u5173\u95ed\u3002\u6240\u8c13\u7684\u6301\u4e45\u8fde\u63a5\uff0c\u5c31\u662f\u6307\u4fdd\u6301\u4f20\u8f93\u5c42\u7684 TCP \u8fde\u63a5\u6301\u4e45\u3002\u65e5\u5e38\u4e00\u822c\u7b80\u79f0\u957f\u8fde\u63a5\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"606\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/image-28.png\" alt=\"\" class=\"wp-image-5549\"\/><\/figure>\n\n\n\n<p>7\u3001<strong>\u907f\u514d\u91cd\u5b9a\u5411<\/strong><\/p>\n\n\n\n<p>\u91cd\u5b9a\u5411\u901a\u5e38\u4f1a\u5f15\u8d77\u4e00\u6b21 DNS \u89e3\u6790\u548c\u4e00\u6b21 TCP \u4e09\u6b21\u63e1\u624b\uff0c\u589e\u52a0\u4e86\u4e00\u5b9a\u7684\u5ef6\u8fdf\u3002<\/p>\n\n\n\n<p>8\u3001<strong>\u5408\u5e76\u9759\u6001\u6587\u4ef6<\/strong><\/p>\n\n\n\n<p>\u7531\u4e8e\u76ee\u524d\u7684\u7f51\u9875\u8d8a\u505a\u8d8a\u5927\uff0c\u4e00\u4e2a\u7f51\u9875\u901a\u5e38\u5305\u542b\u5f88\u591a\u9759\u6001\u6587\u4ef6\uff08JS\u3001CSS\u3001Image\u3001&#8230;\uff09\uff0c\u8d44\u6e90\u8d8a\u591a\uff0c\u8bf7\u6c42\u6570\u91cf\u8d8a\u591a\uff08\u8d44\u6e90\u8def\u5f84\u4e0d\u540c\u3001HTTP\/1.0 \u4e0d\u652f\u6301\u6301\u4e45\u8fde\u63a5\uff09\uff0c\u53ef\u4ee5\u5c06\u591a\u4e2a\u9759\u6001\u8d44\u6e90\u5408\u5e76\u4e3a\u5c11\u91cf\u7684\u51e0\u4e2a\uff0c\u8fd9\u6837 HTTP \u8bf7\u6c42\u4e5f\u76f8\u5e94\u5730\u51cf\u5c11\u4e86\u3002<\/p>\n\n\n\n<p>\u4f1a\u5f15\u5165\u4e00\u4e9b\u95ee\u9898\uff0c\u5982\u5f53\u67d0\u4e2a\u9759\u6001\u6587\u4ef6\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u9700\u8981\u91cd\u4f20\u6574\u4e2a\u5927\u7684\u9759\u6001\u6587\u4ef6\uff1b\u5f53\u67d0\u4e2a\u7f51\u9875\u53ea\u9700\u8981\u90e8\u5206\u9759\u6001\u8d44\u6e90\u65f6\uff0c\u5374\u5fc5\u987b\u8bf7\u6c42\u6574\u4e2a\u9759\u6001\u6587\u4ef6\uff0c\u591a\u4e86\u5f88\u591a\u4e0d\u9700\u8981\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<p>9\u3001<strong>\u57df\u540d\u5206\u533a<\/strong><\/p>\n\n\n\n<p>\u5728 HTTP\/1.x \u534f\u8bae\u4e2d\uff0c\u8981\u6c42\u6d4f\u89c8\u5668\u9488\u5bf9\u6bcf\u4e2a\u3010\u57df\u540d+\u7aef\u53e3\u3011\u7ef4\u62a4\u4e00\u4e2a\u8fde\u63a5\u6c60\uff0c\u6bcf\u4e2a\u8fde\u63a5\u6c60\u6700\u591a\u5305\u542b 6 \u4e2a TCP \u8fde\u63a5\uff0c\u5982\u679c\u4e0d\u591f\u7528\uff0c\u670d\u52a1\u7aef\u53ef\u4ee5\u8bbe\u8ba1\u4e0d\u540c\u7684\u3010\u57df\u540d+\u7aef\u53e3\u3011\u6765\u5206\u914d\u8d44\u6e90\uff0c\u4ee5\u7a81\u7834\u6d4f\u89c8\u5668\u7aef 6 \u4e2a TCP \u8fde\u63a5\u7684\u9650\u5236\uff0c\u63d0\u9ad8\u4f20\u8f93\u6548\u7387\u3002<\/p>\n\n\n\n<p>10\u3001<strong>\u591a\u4e2a TCP \u8fde\u63a5<\/strong><\/p>\n\n\n\n<p>\u5728 HTTP\/1.x \u4e2d\u4e0d\u652f\u6301\u591a\u8def\u590d\u7528\uff0c\u53ef\u4ee5\u521b\u5efa\u591a\u4e2a TCP \u8fde\u63a5\uff0c\u5e76\u884c\u8bf7\u6c42\u670d\u52a1\u7aef\u8d44\u6e90\u3002\u591a\u4e2a TCP \u8fde\u63a5\u4e5f\u53ef\u4ee5\u907f\u514d\u5355\u4e2a TCP \u6301\u4e45\u8fde\u63a5\u4e2d\u7684\u961f\u9996\u963b\u585e\u95ee\u9898\uff08\u56e0\u4e3a tcp \u4fdd\u969c\u6309\u5e8f\u4f20\u8f93\uff0c\u53d1\u9001\u5e8f\u5217\u4e2d\u7684\u67d0\u4e00\u4e2a\u5206\u7ec4\u4f20\u8f93\u5931\u8d25\uff0c\u540e\u7eed\u5206\u7ec4\u5230\u8fbe\u63a5\u6536\u7aef\u540e\u53ea\u80fd\u4fdd\u5b58\u5728 tcp \u7f13\u51b2\u533a\u4e2d\uff0c\u7b49\u5f85\u5931\u8d25\u7684\u5206\u7ec4\u91cd\u53d1\u5e76\u5230\u8fbe\u540e\u624d\u80fd\u4ea4\u4ed8\u7ed9\u5e94\u7528\u7a0b\u5e8f\uff09\u3002<\/p>\n\n\n\n<p>11\u3001<strong>\u5347\u7ea7\u5230 HTTP\/2<\/strong><\/p>\n\n\n\n<p>http\/2 \u5f15\u5165\u591a\u8def\u590d\u7528\u3001\u5934\u90e8\u538b\u7f29\u529f\u80fd\u548c\u6d41\u4f18\u5148\u7ea7\u7b49\u65b0\u7279\u6027\u3002<\/p>\n\n\n\n<p>\u591a\u8def\u590d\u7528\u662f\u5c06\u4e0d\u540c\u7684 http \u8bf7\u6c42\u5f53\u4f5c\u4e0d\u540c\u7684\u6d41\uff0c\u6bcf\u4e2a\u6d41\u7531\u82e5\u5e72\u5e27\u7ec4\u6210\uff0c\u4e0d\u540c\u6d41\u7684\u5e27\u53ef\u4ee5\u6df7\u6742\u653e\u5230\u4e00\u4e2a\u6301\u4e45\u8fde\u63a5\u4e2d\uff0c\u4ece\u800c\u8fbe\u5230\u591a\u4e2a\u8bf7\u6c42\u5171\u7528\u4e00\u4e2a TCP \u6301\u4e45\u8fde\u63a5\u7684\u6548\u679c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"422\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/image-26.png\" alt=\"\" class=\"wp-image-5533\"\/><\/figure>\n\n\n\n<p>HTTP\/2 \u5f15\u5165\u4e86\u5934\u90e8\u538b\u7f29\u529f\u80fd\uff0c\u5728\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u4fdd\u6301\u4e00\u4e2a\u5934\u90e8\u8868\u6765\u8ddf\u8e2a\u5934\u90e8\u7684\u952e\u503c\u5bf9\u3002\u80fd\u51cf\u5c11\u9700\u8981\u4f20\u8f93\u7684\u6570\u636e\u91cf\uff08\u5982 Cookie\u3001User-Agent\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"387\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/image-29.png\" alt=\"\" class=\"wp-image-5584\"\/><\/figure>\n\n\n\n<p>\u5728 HTTP\/2 \u4e2d\uff0c\u4e00\u4e2a\u3010\u57df\u540d+\u7aef\u53e3\u3011\u53ea\u5141\u8bb8\u5efa\u7acb\u4e00\u4e2a TCP \u8fde\u63a5\uff0c\u4e14\u8fd9\u4e2a\u8fde\u63a5\u662f\u6301\u4e45\u7684\u3002<\/p>\n\n\n\n<p>\u4e00\u822c HTTP\/2 \u4f1a\u76f4\u63a5\u642d\u914d TLS \u4f7f\u7528\uff0c\u5982\u5728 nginx \u4e2d\u5c31\u53ef\u4ee5\u5728 ssl \u540e\u914d http2\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"175\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/image-30.png\" alt=\"\" class=\"wp-image-5587\"\/><\/figure>\n\n\n\n<p>\u8fd9\u79cd\u6a21\u5f0f\u6ca1\u6709\u89e3\u51b3\u961f\u5934\u963b\u585e\u95ee\u9898\uff0c\u6240\u4ee5\u4e5f\u4e3a HTTP\/3 \u7559\u4e0b\u4e86\u60f3\u8c61\u7684\u7a7a\u95f4\u3002<\/p>\n\n\n\n<p>12\u3001<strong>Server Push<\/strong><\/p>\n\n\n\n<p>HTTP\/2 \u5f15\u5165\u7684\u65b0\u7279\u6027\u3002\u53d1\u9001\u4e00\u4e2a\u8bf7\u6c42\u540e\uff0c\u670d\u52a1\u7aef\u63a8\u9001\u591a\u4e2a\u54cd\u5e94\u3002\u4f46\u670d\u52a1\u7aef\u4e0d\u80fd\u4efb\u610f\u63a8\u9001\u54cd\u5e94\uff0c\u5fc5\u987b\u662f\u5728\u7b2c\u4e00\u4e2a\uff08initial\uff09\u8bf7\u6c42\u4e2d\u5305\u542b\u7684\u7279\u5b9a\u94fe\u63a5\u6240\u6307\u5411\u7684\u5185\u5bb9\u3002Push \u662f\u670d\u52a1\u7aef\u5230\u5ba2\u6237\u7aef\u7684\u4e00\u4e2a\u5355\u5411\u901a\u9053\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"629\" height=\"269\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/10\/image-27.png\" alt=\"\" class=\"wp-image-5541\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u53c2\u8003\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u300aWeb \u6027\u80fd\u6743\u5a01\u6307\u5357\u300b<\/li>\n\n\n\n<li>\u300aHTTP\/2 in Action\u300b<\/li>\n\n\n\n<li><a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/HTTP\" data-type=\"URL\" data-id=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/HTTP\">MDN<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7b56\u7565\u5c42\u9762\uff0c\uff08\u56db\u7ef4\u7a7a\u95f4\u9488\u5bf9\u6307\u5b9a\u95ee\u9898\u7edd\u5bf9\u590d\u6742\u6027\u7684\uff09\u666e\u9002\u4f18\u5316\u624b\u6bb5\u6700\u7ec8\u90fd\u662f\u5728\u4e24\u79cd\u7ef4\u5ea6\u4e4b\u95f4\u8fdb\u884c\u53d6\u820d\u8f6c\u6362\uff1a \u4ee5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,2],"tags":[118,117,116,115],"class_list":["post-5397","post","type-post","status-publish","format-standard","hentry","category-code","category-2","tag-http","tag-performance","tag-web","tag-115"],"_links":{"self":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/5397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5397"}],"version-history":[{"count":259,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/5397\/revisions"}],"predecessor-version":[{"id":6796,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/5397\/revisions\/6796"}],"wp:attachment":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}