{"id":107283,"date":"2024-10-19T23:08:10","date_gmt":"2024-10-19T15:08:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=107283"},"modified":"2024-10-19T23:08:10","modified_gmt":"2024-10-19T15:08:10","slug":"http-learning","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/http-learning.html","title":{"rendered":"HTTP\u534f\u8bae\u5b66\u4e60"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff08HTTP\uff0cHyperText Transfer Protocol)\u662f\u4e92\u8054\u7f51\u4e0a\u5e94\u7528\u6700\u4e3a\u5e7f\u6cdb\u7684\u4e00\u79cd\u7f51\u7edc\u534f\u8bae\u3002\u6240\u6709\u7684WWW\u6587\u4ef6\u90fd\u5fc5\u987b\u9075\u5b88\u8fd9\u4e2a\u6807\u51c6\u3002\u8bbe\u8ba1HTTP\u6700\u521d\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u63d0\u4f9b\u4e00\u79cd\u53d1\u5e03\u548c\u63a5\u6536HTML\u9875\u9762\u7684\u65b9\u6cd5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00 HTTP\u534f\u8bae\u7b80\u4ecb<\/strong><\/div>\n

\u4f5c\u4e3a\u5b66\u4e60\u524d\u7aef\u5f00\u53d1\u7684\u5f00\u59cb\uff0c\u6211\u4eec\u5fc5\u987b\u641e\u660e\u767d\u4ee5\u4e0b\u51e0\u4ef6\u4e8b<\/p>\n

1\u3001\u4ec0\u4e48\u662f\u4e92\u8054\u7f51<\/p>\n

\u4e92\u8054\u7f51=\u7269\u7406\u8fde\u63a5\u4ecb\u8d28+\u4e92\u8054\u7f51\u534f\u8bae<\/p>\n

2\u3001\u4e92\u8054\u7f51\u5efa\u7acb\u7684\u76ee\u7684\uff1f<\/p>\n

\u6570\u636e\u4f20\u8f93\u6253\u7834\u5730\u57df\u9650\u5236\uff0c\u5426\u5219\u7684\u8bdd\uff0c\u6211\u60f3\u83b7\u5f97\u5bf9\u65b9\u4e3b\u673a\u4e0a\u7684\u6570\u636e\uff0c\u53ea\u80fd\u62ff\u7740\u786c\u76d8\u53bb\u5bf9\u65b9\u4e3b\u673a\u62f7\u8d1d<\/p>\n

3\u3001\u4ec0\u4e48\u662f\u4e0a\u7f51\uff1f<\/p>\n

\u7528\u6237\u4e0a\u7f51\u7684\u8fc7\u7a0b\u5373\u6d4f\u89c8\u5668\u5411\u670d\u52a1\u7aef\u53d1\u9001\u8bf7\u6c42\uff0c\u7136\u540e\u5c06\u670d\u52a1\u7aef\u4e3b\u673a\u7684\u6587\u672c\u6587\u4ef6\u4e0b\u8f7d\u5230\u672c\u5730\u663e\u793a\u7684\u8fc7\u7a0b\u3002\u800c\u6d4f\u89c8\u5668\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u8d70\u7684HTTP\u534f\u8bae\u3002<\/p>\n

\u6211\u4eec\u5b66\u4e60\u524d\u7aef\u5f00\u53d1\u5c31\u662f\u4e3a\u4e86\u7f16\u6392\u597d\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\u5b58\u653e\u5230\u670d\u52a1\u7aef\u4e3b\u673a\uff0c\u7136\u540e\u63d0\u4f9b\u7ed9\u6d4f\u89c8\u5668\u4e0b\u8f7d\u663e\u793a\u7684(\u6d4f\u89c8\u5668\u5ba2\u6237\u7aef\u4e3b\u8981\u6709\u4e24\u4e2a\u529f\u80fd\uff0c\u4e00\u662f\u5411\u670d\u52a1\u7aef\u53d1\u9001\u8bf7\u6c42\u4e0b\u8f7d\u6307\u4ee4\uff0c\u4e8c\u662f\u5c06\u63a5\u6536\u5230\u7684\u4ee3\u7801\u6570\u636e\u6e32\u67d3\u6210\u7528\u6237\u53ef\u4ee5\u6d4f\u89c8\u7684\u7f51\u9875)\u6240\u4ee5\u5728\u5b66\u4e60\u524d\u7aef\u5f00\u53d1\u524d\uff0c\u6211\u4eec\u5fc5\u987b\u5148\u7814\u7a76HTTP\u534f\u8bae<\/p>\n

\u672c\u7bc7\u6587\u7ae0\u4ee5\u524d\u5c31\u53d1\u5e03\u8fc7\uff0c\u88ab\u5f88\u591a\u6280\u672f\u6280\u672f\u540c\u597d\u591a\u6b21\u8f6c\u8f7d\uff0c\u7531\u4e8e\u5f53\u65f6\u6587\u7ae0\u5206\u7c7b\u6807\u7b7e\u4f7f\u7528\u4e0d\u5f53\uff0c\u540e\u6765\u5220\u9664\u4e86\uff0c\u5728\u4e00\u6b21\u5199\u8fd9\u7bc7\u6587\u7ae0\uff0c\u4e00\u4e2a\u662f\u56de\u987e\u4ee5\u524d\u7684\u5185\u5bb9\uff0c\u800c\u662f\u5e0c\u671b\u80fd\u591f\u66f4\u597d\u7684\u7406\u89e3\u5206\u4eab\u7ed9\u5927\u5bb6<\/p>\n

\r\n#1\u3001HTTP\u534f\u8bae\uff0c\u5168\u79f0Hyper Text Transfer Protocol\uff08\u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff09 HTTP\u534f\u8bae\u662f\u7528\u4e8e\u4ece\uff08WWW:World Wide Web\uff0c\u7b80\u4e07\u7ef4\u7f51 \uff09\u670d\u52a1\u5668\u4f20\u8f93\u8d85\u6587\u672c\u5230\u672c\u5730\u6d4f\u89c8\u5668\u7684\u4f20\u9001\u534f\u8bae\u3002#2\u3001HTTP\u534f\u8bae\u5de5\u4f5c\u4e8eB\/S\u67b6\u6784\u4e0a \u6d4f\u89c8\u5668\u4f5c\u4e3aHTTP\u5ba2\u6237\u7aef\u901a\u8fc7URL\u5411HTTP\u670d\u52a1\u7aef\u5373WEB\u670d\u52a1\u5668\u53d1\u9001\u8bf7\u6c42Request\u3002 Web\u670d\u52a1\u5668\u6839\u636e\u63a5\u6536\u5230\u7684\u8bf7\u6c42\u540e\uff0c\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u54cd\u5e94\u4fe1\u606fResponse\u3002#3\u3001HTTP\u534f\u8bae\u662f\u57fa\u4e8eTCP\/IP\u901a\u4fe1\u534f\u8bae\u6765\u4f20\u9012\u6570\u636e\u7684\uff08HTML \u6587\u4ef6, \u56fe\u7247\u6587\u4ef6\u7b49\uff09\r\n<\/pre>\n

\"\"<\/p>\n

\u8fc4\u4eca\u4e3a\u6b62\uff0cHTTP\u534f\u8bae\u7684\u53d1\u5c55\u7ecf\u5386\u4e863\u4e2a\u7248\u672c\u7684\u6f14\u5316<\/p>\n

\r\n\u7b2c\u4e00\u4e2aHTTP\u534f\u8bae\u8bde\u751f\u4e8e1989\u5e743\u6708,\u5df2\u8fc7\u65f6\u3002\r\n#\u4e00\uff1a\u5b83\u7684\u7ec4\u6210\u6781\u5176\u7b80\u5355:#1\u3001\u53ea\u5141\u8bb8\u5ba2\u6237\u7aef\u53d1\u9001GET\u8fd9\u4e00\u79cd\u8bf7\u6c42\r\n#2\u3001\u4e0d\u652f\u6301\u8bf7\u6c42\u5934\u3002\r\n#3\u3001\u7531\u4e8e\u6ca1\u6709\u8bf7\u6c42\u5934\uff0c\u9020\u6210\u4e86HTTP 0.9\u534f\u8bae\u53ea\u652f\u6301\u4e00\u79cd\u5185\u5bb9\uff0c\u5373\u7eaf\u6587\u672c\u3002\u4e0d\u8fc7\u7f51\u9875\u4ecd\u7136\u652f\u6301\u7528HTML\u8bed\u8a00\u683c\u5f0f\u5316\uff0c\u540c\u65f6\u65e0\u6cd5\u63d2\u5165\u56fe\u7247\u3002\r\n\r\n#\u4e8c\uff1a\u65e0\u72b6\u6001\u6027\r\n#1\u3001HTTP 0.9\u5177\u6709\u5178\u578b\u7684\u65e0\u72b6\u6001\u6027\uff0c\u6bcf\u4e2a\u4e8b\u52a1\u72ec\u7acb\u8fdb\u884c\u5904\u7406\uff0c\u4e8b\u52a1\u7ed3\u675f\u65f6\u5c31\u91ca\u653e\u8fd9\u4e2a\u8fde\u63a5\u3002\u8be6\u7ec6\u89e3\u91ca\u5982\u4e0b\uff1a\u4e00\u6b21HTTP 0.9\u7684\u4f20\u8f93\u9996\u5148\u8981\u5efa\u7acb\u4e00\u4e2a\u7531\u5ba2\u6237\u7aef\u5230Web\u670d\u52a1\u5668\u7684TCP\u8fde\u63a5\uff0c\u7531\u5ba2\u6237\u7aef\u53d1\u8d77\u4e00\u4e2a\u8bf7\u6c42\uff0c\u7136\u540e\u7531Web\u670d\u52a1\u5668\u8fd4\u56de\u9875\u9762\u5185\u5bb9\uff0c\u7136\u540e\u8fde\u63a5\u4f1a\u5173\u95ed\u3002\u5982\u679c\u8bf7\u6c42\u7684\u9875\u9762\u4e0d\u5b58\u5728\uff0c\u4e5f\u4e0d\u4f1a\u8fd4\u56de\u4efb\u4f55\u9519\u8bef\u7801\u3002\r\n#2\u3001\u7531\u6b64\u53ef\u89c1\uff0cHTTP\u534f\u8bae\u7684\u65e0\u72b6\u6001\u7279\u70b9\u5728\u5176\u7b2c\u4e00\u4e2a\u7248\u672c0.9\u4e2d\u5df2\u7ecf\u6210\u578b\u3002\r\n\r\n#\u4e09 \uff1aHTTP 0.9\u534f\u8bae\u6587\u6863\uff1ahttp:\/\/www.w3.org\/Protocols\/HTTP\/AsImplemented.html\r\n<\/pre>\n
\r\nHTTP\/1.0\u662fHTTP\u534f\u8bae\u7684\u7b2c\u4e8c\u4e2a\u7248\u672c\uff0c\u81f3\u4eca\u4ecd\u88ab\u5e7f\u6cdb\u91c7\u7528\u3002\u9996\u6b21\u5728\u901a\u8baf\u4e2d\u6307\u5b9a\u7248\u672c\u53f7\uff0c\u76f8\u5bf9\u4e8eHTTP 0.9 \u589e\u52a0\u4e86\u5982\u4e0b\u4e3b\u8981\u7279\u6027\uff1a\r\n#1\u3001\u652f\u6301\u8bf7\u6c42\u5934\u4e0e\u54cd\u5e94\u5934\r\n\r\n#2\u3001Response\u54cd\u5e94\u4ee5\u4e00\u4e2a\u54cd\u5e94\u72b6\u6001\u884c\u5f00\u59cb\uff0cResponse\u5305\u542b\u7684\u5185\u5bb9\u4e0d\u53ea\u9650\u4e8e\u8d85\u6587\u672c\r\n\r\n#3\u3001\u5f00\u59cb\u652f\u6301\u5ba2\u6237\u7aef\u901a\u8fc7POST\u65b9\u6cd5\u5411Web\u670d\u52a1\u5668\u63d0\u4ea4\u6570\u636e\uff0c\u5e76\u652f\u6301GET\u3001HEAD\u3001POST\u65b9\u6cd5\r\n\r\n#4\u3001\u652f\u6301\u957f\u8fde\u63a5Keepalive\uff08\u4f46\u9ed8\u8ba4\u8fd8\u662f\u4f7f\u7528\u77ed\u8fde\u63a5\uff09\r\n\r\n#5\u3001\u7f13\u5b58\u673a\u5236\u4ee5\u53ca\u8eab\u4efd\u8ba4\u8bc1\r\n<\/pre>\n

\u8bf7\u770b\u4e0b\u9762\u7684\u4ecb\u7ecd\uff0c\u73b0\u5728\u4e3b\u8981\u5728\u7528\u7684\u5c31\u662f1.1<\/p>\n

\r\nHTTP 2.0\u662f\u4e0b\u4e00\u4ee3HTTP\u534f\u8bae\uff0c\u76ee\u524d\u5e94\u7528\u8fd8\u975e\u5e38\u5c11\u3002\r\n\u4e3b\u8981\u7279\u70b9\u6709\uff1a\r\n#1\u3001\u591a\u8def\u590d\u7528\uff08\u4e8c\u8fdb\u5236\u5206\u5e27\uff09HTTP 2.0\u6700\u5927\u7684\u7279\u70b9: \u4e0d\u4f1a\u6539\u52a8HTTP \u7684\u8bed\u4e49\uff0cHTTP \u65b9\u6cd5\u3001\u72b6\u6001\u7801\u3001URI \u53ca\u9996\u90e8\u5b57\u6bb5\uff0c\u7b49\u7b49\u8fd9\u4e9b\u6838\u5fc3\u6982\u5ff5\u4e0a\u4e00\u5982\u5f80\u5e38\uff0c\u5374\u80fd\u81f4\u529b\u4e8e\u7a81\u7834\u4e0a\u4e00\u4ee3\u6807\u51c6\u7684\u6027\u80fd\u9650\u5236\uff0c\u6539\u8fdb\u4f20\u8f93\u6027\u80fd\uff0c\u5b9e\u73b0\u4f4e\u5ef6\u8fdf\u548c\u9ad8\u541e\u5410\u91cf\u3002\u800c\u4e4b\u6240\u4ee5\u53eb2.0\uff0c\u662f\u5728\u4e8e\u65b0\u589e\u7684\u4e8c\u8fdb\u5236\u5206\u5e27\u5c42\u3002\u5728\u4e8c\u8fdb\u5236\u5206\u5e27\u5c42\u4e0a\uff0c HTTP 2.0 \u4f1a\u5c06\u6240\u6709\u4f20\u8f93\u7684\u4fe1\u606f\u5206\u5272\u4e3a\u66f4\u5c0f\u7684\u6d88\u606f\u548c\u5e27,\u5e76\u5bf9\u5b83\u4eec\u91c7\u7528\u4e8c\u8fdb\u5236\u683c\u5f0f\u7684\u7f16\u7801 \uff0c\u5176\u4e2dHTTP1.x\u7684\u9996\u90e8\u4fe1\u606f\u4f1a\u88ab\u5c01\u88c5\u5230Headers\u5e27\uff0c\u800c\u6211\u4eec\u7684request body\u5219\u5c01\u88c5\u5230Data\u5e27\u91cc\u9762\u3002 HTTP 2.0 \u901a\u4fe1\u90fd\u5728\u4e00\u4e2a\u8fde\u63a5\u4e0a\u5b8c\u6210\uff0c\u8fd9\u4e2a\u8fde\u63a5\u53ef\u4ee5\u627f\u8f7d\u4efb\u610f\u6570\u91cf\u7684\u53cc\u5411\u6570\u636e\u6d41\u3002\u76f8\u5e94\u5730\uff0c\u6bcf\u4e2a\u6570\u636e\u6d41\u4ee5\u6d88\u606f\u7684\u5f62\u5f0f\u53d1\u9001\uff0c\u800c\u6d88\u606f\u7531\u4e00\u6216\u591a\u4e2a\u5e27\u7ec4\u6210\uff0c\u8fd9\u4e9b\u5e27\u53ef\u4ee5\u4e71\u5e8f\u53d1\u9001\uff0c\u7136\u540e\u518d\u6839\u636e\u6bcf\u4e2a\u5e27\u9996\u90e8\u7684\u6d41\u6807\u8bc6\u7b26\u91cd\u65b0\u7ec4\u88c5\u3002\r\n#2\u3001\u5934\u90e8\u538b\u7f29\u5f53\u4e00\u4e2a\u5ba2\u6237\u7aef\u5411\u76f8\u540c\u670d\u52a1\u5668\u8bf7\u6c42\u8bb8\u591a\u8d44\u6e90\u65f6\uff0c\u50cf\u6765\u81ea\u540c\u4e00\u4e2a\u7f51\u9875\u7684\u56fe\u50cf\uff0c\u5c06\u4f1a\u6709\u5927\u91cf\u7684\u8bf7\u6c42\u770b\u4e0a\u53bb\u51e0\u4e4e\u540c\u6837\u7684\uff0c\u8fd9\u5c31\u9700\u8981\u538b\u7f29\u6280\u672f\u5bf9\u4ed8\u8fd9\u79cd\u51e0\u4e4e\u76f8\u540c\u7684\u4fe1\u606f\u3002\r\n#3\u3001\u968f\u65f6\u590d\u4f4dHTTP1.1\u4e00\u4e2a\u7f3a\u70b9\u662f\u5f53HTTP\u4fe1\u606f\u6709\u4e00\u5b9a\u957f\u5ea6\u5927\u5c0f\u6570\u636e\u4f20\u8f93\u65f6\uff0c\u4f60\u4e0d\u80fd\u65b9\u4fbf\u5730\u968f\u65f6\u505c\u6b62\u5b83\uff0c\u4e2d\u65adTCP\u8fde\u63a5\u7684\u4ee3\u4ef7\u662f\u6602\u8d35\u7684\u3002\u4f7f\u7528HTTP2\u7684RST_STREAM\u5c06\u80fd\u65b9\u4fbf\u505c\u6b62\u4e00\u4e2a\u4fe1\u606f\u4f20\u8f93\uff0c\u542f\u52a8\u65b0\u7684\u4fe1\u606f\uff0c\u5728\u4e0d\u4e2d\u65ad\u8fde\u63a5\u7684\u60c5\u51b5\u4e0b\u63d0\u9ad8\u5e26\u5bbd\u5229\u7528\u6548\u7387\u3002\r\n#4\u3001\u670d\u52a1\u5668\u7aef\u63a8\u6d41: Server Push\u5ba2\u6237\u7aef\u8bf7\u6c42\u4e00\u4e2a\u8d44\u6e90X\uff0c\u670d\u52a1\u5668\u7aef\u5224\u65ad\u4e5f\u8bb8\u5ba2\u6237\u7aef\u8fd8\u9700\u8981\u8d44\u6e90Z\uff0c\u5728\u65e0\u9700\u4e8b\u5148\u8be2\u95ee\u5ba2\u6237\u7aef\u60c5\u51b5\u4e0b\u5c06\u8d44\u6e90Z\u63a8\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u5ba2\u6237\u7aef\u63a5\u53d7\u5230\u540e\uff0c\u53ef\u4ee5\u7f13\u5b58\u8d77\u6765\u4ee5\u5907\u540e\u7528\u3002\r\n#5\u3001\u4f18\u5148\u6743\u548c\u4f9d\u8d56\u6bcf\u4e2a\u6d41\u90fd\u6709\u81ea\u5df1\u7684\u4f18\u5148\u7ea7\u522b\uff0c\u4f1a\u8868\u660e\u54ea\u4e2a\u6d41\u662f\u6700\u91cd\u8981\u7684\uff0c\u5ba2\u6237\u7aef\u4f1a\u6307\u5b9a\u54ea\u4e2a\u6d41\u662f\u6700\u91cd\u8981\u7684\uff0c\u6709\u4e00\u4e9b\u4f9d\u8d56\u53c2\u6570\uff0c\u8fd9\u6837\u4e00\u4e2a\u6d41\u53ef\u4ee5\u4f9d\u8d56\u53e6\u5916\u4e00\u4e2a\u6d41\u3002\u4f18\u5148\u7ea7\u522b\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u6539\u53d8\uff0c\u5f53\u7528\u6237\u6eda\u52a8\u9875\u9762\u65f6\uff0c\u53ef\u4ee5\u544a\u8bc9\u6d4f\u89c8\u5668\u54ea\u4e2a\u56fe\u50cf\u662f\u6700\u91cd\u8981\u7684\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5728\u4e00\u7ec4\u6d41\u4e2d\u8fdb\u884c\u4f18\u5148\u7b5b\u9009\uff0c\u80fd\u591f\u7a81\u7136\u6293\u4f4f\u91cd\u70b9\u6d41\u3002\r\n<\/pre>\n

HTTP\/1.1\u8be6\u89e3<\/p>\n

HTTP\/1.1\u662fHTTP\u534f\u8bae\u7684\u7b2c\u4e09\u4e2a\u7248\u672c\uff0c\u662f\u76ee\u524d\u4e3b\u6d41\u7684HTTP\u534f\u8bae\u7248\u672c<\/p>\n

HTTP 1.1\u5f15\u5165\u4e86\u8bb8\u591a\u5173\u952e\u6027\u80fd\u4f18\u5316\uff1akeepalive\u8fde\u63a5\uff0c\u8bf7\u6c42\u6d41\u6c34\u7ebf\uff0cchunked\u7f16\u7801\u4f20\u8f93\uff0c\u5b57\u8282\u8303\u56f4\u8bf7\u6c42\u7b49<\/p>\n

1\u3001Persistent Connection\uff08keepalive\u8fde\u63a5\uff09<\/p>\n

\u5141\u8bb8HTTP\u8bbe\u5907\u5728\u4e8b\u52a1\u5904\u7406\u7ed3\u675f\u4e4b\u540e\u5c06TCP\u8fde\u63a5\u4fdd\u6301\u5728\u6253\u5f00\u7684\u72b6\u6001\uff0c\u4ee5\u4fbf\u672a\u6765\u7684HTTP\u8bf7\u6c42\u91cd\u7528\u73b0\u5728\u7684\u8fde\u63a5\uff0c\u76f4\u5230\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u51b3\u5b9a\u5c06\u5176\u5173\u95ed\u4e3a\u6b62\u3002
\nHTTP1.1\u5bf9\u6bd4HTTP1.0?\u5728HTTP1.0\u4e2d\u4f7f\u7528\u957f\u8fde\u63a5\u9700\u8981\u6dfb\u52a0\u8bf7\u6c42\u5934 Connection: Keep-Alive\uff0c\u800c\u5728HTTP 1.1 \u6240\u6709\u7684\u8fde\u63a5\u9ed8\u8ba4\u90fd\u662f\u957f\u8fde\u63a5\uff0c\u9664\u975e\u7279\u6b8a\u58f0\u660e\u4e0d\u652f\u6301\uff08 HTTP\u8bf7\u6c42\u62a5\u6587\u9996\u90e8\u52a0\u4e0aConnection: close \uff09
\n\"\"<\/p>\n

2\u3001Pipelining\uff08\u8bf7\u6c42\u6d41\u6c34\u7ebf\uff09<\/p>\n

# \u8bf7\u6c42\u6d41\u6c34\u7ebf\u5de5\u4f5c\u539f\u7406
\nA client that supports persistent connections MAY \"pipeline\" its requests (i.e., send multiple requests without waiting for each response). A server MUST send its responses to those requests in the same order that the requests were received. \u652f\u6301\u6301\u4e45\u8fde\u63a5\u7684\u5ba2\u6237\u7aef\u53ef\u4ee5\u201c\u6d41\u6c34\u7ebf\u201d\u5b83\u7684\u8bf7\u6c42\uff08\u5373\uff0c\u53d1\u9001\u591a\u4e2a\u8bf7\u6c42\u800c\u65e0\u9700\u7b49\u5f85\u6bcf\u4e2a\u54cd\u5e94\uff09\u3002\u670d\u52a1\u5668\u5fc5\u987b\u6309\u7167\u4e0e\u6536\u5230\u8bf7\u6c42\u7684\u76f8\u540c\u987a\u5e8f\u6765\u5411\u8fd9\u4e9b\u8bf7\u6c42\u53d1\u9001\u54cd\u5e94\u3002<\/p>\n

\"\"<\/p>\n

\u5ba2\u6237\u7aef\u53d1\u9001\u8bf7\u6c42\u4e4b\u540e\uff0c\u4e0d\u9700\u8981\u7b49\u6536\u5230\u8fd4\u56de\u7ed3\u679c\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728\u53d1\u9001\u7b2c\u4e8c\u6b21\u8bf7\u6c42\uff0c\u4f46\u662f\u5148\u53d1\u9001\u7684\u8bf7\u6c42\u80af\u5b9a\u662f\u5148\u6536\u5230\u8fd4\u56de\u7ed3\u679c\uff0c\u5c31\u50cf\u662f\u65b9\u4fbf\u5de5\u5382\u7684\u751f\u4ea7\u6d41\u6c34\u7ebf\uff0c\u673a\u5668\u4e0a\u80af\u5b9a\u4e0d\u662f\u4e00\u888b\u65b9\u4fbf\u9762\u5728\u751f\u4ea7\u5236\u9020<\/p>\n

3\u3001chunked\u7f16\u7801\u4f20\u8f93<\/p>\n

\r\n#1\u3001\u4ecb\u7ecd\u8be5\u7f16\u7801\u5c06\u5b9e\u4f53\u5206\u5757\u4f20\u9001\u5e76\u9010\u5757\u6807\u660e\u957f\u5ea6,\u76f4\u5230\u957f\u5ea6\u4e3a0\u5757\u8868\u793a\u4f20\u8f93\u7ed3\u675f, \u8fd9\u5728\u5b9e\u4f53\u957f\u5ea6\u672a\u77e5\u65f6\u7279\u522b\u6709\u7528(\u6bd4\u5982\u7531\u6570\u636e\u5e93\u52a8\u6001\u4ea7\u751f\u7684\u6570\u636e)\r\n\r\n#2\u3001\u4f20\u8f93\u7f16\u7801\u548c\u5206\u5757\u7f16\u7801\u5f53\u54cd\u5e94\u5934\u91cc\u5305\u542bTransfer-Encoding: chunked\uff0c\u4ee3\u8868\u5206\u5757\u7f16\u7801\uff0c\u4f1a\u628a\u300c\u62a5\u6587\u300d\u5206\u5272\u6210\u82e5\u5e72\u4e2a\u5927\u5c0f\u5df2\u77e5\u7684\u5757\uff0c\u5757\u4e4b\u95f4\u662f\u7d27\u6328\u7740\u53d1\u9001\u7684\uff0c\u8fd9\u6837\u5c31\u4e0d\u9700\u8981\u5728\u53d1\u9001\u4e4b\u524d\u77e5\u9053\u6574\u4e2a\u62a5\u6587\u7684\u5927\u5c0f\u4e86\uff0c\u4e5f\u610f\u5473\u7740\u4e0d\u9700\u8981\u5199\u56deContent-Length\u9996\u90e8\u4e86\u3002\r\n\r\n#3\u3001\u5206\u5757\u4f20\u8f93\u7684\u5e94\u7528\u5f53\u4f7f\u7528\u6301\u4e45\u8fde\u63a5\u65f6\uff0c\u5728\u670d\u52a1\u5668\u53d1\u9001\u4e3b\u4f53\u5185\u5bb9\u4e4b\u524d\uff0c\u5fc5\u987b\u8ba1\u7b97\u51fa\u4e3b\u4f53\u5185\u5bb9\u7684\u5927\u5c0f\uff0c\u7136\u540e\u653e\u5230\u54cd\u5e94\u5934\u91cc\uff08Content-Length\uff1a\u4e3b\u4f53\u7684\u5b57\u8282\u6570\uff09\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u3002 \u5982\u679c\u670d\u52a1\u5668\u52a8\u6001\u521b\u5efa\u5185\u5bb9\uff0c\u53ef\u80fd\u5728\u53d1\u9001\u4e4b\u524d\u65e0\u6cd5\u77e5\u9053\u4e3b\u4f53\u5927\u5c0f\uff0c\u5206\u5757\u7f16\u7801\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u8fd9\u79cd\u60c5\u51b5\uff1a\u670d\u52a1\u5668\u628a\u4e3b\u4f53\u9010\u5757\u53d1\u9001\uff0c\u8bf4\u660e\u6bcf\u4e00\u5757\u7684\u5927\u5c0f\u3002\u670d\u52a1\u5668\u518d\u7528\u5927\u5c0f\u4e3a0\u7684\u5757\u4f5c\u4e3a\u7ed3\u675f\u5757\u3002\uff0c\u4e3a\u4e0b\u4e00\u4e2a\u54cd\u5e94\u505a\u51c6\u5907\uff0c\u6b64\u65f6\u54cd\u5e94\u5934\u91cc\u4fbf\u4e0d\u518d\u9700\u8981Content-Length\u4e86 \u9664\u975e\u4f7f\u7528\u4e86\u5206\u5757\u7f16\u7801Transfer-Encoding: chunked\uff0c\u5426\u5219\u54cd\u5e94\u5934\u9996\u90e8\u5fc5\u987b\u4f7f\u7528Content-Length\u9996\u90e8\u3002 \u6458\u81eaHTTP\/1.1\uff1ahttps:\/\/tools.ietf.org\/html\/rfc2616\u3001\r\n\r\n#4\u3001\u5173\u4e8eContent-Length\u9996\u90e8\uff1a\u5982\u679c\u8bf7\u6c42\u5934\u5305\u542bAccept-Encoding': 'gzip'\uff0c\u5219\u670d\u52a1\u7aef\u4f1a\u5c06\u5185\u5bb9\u538b\u7f29\u540e\u8fd4\u56de\uff0c\u5185\u5bb9\u7684Content-Length\u957f\u5ea6\u662f\u538b\u7f29\u540e\u7684\u957f\u5ea6\uff0c\u5982\u679c\u8bf7\u6c42\u5934\u4e0d\u5305\u542bAccept-Encoding': 'gzip'\uff0c\u670d\u52a1\u5668\u5c31\u4e0d\u4f1a\u91c7\u53d6gzip\u538b\u7f29\uff0c\u540c\u65f6\u6211\u53f8\u670d\u52a1\u5668\u8bbe\u5b9a\u4e5f\u4e0d\u8fdb\u884c\u5206\u5757\u7f16\u7801\u3002\u6240\u4ee5\u8fd4\u56de\u54cd\u5e94\u5934\u7684Content-Length\u9996\u90e8\u662f\u5fc5\u987b\u7684\uff0c\u4f46\u662f\u8fd9\u4e2a\u503c\u7684\u5927\u5c0f\u80af\u5b9a\u662f\u6ca1\u6709\u8fdb\u884c\u8fc7\u538b\u7f29\u7684\u6587\u4ef6\u5927\u5c0f\u3002\r\n<\/pre>\n

4\u3001\u5b57\u8282\u8303\u56f4\u8bf7\u6c42<\/p>\n

HTTP1.1\u652f\u6301\u4f20\u9001\u5185\u5bb9\u7684\u4e00\u90e8\u5206\u3002\u6bd4\u65b9\u8bf4\uff0c\u5f53\u5ba2\u6237\u7aef\u5df2\u7ecf\u6709\u5185\u5bb9\u7684\u4e00\u90e8\u5206\uff0c\u4e3a\u4e86\u8282\u7701\u5e26\u5bbd\uff0c\u53ef\u4ee5\u53ea\u5411\u670d\u52a1\u5668\u8bf7\u6c42\u4e00\u90e8\u5206\u3002\u8be5\u529f\u80fd\u901a\u8fc7\u5728\u8bf7\u6c42\u6d88\u606f\u4e2d\u5f15\u5165\u4e86range\u5934\u57df\u6765\u5b9e\u73b0\uff0c\u5b83\u5141\u8bb8\u53ea\u8bf7\u6c42\u8d44\u6e90\u7684\u67d0\u4e2a\u90e8\u5206\u3002\u5728\u54cd\u5e94\u6d88\u606f\u4e2dContent-Range\u5934\u57df\u58f0\u660e\u4e86\u8fd4\u56de\u7684\u8fd9\u90e8\u5206\u5bf9\u8c61\u7684\u504f\u79fb\u503c\u548c\u957f\u5ea6\u3002\u5982\u679c\u670d\u52a1\u5668\u76f8\u5e94\u5730\u8fd4\u56de\u4e86\u5bf9\u8c61\u6240\u8bf7\u6c42\u8303\u56f4\u7684\u5185\u5bb9\uff0c\u5219\u54cd\u5e94\u7801206\uff08Partial Content\uff09<\/p>\n

HTTP 1.1\u8fd8\u65b0\u589e\u4e86\u5982\u4e0b\u7279\u6027\uff1a<\/p>\n

\r\n#1\u3001\u8bf7\u6c42\u6d88\u606f\u548c\u54cd\u5e94\u6d88\u606f\u90fd\u5e94\u652f\u6301Host\u5934\u57df\u5728HTTP1.0\u4e2d\u8ba4\u4e3a\u6bcf\u53f0\u670d\u52a1\u5668\u90fd\u7ed1\u5b9a\u4e00\u4e2a\u552f\u4e00\u7684IP\u5730\u5740\uff0c\u56e0\u6b64\uff0c\u8bf7\u6c42\u6d88\u606f\u4e2d\u7684URL\u5e76\u6ca1\u6709\u4f20\u9012\u4e3b\u673a\u540d\uff08hostname\uff09\u3002\u4f46\u968f\u7740\u865a\u62df\u4e3b\u673a\u6280\u672f\u7684\u53d1\u5c55\uff0c\u5728\u4e00\u53f0\u7269\u7406\u670d\u52a1\u5668\u4e0a\u53ef\u4ee5\u5b58\u5728\u591a\u4e2a\u865a\u62df\u4e3b\u673a\uff08Multi-homed Web Servers\uff09\uff0c\u5e76\u4e14\u5b83\u4eec\u5171\u4eab\u4e00\u4e2aIP\u5730\u5740\u3002\u56e0\u6b64\uff0cHost\u5934\u7684\u5f15\u5165\u5c31\u5f88\u6709\u5fc5\u8981\u4e86\u3002\r\n\r\n#2\u3001\u65b0\u589e\u4e86\u4e00\u6279Request methodHTTP1.1\u589e\u52a0\u4e86OPTIONS,PUT, DELETE, TRACE, CONNECT\u65b9\u6cd5\r\n\r\n#3\u3001\u7f13\u5b58\u5904\u7406HTTP\/1.1\u57281.0\u7684\u57fa\u7840\u4e0a\u52a0\u5165\u4e86\u4e00\u4e9bcache\u7684\u65b0\u7279\u6027\uff0c\u5f15\u5165\u4e86\u5b9e\u4f53\u6807\u7b7e\uff0c\u4e00\u822c\u88ab\u79f0\u4e3ae-tags\uff0c\u65b0\u589e\u66f4\u4e3a\u5f3a\u5927\u7684Cache-Control\u5934\u3002\r\n<\/pre>\n
\u4e8c HTTP\u534f\u8bae\u4e4b\u8bf7\u6c42Request<\/strong><\/div>\n

1\u3001\u8bf7\u6c42\u7684URL<\/p>\n

\r\n#1\u3001\u4ec0\u4e48\u662fURL\uff1fURL\u662f\u4e00\u79cd\u7279\u6b8a\u7c7b\u578b\u7684URI\uff0c\u5305\u542b\u4e86\u7528\u4e8e\u67e5\u627e\u67d0\u4e2a\u8d44\u6e90\u7684\u8db3\u591f\u7684\u4fe1\u606f URL,\u5168\u79f0\u662fUniformResourceLocator, \u4e2d\u6587\u53eb\u7edf\u4e00\u8d44\u6e90\u5b9a\u4f4d\u7b26,\u662f\u4e92\u8054\u7f51\u4e0a\u7528\u6765\u6807\u8bc6\u67d0\u4e00\u5904\u8d44\u6e90\u7684\u5730\u5740\u3002\r\n\r\n#2\u3001\u4ee5\u4e0b\u9762\u8fd9\u4e2aURL\u4e3a\u4f8b\uff0c\u4ecb\u7ecd\u4e0b\u666e\u901aURL\u7684\u5404\u90e8\u5206\u7ec4\u6210\uff1ahttp:\/\/www.aspxfans.com:8080\/news\/index.asp?boardID=5&ID=24618&page=1\r\n#name\u4e00\u4e2a\u5b8c\u6574\u7684URL\u5305\u62ec\u4ee5\u4e0b\u51e0\u90e8\u5206\uff1a\r\n#A.\u534f\u8bae\u90e8\u5206\uff1ahttp:\/\/\u8be5URL\u7684\u534f\u8bae\u90e8\u5206\u4e3a\u201chttp\uff1a\u201d\uff0c\u5728\"HTTP\"\u540e\u9762\u7684\u201c\/\/\u201d\u4e3a\u5206\u9694\u7b26\u3002\u8fd9\u4ee3\u8868\u7f51\u9875\u4f7f\u7528\u7684\u662fHTTP\u534f\u8bae\u3002\u5728Internet\u4e2d\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u534f\u8bae\uff0c\u5982HTTP\uff0cFTP\u7b49\u7b49\u3002===>\u5982\u679c\u4e0d\u5199\uff0c\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u8865\u5168\uff0c\u4f46\u5fc5\u987b\u6709\r\n#B.\u57df\u540d\u90e8\u5206\uff1awww.aspxfans.com\u4e00\u4e2aURL\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528IP\u5730\u5740\u4f5c\u4e3a\u57df\u540d\u4f7f\u7528===>\u5fc5\u987b\u6709\r\n#C.\u7aef\u53e3\u90e8\u5206\uff1a8080\u8ddf\u5728\u57df\u540d\u540e\u9762\u7684\u662f\u7aef\u53e3\uff0c\u57df\u540d\u548c\u7aef\u53e3\u4e4b\u95f4\u4f7f\u7528\u201c:\u201d\u4f5c\u4e3a\u5206\u9694\u7b26\u3002===>\u7aef\u53e3\u4e0d\u662f\u4e00\u4e2aURL\u5fc5\u987b\u7684\u90e8\u5206\uff0c\u5982\u679c\u7701\u7565\u7aef\u53e3\u90e8\u5206\uff0c\u5c06\u91c7\u7528\u9ed8\u8ba4\u7aef\u53e380\r\n#D.\u865a\u62df\u76ee\u5f55\u90e8\u5206\uff1a\/news\/\u4ece\u57df\u540d\u540e\u7684\u7b2c\u4e00\u4e2a\u201c\/\u201d\u5f00\u59cb\u5230\u6700\u540e\u4e00\u4e2a\u201c\/\u201d\u4e3a\u6b62\uff0c\u662f\u865a\u62df\u76ee\u5f55\u90e8\u5206\u3002===>\u865a\u62df\u76ee\u5f55\u4e5f\u4e0d\u662f\u4e00\u4e2aURL\u5fc5\u987b\u7684\u90e8\u5206\u3002\r\n#E.\u6587\u4ef6\u540d\u90e8\u5206\uff1aindex.asp\u4ece\u57df\u540d\u540e\u7684\u6700\u540e\u4e00\u4e2a\u201c\/\u201d\u5f00\u59cb\u5230\u201c\uff1f\u201d\u4e3a\u6b62\uff0c\u662f\u6587\u4ef6\u540d\u90e8\u5206\uff0c\u5982\u679c\u6ca1\u6709\u201c?\u201d,\u5219\u662f\u4ece\u57df\u540d\u540e\u7684\u6700\u540e\u4e00\u4e2a\u201c\/\u201d\u5f00\u59cb\u5230\u201c#\u201d\u4e3a\u6b62\uff0c\u662f\u6587\u4ef6\u90e8\u5206\uff0c\u5982\u679c\u6ca1\u6709\u201c\uff1f\u201d\u548c\u201c#\u201d\uff0c\u90a3\u4e48\u4ece\u57df\u540d\u540e\u7684\u6700\u540e\u4e00\u4e2a\u201c\/\u201d\u5f00\u59cb\u5230\u7ed3\u675f\uff0c\u90fd\u662f\u6587\u4ef6\u540d\u90e8\u5206\u3002===>\u6587\u4ef6\u540d\u90e8\u5206\u4e5f\u4e0d\u662f\u4e00\u4e2aURL\u5fc5\u987b\u7684\u90e8\u5206\uff0c\u5982\u679c\u7701\u7565\u8be5\u90e8\u5206\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u7684\u6587\u4ef6\u540d\r\n#F.\u53c2\u6570\u90e8\u5206\uff1aboardID=5&ID=24618&page=1\u4ece\u201c\uff1f\u201d\u5f00\u59cb\u5230\u201c#\u201d\u4e3a\u6b62\u4e4b\u95f4\u7684\u90e8\u5206\u4e3a\u53c2\u6570\u90e8\u5206\uff0c\u53c8\u79f0\u641c\u7d22\u90e8\u5206\u3001\u67e5\u8be2\u90e8\u5206\u3002\u53c2\u6570\u53ef\u4ee5\u5141\u8bb8\u6709\u591a\u4e2a\u53c2\u6570\uff0c\u53c2\u6570\u4e0e\u53c2\u6570\u4e4b\u95f4\u7528\u201c&\u201d\u4f5c\u4e3a\u5206\u9694\u7b26\u3002===>\u53c2\u6570\u90e8\u5206\u975e\u5fc5\u987b\r\n#G.\u951a\u90e8\u5206\uff1a#name\u4ece\u201c#\u201d\u5f00\u59cb\u5230\u6700\u540e\uff0c\u90fd\u662f\u951a\u90e8\u5206\u3002===>\u951a\u90e8\u5206\u4e5f\u4e0d\u662f\u4e00\u4e2aURL\u5fc5\u987b\u7684\u90e8\u5206\r\n<\/pre>\n

URL\u4e0eURI\uff0cURN\u6709\u4ec0\u4e48\u533a\u522b<\/p>\n

\r\n#1\u3001URI\uff0c\u662funiform resource identifier\uff0c\u7edf\u4e00\u8d44\u6e90\u6807\u8bc6\u7b26\uff0c\u7528\u6765\u552f\u4e00\u7684\u6807\u8bc6\u4e00\u4e2a\u8d44\u6e90\u3002Web\u4e0a\u53ef\u7528\u7684\u6bcf\u79cd\u8d44\u6e90\u5982HTML\u6587\u6863\u3001\u56fe\u50cf\u3001\u89c6\u9891\u7247\u6bb5\u3001\u7a0b\u5e8f\u7b49\u90fd\u662f\u4e00\u4e2a\u6765URI\u6765\u5b9a\u4f4d\u7684 URI\u4e00\u822c\u7531\u4e09\u90e8\u7ec4\u6210\uff1a\r\n\u2460\u8bbf\u95ee\u8d44\u6e90\u7684\u547d\u540d\u673a\u5236\r\n\u2461\u5b58\u653e\u8d44\u6e90\u7684\u4e3b\u673a\u540d\r\n\u2462\u8d44\u6e90\u81ea\u8eab\u7684\u540d\u79f0\uff0c\u7531\u8def\u5f84\u8868\u793a\uff0c\u7740\u91cd\u5f3a\u8c03\u4e8e\u8d44\u6e90\u3002\r\n\r\n#2\u3001URL\u662funiform resource locator\uff0c\u7edf\u4e00\u8d44\u6e90\u5b9a\u4f4d\u5668\uff0c\u5b83\u662f\u4e00\u79cd\u5177\u4f53\u7684URI\uff0c\u5373URL\u53ef\u4ee5\u7528\u6765\u6807\u8bc6\u4e00\u4e2a\u8d44\u6e90\uff0c\u800c\u4e14\u8fd8\u6307\u660e\u4e86\u5982\u4f55locate\u8fd9\u4e2a\u8d44\u6e90\u3002URL\u662fInternet\u4e0a\u7528\u6765\u63cf\u8ff0\u4fe1\u606f\u8d44\u6e90\u7684\u5b57\u7b26\u4e32\uff0c\u4e3b\u8981\u7528\u5728\u5404\u79cdWWW\u5ba2\u6237\u7a0b\u5e8f\u548c\u670d\u52a1\u5668\u7a0b\u5e8f\u4e0a\uff0c\u7279\u522b\u662f\u8457\u540d\u7684Mosaic\u3002 \u91c7\u7528URL\u53ef\u4ee5\u7528\u4e00\u79cd\u7edf\u4e00\u7684\u683c\u5f0f\u6765\u63cf\u8ff0\u5404\u79cd\u4fe1\u606f\u8d44\u6e90\uff0c\u5305\u62ec\u6587\u4ef6\u3001\u670d\u52a1\u5668\u7684\u5730\u5740\u548c\u76ee\u5f55\u7b49\u3002URL\u4e00\u822c\u7531\u4e09\u90e8\u7ec4\u6210\uff1a\r\n\u2460\u534f\u8bae(\u6216\u79f0\u4e3a\u670d\u52a1\u65b9\u5f0f)\r\n\u2461\u5b58\u6709\u8be5\u8d44\u6e90\u7684\u4e3b\u673aIP\u5730\u5740(\u6709\u65f6\u4e5f\u5305\u62ec\u7aef\u53e3\u53f7)\r\n\u2462\u4e3b\u673a\u8d44\u6e90\u7684\u5177\u4f53\u5730\u5740\u3002\u5982\u76ee\u5f55\u548c\u6587\u4ef6\u540d\u7b49\r\n\r\n#3\u3001URN\uff0cuniform resource name\uff0c\u7edf\u4e00\u8d44\u6e90\u547d\u540d\uff0c\u662f\u901a\u8fc7\u540d\u5b57\u6765\u6807\u8bc6\u8d44\u6e90\uff0c\u6bd4\u5982mailto:java-net@java.sun.com\u3002URI\u662f\u4ee5\u4e00\u79cd\u62bd\u8c61\u7684\uff0c\u9ad8\u5c42\u6b21\u6982\u5ff5\u5b9a\u4e49\u7edf\u4e00\u8d44\u6e90\u6807\u8bc6\uff0c\u800cURL\u548cURN\u5219\u662f\u5177\u4f53\u7684\u8d44\u6e90\u6807\u8bc6\u7684\u65b9\u5f0f\u3002URL\u548cURN\u90fd\u662f\u4e00\u79cdURI\u3002\u7b3c\u7edf\u5730\u8bf4\uff0c\u6bcf\u4e2a URL \u90fd\u662f URI\uff0c\u4f46\u4e0d\u4e00\u5b9a\u6bcf\u4e2a URI \u90fd\u662f URL\u3002\u8fd9\u662f\u56e0\u4e3a URI \u8fd8\u5305\u62ec\u4e00\u4e2a\u5b50\u7c7b\uff0c\u5373\u7edf\u4e00\u8d44\u6e90\u540d\u79f0 (URN)\uff0c\u5b83\u547d\u540d\u8d44\u6e90\u4f46\u4e0d\u6307\u5b9a\u5982\u4f55\u5b9a\u4f4d\u8d44\u6e90\u3002\u4e0a\u9762\u7684 mailto\u3001news \u548c isbn URI \u90fd\u662f URN \u7684\u793a\u4f8b\u3002 \u5728Java\u7684URI\u4e2d\uff0c\u4e00\u4e2aURI\u5b9e\u4f8b\u53ef\u4ee5\u4ee3\u8868\u7edd\u5bf9\u7684\uff0c\u4e5f\u53ef\u4ee5\u662f\u76f8\u5bf9\u7684\uff0c\u53ea\u8981\u5b83\u7b26\u5408URI\u7684\u8bed\u6cd5\u89c4\u5219\u3002\u800cURL\u7c7b\u5219\u4e0d\u4ec5\u7b26\u5408\u8bed\u4e49\uff0c\u8fd8\u5305\u542b\u4e86\u5b9a\u4f4d\u8be5\u8d44\u6e90\u7684\u4fe1\u606f\uff0c\u56e0\u6b64\u5b83\u4e0d\u80fd\u662f\u76f8\u5bf9\u7684\u3002 \u5728Java\u7c7b\u5e93\u4e2d\uff0cURI\u7c7b\u4e0d\u5305\u542b\u4efb\u4f55\u8bbf\u95ee\u8d44\u6e90\u7684\u65b9\u6cd5\uff0c\u5b83\u552f\u4e00\u7684\u4f5c\u7528\u5c31\u662f\u89e3\u6790\u3002 \u76f8\u53cd\u7684\u662f\uff0cURL\u7c7b\u53ef\u4ee5\u6253\u5f00\u4e00\u4e2a\u5230\u8fbe\u8d44\u6e90\u7684\u6d41\u3002\r\n\r\n# \u4ed6\u4eec\u4e09\u4e2a\u7684\u533a\u522b\u6709\u70b9\u50cf\u662fCSS\u7684\u5c5e\u6027\u9009\u62e9\u5668\uff0c\u5e94\u8be5\u8bf4\u90fd\u662f\u505a\u5b9a\u4f4d\u7b5b\u9009\u7528\u7684\uff0c\u4e00\u4e2a\u662f\u5728\u7f51\u9875\u4e2d\u5b9a\u4f4d\uff0c\u4e00\u4e2a\u662f\u5728\u5168\u7403\u8303\u56f4\u5185\u7684\u8d44\u6e90\u5b9a\u4f4d\r\n<\/pre>\n

2\u3001Request\u8bf7\u6c42\u7684\u683c\u5f0f<\/p>\n

\u5ba2\u6237\u7aef\u53d1\u9001\u4e00\u4e2aHTTP\u8bf7\u6c42\u5230\u670d\u52a1\u5668\u7684\u8bf7\u6c42\u6d88\u606f\u683c\u5f0f\u4e3a\uff1a\u8bf7\u6c42\u884c\uff08request line\uff09\u3001\u8bf7\u6c42\u5934\u90e8\uff08header\uff09\u3001\u7a7a\u884c\u548c\u8bf7\u6c42\u6570\u636e\u56db\u4e2a\u90e8\u5206\u7ec4\u6210\u3002<\/p>\n

\"\"<\/p>\n

\r\n\u8bf7\u6c42\u884c\u4ee5\u4e00\u4e2a\u65b9\u6cd5GET\u6216POST\u5f00\u5934\uff0c\u4ee5\u7a7a\u683c\u5206\u5f00\uff0c\u540e\u9762\u8ddf\u7740\u8bf7\u6c42\u7684URI\u548c\u534f\u8bae\u7684\u7248\u672c\u3002\u8be6\u7ec6\u89e3\u91ca\u5982\u4e0b GET \/mayite\/p\/7278389.html HTTP\/1.1Host: www.cnblogs.com Connection: keep-alive Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1User-Agent: Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/65.0.3325.181 Safari\/537.36Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9\r\n#\u7b2c\u4e00\u90e8\u5206\uff1a\u8bf7\u6c42\u884c\uff0c\u7528\u6765\u8bf4\u660e\u8bf7\u6c42\u7c7b\u578b,\u8981\u8bbf\u95ee\u7684\u8d44\u6e90\u4ee5\u53ca\u6240\u4f7f\u7528\u7684HTTP\u7248\u672c.GET\u8bf4\u660e\u8bf7\u6c42\u7c7b\u578b\u4e3aGET\/mayite\/p\/7278389.html\u4e3a\u8981\u8bbf\u95ee\u7684\u8d44\u6e90 \u8be5\u884c\u7684\u6700\u540e\u4e00\u90e8\u5206\u8bf4\u660e\u4f7f\u7528\u7684\u662fHTTP1.1\u7248\u672c\r\n#\u7b2c\u4e8c\u90e8\u5206\uff1a\u4ece\u7b2c\u4e8c\u884c\u8d77\u4e3a\u8bf7\u6c42\u5934\u90e8\uff0c\u7d27\u63a5\u7740\u8bf7\u6c42\u884c\uff08\u5373\u7b2c\u4e00\u884c\uff09\u4e4b\u540e\uff0c\u7528\u6765\u8bf4\u660e\u670d\u52a1\u5668\u8981\u4f7f\u7528\u7684\u9644\u52a0\u4fe1\u606fHOST\u5c06\u6307\u51fa\u8bf7\u6c42\u7684\u76ee\u7684\u5730. User-Agent,\u670d\u52a1\u5668\u7aef\u548c\u5ba2\u6237\u7aef\u811a\u672c\u90fd\u80fd\u8bbf\u95ee\u5b83,\u5b83\u662f\u6d4f\u89c8\u5668\u7c7b\u578b\u68c0\u6d4b\u903b\u8f91\u7684\u91cd\u8981\u57fa\u7840.\u8be5\u4fe1\u606f\u7531\u4f60\u7684\u6d4f\u89c8\u5668\u6765\u5b9a\u4e49,\u5e76\u4e14\u5728\u6bcf\u4e2a\u8bf7\u6c42\u4e2d\u81ea\u52a8\u53d1\u9001\u7b49\u7b49\r\n#\u7b2c\u4e09\u90e8\u5206\uff1a\u7a7a\u884c\uff0c\u8bf7\u6c42\u5934\u90e8\u540e\u9762\u7684\u7a7a\u884c\u662f\u5fc5\u987b\u7684\u5373\u4f7f\u7b2c\u56db\u90e8\u5206\u7684\u8bf7\u6c42\u6570\u636e\u4e3a\u7a7a\uff0c\u4e5f\u5fc5\u987b\u6709\u7a7a\u884c\u3002\r\n#\u7b2c\u56db\u90e8\u5206\uff1a\u8bf7\u6c42\u6570\u636e\u4e5f\u53eb\u4e3b\u4f53\uff0c\u53ef\u4ee5\u6dfb\u52a0\u4efb\u610f\u7684\u5176\u4ed6\u6570\u636e\u3002\u8fd9\u4e2a\u4f8b\u5b50\u7684\u8bf7\u6c42\u6570\u636e\u4e3a\u7a7a\u3002\u53ea\u6709POST\u65b9\u6cd5\u624d\u6709\u8bf7\u6c42\u4f53\uff0c\u53ef\u4ee5\u7528\u6d4f\u89c8\u5668\u767b\u5f55\u4e00\u4e2a\u7f51\u7ad9\uff0c\u8f93\u9519\u8d26\u53f7\u5bc6\u7801\u6765\u6293\u53d6POST\u8bf7\u6c42 POST \/ HTTP1.1Host:www.wrox.com User-Agent:Mozilla\/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022) Content-Type:application\/x-www-form-urlencoded Content-Length:40Connection: Keep-Alive name=Professional%20Ajax&publisher=Wiley\r\n<\/pre>\n

3\u3001HTTP\u8bf7\u6c42\u65b9\u6cd5<\/p>\n

\r\n#1\u3001Http\u534f\u8bae\u5b9a\u4e49\u4e86\u5f88\u591a\u4e0e\u670d\u52a1\u5668\u4ea4\u4e92\u7684\u65b9\u6cd5\uff08\u4e86\u89e3\uff09HTTP1.0\u5b9a\u4e49\u4e86\u4e09\u79cd\u8bf7\u6c42\u65b9\u6cd5\uff1a GET, POST \u548c HEAD\u65b9\u6cd5\u3002 HTTP1.1\u65b0\u589e\u4e86\u4e94\u79cd\u8bf7\u6c42\u65b9\u6cd5\uff1aOPTIONS, PUT, DELETE, TRACE \u548c CONNECT \u65b9\u6cd5\u3002\r\n\r\n#2\u3001\u4e86\u89e3\u4e0b\u5404\u4e2a\u65b9\u6cd5\u7684\u5927\u81f4\u610f\u4e49\r\nGET \u8bf7\u6c42\u6307\u5b9a\u7684\u9875\u9762\u4fe1\u606f\uff0c\u5e76\u8fd4\u56de\u5b9e\u4f53\u4e3b\u4f53\u3002\r\nHEAD \u7c7b\u4f3c\u4e8eget\u8bf7\u6c42\uff0c\u53ea\u4e0d\u8fc7\u8fd4\u56de\u7684\u54cd\u5e94\u4e2d\u6ca1\u6709\u5177\u4f53\u7684\u5185\u5bb9\uff0c\u7528\u4e8e\u83b7\u53d6\u62a5\u5934\r\nPOST \u5411\u6307\u5b9a\u8d44\u6e90\u63d0\u4ea4\u6570\u636e\u8fdb\u884c\u5904\u7406\u8bf7\u6c42\uff08\u4f8b\u5982\u63d0\u4ea4\u8868\u5355\u6216\u8005\u4e0a\u4f20\u6587\u4ef6\uff09\u3002\u6570\u636e\u88ab\u5305\u542b\u5728\u8bf7\u6c42\u4f53\u4e2d\u3002POST\u8bf7\u6c42\u53ef\u80fd\u4f1a\u5bfc\u81f4\u65b0\u7684\u8d44\u6e90\u7684\u5efa\u7acb\u548c\/\u6216\u5df2\u6709\u8d44\u6e90\u7684\u4fee\u6539\u3002\r\nPUT \u4ece\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u4f20\u9001\u7684\u6570\u636e\u53d6\u4ee3\u6307\u5b9a\u7684\u6587\u6863\u7684\u5185\u5bb9\u3002 DELETE \u8bf7\u6c42\u670d\u52a1\u5668\u5220\u9664\u6307\u5b9a\u7684\u9875\u9762\u3002\r\nCONNECT HTTP\/1.1\u534f\u8bae\u4e2d\u9884\u7559\u7ed9\u80fd\u591f\u5c06\u8fde\u63a5\u6539\u4e3a\u7ba1\u9053\u65b9\u5f0f\u7684\u4ee3\u7406\u670d\u52a1\u5668\u3002\r\nOPTIONS \u5141\u8bb8\u5ba2\u6237\u7aef\u67e5\u770b\u670d\u52a1\u5668\u7684\u6027\u80fd\u3002\r\nTRACE \u56de\u663e\u670d\u52a1\u5668\u6536\u5230\u7684\u8bf7\u6c42\uff0c\u4e3b\u8981\u7528\u4e8e\u6d4b\u8bd5\u6216\u8bca\u65ad\u3002\r\n\r\n#3\u3001\u4e00\u4e2aURL\u5730\u5740\u7528\u4e8e\u63cf\u8ff0\u4e00\u4e2a\u7f51\u7edc\u4e0a\u7684\u8d44\u6e90\uff0c\u800cHTTP\u4e2d\u6700\u57fa\u672c\u7684\u56db\u4e2a\u65b9\u6cd5GET, POST, PUT, DELETE\u5c31\u5bf9\u5e94\u7740\u5bf9\u8fd9\u4e2a\u8d44\u6e90\u7684\u67e5\uff0c\u6539\uff0c\u589e\uff0c\u52204\u4e2a\u64cd\u4f5c\u3002\r\n\r\n#4\u3001 \u6211\u4eec\u6700\u5e38\u89c1\u7684\u5c31\u662fGET\u548cPOST\u4e86\u3002GET\u4e00\u822c\u7528\u4e8e\u83b7\u53d6\/\u67e5\u8be2\u8d44\u6e90\u4fe1\u606f\uff0c\u800cPOST\u4e00\u822c\u7528\u4e8e\u66f4\u65b0\u8d44\u6e90\u4fe1\u606f.\r\n<\/pre>\n

GET\u8bf7\u6c42\u4e0ePOST\u8bf7\u6c42\u7684\u533a\u522b<\/p>\n

\u7b80\u5355\u7684\u8bf4\u6cd5\u5c31\u662fget\u8bf7\u6c42\u4f1a\u5728url\u4e0a\u4f53\u73b0\u51fa\u6765\uff0c\u800cpost\u4e0d\u4f1a\uff0c\u5f53\u7136\u8fd9\u53ea\u662f\u8868\u9762\u4e0a\u7684<\/p>\n

\r\n#1\u3001\u533a\u522b1: \u53c2\u6570\u7684\u7ec4\u7ec7\u65b9\u5f0f\u4e0d\u540cGET\u63d0\u4ea4\u7684\u6570\u636e\u4f1a\u653e\u5728URL\u4e4b\u540e\uff0c\u4ee5?\u5206\u5272URL\u548c\u4f20\u8f93\u6570\u636e\uff0c\u53c2\u6570\u4e4b\u95f4\u4ee5&\u76f8\u8fde\uff0c \u4f8b \u5982\uff1alogin.action?name=hyddd&password=idontknow&verify=%E4%BD%A0 %E5%A5%BD\u3002\u5982\u679c\u6570\u636e\u662f\u82f1\u6587\u5b57\u6bcd\/\u6570\u5b57\uff0c\u539f\u6837\u53d1\u9001\uff0c\u5982\u679c\u662f\u7a7a\u683c\uff0c\u8f6c\u6362\u4e3a+\uff0c\u5982\u679c\u662f\u4e2d\u6587\/\u5176\u4ed6\u5b57\u7b26\uff0c\u5219\u76f4\u63a5\u628a\u5b57\u7b26\u4e32\u7528BASE64\u52a0\u5bc6\uff0c\u5f97\u51fa\u5982\uff1a %E4%BD%A0%E5%A5%BD\uff0c\u5176\u4e2d\uff05XX\u4e2d\u7684XX\u4e3a\u8be5\u7b26\u53f7\u4ee516\u8fdb\u5236\u8868\u793a\u7684ASCII\u3002 POST\u65b9\u6cd5\u662f\u628a\u63d0\u4ea4\u7684\u6570\u636e\u653e\u5728HTTP\u5305\u7684Body\u4e2d. \u56e0\u6b64\uff0cGET\u63d0\u4ea4\u7684\u6570\u636e\u4f1a\u5728\u5730\u5740\u680f\u4e2d\u663e\u793a\u51fa\u6765\uff0c\u800cPOST\u63d0\u4ea4\uff0c\u5730\u5740\u680f\u4e0d\u4f1a\u6539\u53d8\r\n\r\n#2\u3001\u533a\u522b2\uff1a\u4f20\u8f93\u6570\u636e\u5927\u5c0f\u9650\u5236\u9996\u5148\u58f0\u660e\uff1aHTTP\u534f\u8bae\u6ca1\u6709\u5bf9\u4f20\u8f93\u7684\u6570\u636e\u5927\u5c0f\u8fdb\u884c\u9650\u5236\uff0cHTTP\u534f\u8bae\u89c4\u8303\u4e5f\u6ca1\u6709\u5bf9URL\u957f\u5ea6\u8fdb\u884c\u9650\u5236\u3002 \u800c\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\u5b58\u5728\u7684\u9650\u5236\u4e3b\u8981\u6709\uff1a GET:\u7279\u5b9a\u6d4f\u89c8\u5668\u548c\u670d\u52a1\u5668\u5bf9URL\u957f\u5ea6\u6709\u9650\u5236\uff0c\u4f8b\u5982 IE\u5bf9URL\u957f\u5ea6\u7684\u9650\u5236\u662f2083\u5b57\u8282(2K+35)\u3002\u5bf9\u4e8e\u5176\u4ed6\u6d4f\u89c8\u5668\uff0c\u5982Netscape\u3001FireFox\u7b49\uff0c\u7406\u8bba\u4e0a\u6ca1\u6709\u957f\u5ea6\u9650\u5236\uff0c\u5176\u9650\u5236\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7cfb \u7edf\u7684\u652f\u6301\u3002 \u56e0\u6b64\u5bf9\u4e8eGET\u63d0\u4ea4\u65f6\uff0c\u4f20\u8f93\u6570\u636e\u5c31\u4f1a\u53d7\u5230URL\u957f\u5ea6\u7684 \u9650\u5236\u3002 POST:\u7531\u4e8e\u4e0d\u662f\u901a\u8fc7URL\u4f20\u503c\uff0c\u7406\u8bba\u4e0a\u6570\u636e\u4e0d\u53d7 \u9650\u3002\u4f46\u5b9e\u9645\u5404\u4e2aWEB\u670d\u52a1\u5668\u4f1a\u89c4\u5b9a\u5bf9post\u63d0\u4ea4\u6570\u636e\u5927\u5c0f\u8fdb\u884c\u9650\u5236\uff0cApache\u3001IIS6\u90fd\u6709\u5404\u81ea\u7684\u914d\u7f6e\u3002 \u53ef\u4ee5\u7b80\u5355\u603b\u7ed3\u4e3a\uff1a GET\u63d0\u4ea4\u7684\u6570\u636e\u5927\u5c0f\u6709\u9650\u5236\uff08\u56e0\u4e3a\u6d4f\u89c8\u5668\u5bf9URL\u7684\u957f\u5ea6\u6709\u9650\u5236\uff09\uff0c\u800cPOST\u65b9\u6cd5\u63d0\u4ea4\u7684\u6570\u636e\u6ca1\u6709\u9650\u5236. GET\u65b9\u5f0f\u9700\u8981\u4f7f\u7528Request.QueryString\u6765\u53d6\u5f97\u53d8\u91cf\u7684\u503c\uff0c\u800cPOST\u65b9\u5f0f\u901a\u8fc7Request.Form\u6765\u83b7\u53d6\u53d8\u91cf\u7684\u503c\u3002\r\n\r\n#3\u3001\u533a\u522b3\uff1a\u5b89\u5168\u6027POST\u7684\u5b89\u5168\u6027\u8981\u6bd4GET\u7684\u5b89\u5168\u6027\u9ad8\u3002\u6bd4\u5982\uff1a\u901a\u8fc7GET\u63d0\u4ea4\u6570\u636e\uff0c\u7528\u6237\u540d\u548c\u5bc6\u7801\u5c06\u660e\u6587\u51fa\u73b0\u5728URL\u4e0a\uff0c\u56e0\u4e3a(1)\u767b\u5f55\u9875\u9762\u6709\u53ef\u80fd\u88ab\u6d4f\u89c8\u5668\u7f13\u5b58\uff1b(2)\u5176\u4ed6\u4eba\u67e5\u770b\u6d4f\u89c8\u5668\u7684\u5386\u53f2\u7eaa\u5f55\uff0c\u90a3\u4e48\u522b\u4eba\u5c31\u53ef\u4ee5\u62ff\u5230\u4f60\u7684\u8d26\u53f7\u548c\u5bc6\u7801\u4e86\uff0c\u9664\u6b64\u4e4b\u5916\uff0c\u4f7f\u7528GET\u63d0\u4ea4\u6570\u636e\u8fd8\u53ef\u80fd\u4f1a\u9020\u6210Cross-site request forgery\u653b\u51fb\r\n<\/pre>\n
\u4e09 HTTP\u534f\u8bae\u4e4b\u54cd\u5e94Response<\/strong><\/div>\n

\u670d\u52a1\u5668\u63a5\u6536\u5e76\u5904\u7406\u5ba2\u6237\u7aef\u53d1\u8fc7\u6765\u7684\u8bf7\u6c42\u540e\u4f1a\u8fd4\u56de\u4e00\u4e2aHTTP\u7684\u54cd\u5e94\u6d88\u606fResponse<\/p>\n

HTTP\u54cd\u5e94\u4e5f\u7531\u56db\u4e2a\u90e8\u5206\u7ec4\u6210\uff0c\u5206\u522b\u662f\uff1a\u72b6\u6001\u884c\u3001\u6d88\u606f\u62a5\u5934\u3001\u7a7a\u884c\u548c\u54cd\u5e94\u6b63\u6587\u3002<\/p>\n

\"\"<\/p>\n

#\u7b2c\u4e00\u90e8\u5206\uff1a\u72b6\u6001\u884c\uff0c\u7531HTTP\u534f\u8bae\u7248\u672c\u53f7\uff0c \u72b6\u6001\u7801\uff0c \u72b6\u6001\u6d88\u606f \u4e09\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u884c\u4e3a\u72b6\u6001\u884c\uff0c\uff08HTTP\/1.1\uff09\u8868\u660eHTTP\u7248\u672c\u4e3a1.1\u7248\u672c\uff0c\u72b6\u6001\u7801\u4e3a200\uff0c\u72b6\u6001\u6d88\u606f\u4e3a\uff08ok\uff09
\n#\u7b2c\u4e8c\u90e8\u5206\uff1a\u6d88\u606f\u62a5\u5934\uff0c\u7528\u6765\u8bf4\u660e\u5ba2\u6237\u7aef\u8981\u4f7f\u7528\u7684\u4e00\u4e9b\u9644\u52a0\u4fe1\u606f\uff0cDate:\u751f\u6210\u54cd\u5e94\u7684\u65e5\u671f\u548c\u65f6\u95f4\uff1b Content-Type:\u6307\u5b9a\u4e86MIME\u7c7b\u578b\u7684HTML(text\/html),\u7f16\u7801\u7c7b\u578b\u662fUTF-8
\n#\u7b2c\u4e09\u90e8\u5206\uff1a\u7a7a\u884c\uff0c\u6d88\u606f\u62a5\u5934\u540e\u9762\u7684\u7a7a\u884c\u662f\u5fc5\u987b\u7684
\n#\u7b2c\u56db\u90e8\u5206\uff1a\u54cd\u5e94\u6b63\u6587\uff0c\u670d\u52a1\u5668\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u7684\u6587\u672c\u4fe1\u606f\u3002\u7a7a\u884c\u540e\u9762\u7684html\u90e8\u5206\u4e3a\u54cd\u5e94\u6b63\u6587\uff0c\u6d4f\u89c8\u5668\u5c31\u662f\u4f1a\u628a\u8fd9\u90e8\u5206\u5185\u5bb9\u6e32\u67d3\u5230\u7528\u6237\u7684\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\uff0c\u5c31\u4f1a\u4ea7\u751f\u7f51\u9875\u7684\u6548\u679c\u4e86<\/p>\n

\r\n\u72b6\u6001\u4ee3\u7801\u6709\u4e09\u4f4d\u6570\u5b57\u7ec4\u6210\uff0c\u7b2c\u4e00\u4e2a\u6570\u5b57\u5b9a\u4e49\u4e86\u54cd\u5e94\u7684\u7c7b\u522b\uff0c\u5171\u5206\u4e94\u79cd\u7c7b\u522b: 1xx\uff1a\u6307\u793a\u4fe1\u606f--\u8868\u793a\u8bf7\u6c42\u5df2\u63a5\u6536\uff0c\u7ee7\u7eed\u5904\u7406\r\n2xx\uff1a\u6210\u529f--\u8868\u793a\u8bf7\u6c42\u5df2\u88ab\u6210\u529f\u63a5\u6536\u3001\u7406\u89e3\u3001\u63a5\u53d7\r\n3xx\uff1a\u91cd\u5b9a\u5411--\u8981\u5b8c\u6210\u8bf7\u6c42\u5fc5\u987b\u8fdb\u884c\u66f4\u8fdb\u4e00\u6b65\u7684\u64cd\u4f5c\r\n4xx\uff1a\u5ba2\u6237\u7aef\u9519\u8bef--\u8bf7\u6c42\u6709\u8bed\u6cd5\u9519\u8bef\u6216\u8bf7\u6c42\u65e0\u6cd5\u5b9e\u73b0\r\n5xx\uff1a\u670d\u52a1\u5668\u7aef\u9519\u8bef--\u670d\u52a1\u5668\u672a\u80fd\u5b9e\u73b0\u5408\u6cd5\u7684\u8bf7\u6c42\r\n\u5e38\u89c1\u72b6\u6001\u7801\uff1a\r\n200 OK \/\/\u5ba2\u6237\u7aef\u8bf7\u6c42\u6210\u529f\r\n400 Bad Request \/\/\u5ba2\u6237\u7aef\u8bf7\u6c42\u6709\u8bed\u6cd5\u9519\u8bef\uff0c\u4e0d\u80fd\u88ab\u670d\u52a1\u5668\u6240\u7406\u89e3401 Unauthorized \/\/\u8bf7\u6c42\u672a\u7ecf\u6388\u6743\uff0c\u8fd9\u4e2a\u72b6\u6001\u4ee3\u7801\u5fc5\u987b\u548cWWW-Authenticate\u62a5\u5934\u57df\u4e00\u8d77\u4f7f\u7528\r\n403 Forbidden \/\/\u670d\u52a1\u5668\u6536\u5230\u8bf7\u6c42\uff0c\u4f46\u662f\u62d2\u7edd\u63d0\u4f9b\u670d\u52a1\r\n404 Not Found \/\/\u8bf7\u6c42\u8d44\u6e90\u4e0d\u5b58\u5728\uff0ceg\uff1a\u8f93\u5165\u4e86\u9519\u8bef\u7684URL\r\n500 Internal Server Error \/\/\u670d\u52a1\u5668\u53d1\u751f\u4e0d\u53ef\u9884\u671f\u7684\u9519\u8bef\r\n503 Server Unavailable \/\/\u670d\u52a1\u5668\u5f53\u524d\u4e0d\u80fd\u5904\u7406\u5ba2\u6237\u7aef\u7684\u8bf7\u6c42\uff0c\u4e00\u6bb5\u65f6\u95f4\u540e\u53ef\u80fd\u6062\u590d\u6b63\u5e38\r\n<\/pre>\n
\u56db HTTP\u534f\u8bae\u5b8c\u6574\u5de5\u4f5c\u6d41\u7a0b<\/strong><\/div>\n

HTTP\u534f\u8bae\u5b9a\u4e49Web\u5ba2\u6237\u7aef\u5982\u4f55\u4eceWeb\u670d\u52a1\u5668\u8bf7\u6c42Web\u9875\u9762\uff0c\u4ee5\u53ca\u670d\u52a1\u5668\u5982\u4f55\u628aWeb\u9875\u9762\u4f20\u9001\u7ed9\u5ba2\u6237\u7aef\u3002HTTP\u534f\u8bae\u91c7\u7528\u4e86\u8bf7\u6c42\/\u54cd\u5e94\u6a21\u578b\u3002\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a\u8bf7\u6c42\u62a5\u6587\uff0c\u8bf7\u6c42\u62a5\u6587\u5305\u542b\u8bf7\u6c42\u7684\u65b9\u6cd5\u3001URL\u3001\u534f\u8bae\u7248\u672c\u3001\u8bf7\u6c42\u5934\u90e8\u548c\u8bf7\u6c42\u6570\u636e\u3002\u670d\u52a1\u5668\u4ee5\u4e00\u4e2a\u72b6\u6001\u884c\u4f5c\u4e3a\u54cd\u5e94\uff0c\u54cd\u5e94\u7684\u5185\u5bb9\u5305\u62ec\u534f\u8bae\u7684\u7248\u672c\u3001\u6210\u529f\u6216\u8005\u9519\u8bef\u4ee3\u7801\u3001\u670d\u52a1\u5668\u4fe1\u606f\u3001\u54cd\u5e94\u5934\u90e8\u548c\u54cd\u5e94\u6570\u636e\u3002<\/p>\n

\u4ee5\u4e0b\u662f HTTP \u8bf7\u6c42\/\u54cd\u5e94\u7684\u6b65\u9aa4\uff1a<\/p>\n

1\u3001\u5ba2\u6237\u7aef\u8fde\u63a5\u5230Web\u670d\u52a1\u5668<\/p>\n

\u4e00\u4e2aHTTP\u5ba2\u6237\u7aef\uff0c\u901a\u5e38\u662f\u6d4f\u89c8\u5668\uff0c\u4e0eWeb\u670d\u52a1\u5668\u7684HTTP\u7aef\u53e3\uff08\u9ed8\u8ba4\u4e3a80\uff09\u5efa\u7acb\u4e00\u4e2aTCP\u5957\u63a5\u5b57\u8fde\u63a5\u3002\u4f8b\u5982\uff0chttp:\/\/www.oakcms.cn\u3002<\/p>\n

2\u3001\u53d1\u9001HTTP\u8bf7\u6c42<\/p>\n

\u901a\u8fc7TCP\u5957\u63a5\u5b57\uff0c\u5ba2\u6237\u7aef\u5411Web\u670d\u52a1\u5668\u53d1\u9001\u4e00\u4e2a\u6587\u672c\u7684\u8bf7\u6c42\u62a5\u6587\uff0c\u4e00\u4e2a\u8bf7\u6c42\u62a5\u6587\u7531\u8bf7\u6c42\u884c\u3001\u8bf7\u6c42\u5934\u90e8\u3001\u7a7a\u884c\u548c\u8bf7\u6c42\u6570\u636e4\u90e8\u5206\u7ec4\u6210\u3002<\/p>\n

3\u3001\u670d\u52a1\u5668\u63a5\u53d7\u8bf7\u6c42\u5e76\u8fd4\u56deHTTP\u54cd\u5e94<\/p>\n

Web\u670d\u52a1\u5668\u89e3\u6790\u8bf7\u6c42\uff0c\u5b9a\u4f4d\u8bf7\u6c42\u8d44\u6e90\u3002\u670d\u52a1\u5668\u5c06\u8d44\u6e90\u590d\u672c\u5199\u5230TCP\u5957\u63a5\u5b57\uff0c\u7531\u5ba2\u6237\u7aef\u8bfb\u53d6\u3002\u4e00\u4e2a\u54cd\u5e94\u7531\u72b6\u6001\u884c\u3001\u54cd\u5e94\u5934\u90e8\u3001\u7a7a\u884c\u548c\u54cd\u5e94\u6570\u636e4\u90e8\u5206\u7ec4\u6210\u3002<\/p>\n

4\u3001\u91ca\u653e\u8fde\u63a5TCP\u8fde\u63a5<\/p>\n

\u82e5connection \u6a21\u5f0f\u4e3aclose\uff0c\u5219\u670d\u52a1\u5668\u4e3b\u52a8\u5173\u95edTCP\u8fde\u63a5\uff0c\u5ba2\u6237\u7aef\u88ab\u52a8\u5173\u95ed\u8fde\u63a5\uff0c\u91ca\u653eTCP\u8fde\u63a5;\u82e5connection \u6a21\u5f0f\u4e3akeepalive\uff0c\u5219\u8be5\u8fde\u63a5\u4f1a\u4fdd\u6301\u4e00\u6bb5\u65f6\u95f4\uff0c\u5728\u8be5\u65f6\u95f4\u5185\u53ef\u4ee5\u7ee7\u7eed\u63a5\u6536\u8bf7\u6c42;<\/p>\n

5\u3001\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u89e3\u6790HTML\u5185\u5bb9<\/p>\n

\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u9996\u5148\u89e3\u6790\u72b6\u6001\u884c\uff0c\u67e5\u770b\u8868\u660e\u8bf7\u6c42\u662f\u5426\u6210\u529f\u7684\u72b6\u6001\u4ee3\u7801\u3002\u7136\u540e\u89e3\u6790\u6bcf\u4e00\u4e2a\u54cd\u5e94\u5934\uff0c\u54cd\u5e94\u5934\u544a\u77e5\u4ee5\u4e0b\u4e3a\u82e5\u5e72\u5b57\u8282\u7684HTML\u6587\u6863\u548c\u6587\u6863\u7684\u5b57\u7b26\u96c6\u3002\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u8bfb\u53d6\u54cd\u5e94\u6570\u636eHTML\uff0c\u6839\u636eHTML\u7684\u8bed\u6cd5\u5bf9\u5176\u8fdb\u884c\u683c\u5f0f\u5316\uff0c\u5e76\u5728\u6d4f\u89c8\u5668\u7a97\u53e3\u4e2d\u663e\u793a\u3002<\/p>\n

\u4e94 HTTP\u534f\u8bae\u5173\u952e\u6027\u603b\u7ed3<\/strong><\/div>\n
\r\n#1\u3001\u7b80\u5355\u5feb\u901f\r\n\u5ba2\u6237\u5411\u670d\u52a1\u5668\u8bf7\u6c42\u670d\u52a1\u65f6\uff0c\u53ea\u9700\u4f20\u9001\u8bf7\u6c42\u65b9\u6cd5\u548c\u8def\u5f84\u3002\u8bf7\u6c42\u65b9\u6cd5\u5e38\u7528\u7684\u6709GET\u3001HEAD\u3001POST\u3002\u6bcf\u79cd\u65b9\u6cd5\u89c4\u5b9a\u4e86\u5ba2\u6237\u4e0e\u670d\u52a1\u5668\u8054\u7cfb\u7684\u7c7b\u578b\u4e0d\u540c\u3002\u7531\u4e8eHTTP\u534f\u8bae\u7b80\u5355\uff0c\u4f7f\u5f97HTTP\u670d\u52a1\u5668\u7684\u7a0b\u5e8f\u89c4\u6a21\u5c0f\uff0c\u56e0\u800c\u901a\u4fe1\u901f\u5ea6\u5f88\u5feb\u3002\r\n\r\n#2\u3001\u7075\u6d3b\r\nHTTP\u5141\u8bb8\u4f20\u8f93\u4efb\u610f\u7c7b\u578b\u7684\u6570\u636e\u5bf9\u8c61\u3002\u6b63\u5728\u4f20\u8f93\u7684\u7c7b\u578b\u7531Content-Type\u52a0\u4ee5\u6807\u8bb0\u3002\r\n\r\n#3\u3001\u65e0\u8fde\u63a5\r\nHTTP\u65e0\u8fde\u63a5\u8bf4\u7684\u662f\uff1a\u5f53\u67d0\u4e2a\u5ba2\u6237\u673a\u5728\u77ed\u65f6\u95f4\u591a\u6b21\u6b21\u8bf7\u6c42\u540c\u4e00\u4e2a\u8d44\u6e90\uff0c\u670d\u52a1\u5668\u5e76\u4e0d\u80fd\u533a\u522b\u662f\u5426\u5df2\u7ecf\u54cd\u5e94\u8fc7\u7528\u6237\u7684\u8bf7\u6c42\u3002\r\n\u4e8e\u662f\u6211\u4eec\u6bcf\u6b21\u53d1\u9001http\u8bf7\u6c42\uff0c\u90fd\u9700\u8981\u4e8b\u5148\u53d1\u8d77\u4e00\u4e2a\u5230\u670d\u52a1\u5668\u7684TCP\u8bf7\u6c42\uff0c\u7ecf\u5386\u201c\u4e09\u6b21\u63e1\u624b\u201d\u7684\u8fc7\u7a0b\u3002\u8fd9\u9488\u5bf9\u5927\u6d41\u91cf\u7684\u7684\u670d\u52a1\u5668\u6765\u8bf4\uff0c\u5f00\u9500\u662f\u76f8\u5f53\u5927\u7684\u3002\u8fd9\u662fhttp\u65e0\u94fe\u63a5\u5e26\u6765\u7684\u7f3a\u70b9\r\n\u9488\u5bf9http\u65e0\u8fde\u63a5\uff0c\u4eba\u4eec\u8bbe\u8ba1\u4e86\u975e\u6301\u4e45\u8fde\u63a5\u548c\u6301\u4e45\u8fde\u63a5\u3002\u5b9e\u9645\u4e0a\u5173\u4e8ehttp\u534f\u8bae\u975e\u6301\u4e45\u8fde\u63a5\u548c\u6301\u4e45\u8fde\u63a5\u662f\u9488\u5bf9tcp\u534f\u8bae\u7684\u3002\u5f53\u5ba2\u6237\u673a\/\u670d\u52a1\u5668\u7684\u4ea4\u4e92\u8fd0\u884c\u4e8eTCP\u534f\u8bae\u4e0a\u65f6\uff0c\u5e94\u7528\u7a0b\u5e8f\u7684\u6bcf\u4e2a\u8bf7\u6c42\/\u54cd\u5e94\u5bf9\u662f\u7ecf\u4e0d\u540c\u7684TCP\u8fde\u63a5\u65f6\uff0c\u5219\u8be5\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u975e\u6301\u4e45\u8fde\u63a5\uff0c\u800c\u5f53\u5e94\u7528\u7a0b\u5e8f\u7684\u6bcf\u4e2a\u8bf7\u6c42\/\u54cd\u5e94\u5bf9\u662f\u7ecf\u76f8\u540c\u7684TCP\u8fde\u63a5\u53d1\u9001\uff0c\u5219\u8be5\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u6301\u4e45\u8fde\u63a5\u3002\r\n\u975e\u6301\u4e45\u8fde\u63a5\r\n\u8bf7\u6c42\u4e00\u4e2aHTTP\u8bf7\u6c42\/\u54cd\u5e94\u9700\u8981\u7684\u603b\u65f6\u95f4=\u5ba2\u6237\u7aef\u53d1\u51fa\u5efa\u7acb\u8fde\u63a5+\u53d1\u751f\u8bf7\u6c42\u62a5\u6587+\u670d\u52a1\u5668\u4f20\u8f93HTML\u6587\u4ef6\u7684\u65f6\u95f4\r\n\u6301\u4e45\u8fde\u63a5\r\n\u670d\u52a1\u5668\u5728\u53d1\u9001\u54cd\u5e94\u540e\uff0c\u4fdd\u6301\u8be5TCP\u8fde\u63a5\u6253\u5f00\u3002\u5728\u76f8\u540c\u7684\u5ba2\u6237\u673a\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u540e\u7eed\u8bf7\u6c42\u548c\u54cd\u5e94\u62a5\u6587\u901a\u8fc7\u76f8\u540c\u7684\u8fde\u63a5\u8fdb\u884c\u4f20\u9001\u3002\u4e0d\u9700\u8981\u518d\u6b21\u5efa\u7acbtcp\u8fde\u63a5\r\n\r\n#4\u3001\u65e0\u72b6\u6001\r\n\u6240\u8c13http\u662f\u65e0\u72b6\u6001\u534f\u8bae\uff0c\u8a00\u5916\u4e4b\u610f\u662f\u8bf4http\u534f\u8bae\u6ca1\u6cd5\u4fdd\u5b58\u5ba2\u6237\u673a\u4fe1\u606f\uff0c\r\n\u65e0\u72b6\u6001\u7684\u4f18\u70b9\u662f\uff1a\r\n\u5728\u670d\u52a1\u5668\u4e0d\u9700\u8981\u5148\u524d\u4fe1\u606f\u65f6\u5b83\u7684\u5e94\u7b54\u5c31\u8f83\u5feb\u3002\r\n\u65e0\u72b6\u6001\u7684\u7f3a\u70b9\u662f\uff1a\r\n\u7f3a\u5c11\u72b6\u6001\u610f\u5473\u7740\u5982\u679c\u540e\u7eed\u5904\u7406\u9700\u8981\u524d\u9762\u7684\u4fe1\u606f\uff0c\u5219\u5b83\u5fc5\u987b\u91cd\u4f20\u3002\u8fd9\u6837\u53ef\u80fd\u5bfc\u81f4\u6bcf\u6b21\u8fde\u63a5\u4f20\u9001\u7684\u6570\u636e\u91cf\u589e\u5927\r\n\u5173\u4e8ehttp\u65e0\u72b6\u6001\u963b\u788d\u4e86\u4ea4\u4e92\u5f0f\u5e94\u7528\u7a0b\u5e8f\u7684\u5b9e\u73b0\u3002\u6bd4\u5982\u8bb0\u5f55\u7528\u6237\u6d4f\u89c8\u54ea\u4e9b\u7f51\u9875\u3001\u5224\u65ad\u7528\u6237\u662f\u5426\u62e5\u6709\u6743\u9650\u8bbf\u95ee\u7b49\u3002\u4e8e\u662f\uff0c\u4e24\u79cd\u7528\u4e8e\u4fdd\u6301HTTP\u72b6\u6001\u7684\u6280\u672f\u5c31\u5e94\u8fd0\u800c\u751f\u4e86\uff0c\u4e00\u4e2a\u662fCookie\uff0c\u800c\u53e6\u4e00\u4e2a\u5219\u662fSession\u3002\r\n\r\n#5\u3001\u652f\u6301B\/S\u53caC\/S\u6a21\u5f0f\u3002\r\n<\/pre>\n
\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.cnblogs.com\/mayite\/p\/9163173.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/http-learning.html<\/a>\u7f16\u8f91\uff1a\u51af\u745e\u6d9b\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u8d85\u6587\u672c\u4f20\u8f93\u534f\u8bae\uff08HTTP\uff0cHyperText Transfer Protocol)\u662f\u4e92\u8054\u7f51\u4e0a\u5e94\u7528\u6700\u4e3a\u5e7f\u6cdb […]<\/p>\n","protected":false},"author":1329,"featured_media":107292,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-107283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=107283"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107283\/revisions"}],"predecessor-version":[{"id":293735,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107283\/revisions\/293735"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/107292"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=107283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=107283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=107283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}