HTTP 协议发展史(一)

Tim Berners-Lee 閸︺劌褰傞弰搴濈缂佸缍夐敍鍫濆祮 World Wide Web閿涘妞傞敍灞藉灡闁姳绨℃稉澶愩?嶉弽绋跨妇閹?閺堫垽绱?/p>

  • HTTP閿涘湚ypertext Transfer Protocol閿?/li>
  • URL閿涘湶niform Resource Locator閿?/li>
  • HTML閿涘湚ypertext Markup Language閿?/li>

閸忔湹鑵?HTTP 娴狅綀銆冮妴宀冪Т閺傚洦婀版导鐘虹翻閸楀繗顔呴妴宥忕礉瀵板牆顦挎禍鍝勮嫙娑撳秶鎮婄憴锝堢箹闁插矂娼伴妴宀冪Т閵嗗秶娈戦崥顐$疅閿涘瞼鏁嬮懛鍏呯窗鐠囶垵袙閿涘矁顓绘稉楦跨Т閺傚洦婀扮亸杈ㄦЦ鐡掑懓绉洪弬鍥ㄦ拱鐠у嫭绨敍鍫滅伐婵″倸娴橀悧鍥?浣筋潒妫版垹鐡戦敍澶屾畱閹板繑?婵?鍌氬従鐎圭偘绗夐悞璁圭礉閹?鐠嬫挾娈戠搾鍛瀮閺堫剚鏋冨锝嗘Ц閹?strong>閺傚洦銆傛稉顓炲瘶閸氼偅瀵氶崥鎴濆従娴犳牗鏋冨锝囨畱闁剧偓甯撮妴?/strong>

HTTP 閺勵垱鐦潏鍐х瑐鐏炲倻娈戦崡蹇氼唴閿涘苯鐔?娴滃骸褰查棃鐘垫畱缂冩垹绮舵潻鐐村复閿涘牅绶ユ俊?TCP/IP閿涘绱濈?瑰啩绗夐崗鍐茬妇婵″倷缍嶅铏圭彌缂冩垹绮舵潻鐐村复鏉╂瑧顫掓惔鏇炵湴缂佸棜濡敍灞肩矤閺堫剝宸濇稉濠咁唹閿涘瓛TTP 鐏忚鲸妲告稉?娑擃亣顕Ч?閸濆秴绨查崡蹇氼唴閿?/p>

閹搭亣鍤﹂惄顔煎閿涘瓛TTP 閸楀繗顔呴幀璇插彙閺堝绨叉稉顏嗗閺堫剨绱濋崚鍡楀焼閺勵垽绱?/p>

  • HTTP/0.9
  • HTTP/1.0
  • HTTP/1.1
  • HTTP/2
  • HTTP/3

閺堫剚鏋冮崗鍫滆礋婢堆冾啀娴犲绮涢崜宥夋桨娑撳閲滈崡蹇氼唴閿涘奔绡冮弰顖氱安閻€劍娓堕獮鎸庣【閻ㄥ嫪绗佹稉顏勫礂鐠侇噯绱濈粭顑跨癌缁″洤鍟?娑撳搫銇囩?规湹绮欑紒宥呭⒖娑撳琚辨稉顏??/p>

缁?閸楁洜娈?HTTP/0.9

閸?HTTP 閻ㄥ嫮顑囨稉?娑擃亞澧楅張顒婄礉閸?HTTP/0.9 娑擃叏绱濋弰顖欑瑝閺?顖涘瘮娴肩姾绶崶鍓у閵嗕浇顫嬫0鎴犵搼閺佺増宓侀弽鐓庣础閻ㄥ嫸绱濋崣顏囧厴娴肩姾绶搾鍛瀮閺堫剨绱濋懓灞肩瑬鐎广垺鍩涚粩顖氬絺闁浇顕Ч鍌滄畱鐠囶厽纭堕棃鐐茬埗缁?閸楁洩绱濇笟瀣洤閿?/p>

GET /index.html

閺堝秴濮熼崳銊ュ涧閼宠棄鎼锋惔?HTML 閺傚洦婀伴敍灞筋洤娑撳澧嶇粈鐚寸窗

<html>
  Welcome to juejin
</html>

HTTP/0.9 閸楀繗顔呴崣顏呮暜閹?GET 閺傝纭堕敍宀?骞囬崷銊﹀灉娴狀剙鐖堕悽銊ф畱 POST閵嗕赋UT 缁涘鏌熷▔鏇熸Ц HTTP/1.0 閹靛秴濮炴潻娑樺箵閻ㄥ嫸绱濋崷?0.9 閻楀牊婀伴惃鍕嬀娴狅綇绱滸ET 閸忚泛鐤勫鑼病閼宠棄顧勫⿰陇鍐婚弮銉ョ埗闂?濮瑰倷绨¢敍灞肩瑝鏉╁洣绱粔?閻ㄥ嫯顔曠拋陇?鍛粦妤傛鐏潻婊呯仒閿涘矁?鍐閸掔増婀弶銉ュ讲閹碘晛鐫嶉幀褝绱濇禍搴㈡Ц閹靛秵婀佹禍鍡楁倵鎼村繒澧楅張顒傛畱鏉╊厺鍞敍灞藉亾閻㈢喍绨¢悳鏉挎躬缁讳浇宕抽惃?Web 閻㈢喐?浣??/p>

闂勩倖顒濇稊瀣樆閿涘瓛TTP/0.9 娑擃厽妲告稉宥嗘暜閹镐浇顕Ч鍌氥仈閸滃苯鎼锋惔鏂裤仈閻ㄥ嫸绱濋懛顏嗗姧娑旂喐鐥呴張澶屽Ц閹胶鐖滈惃鍕洤韫囩偣?鍌濐嚞濮瑰倹鍨氶崝鐔稿灗婢惰精瑙﹂崣顏囧厴閸?HTML 閺傚洦婀版稉顓?蹇撳毉閵嗗倹婀囬崝鈥虫珤閸濆秴绨茬?瑰奔绠i崥搴礉娴兼氨鐝涢崡鍐插彠闂傤叀绻涢幒銉??/p>

閹恒儰绗呴弶銉礉閹存垳婊戞担璺ㄦ暏 telnet 閸涙垝鎶ら弶銉ㄧ箻鐞涘奔绗傞張鍝勭杽妤犲矉绱濋崷銊х矒缁旑垯鑵戞潏鎾冲弳 telnet 閸涙垝鎶ら敍?/p>

$ telnet www.taobao.com 80

Trying 36.156.170.6...

Connected to www.taobao.com.danuoyi.tbcache.com.

Escape character is '^]'.





telnet 閸涙垝鎶ら幒銉ュ綀娑撱倓閲滈崣鍌涙殶閿?/p>

  • host閿涙矮瀵岄張鍝勬倳
  • port閿涙氨顏崣锝呭娇

娑撳﹪娼伴惃鍕嚒娴犮倕姘ㄩ弰顖氱毦鐠囨洑绗屽ǎ妯虹杺閺堝秴濮熼崳銊ョ紦缁斿绻涢幒銉礉鏉╃偞甯村铏圭彌閹存劕濮涢崥搴礉閸欘垯浜掓潏鎾冲弳 HTTP 閸涙垝鎶ゆ禍鍡礉閹存垳婊戠紒褏鐢绘潏鎾冲弳 GET /閿?/p>

$ telnet www.taobao.com 80

Trying 36.156.170.6...

Connected to www.taobao.com.danuoyi.tbcache.com.

Escape character is '^]'.





GET /


<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB18030"/>
    <title>Index</title>
</head>
<body><script type="text/javascript">
(function (d) {
var t=d.createElement("script");t.type="text/javascript";t.async=true;t.id="tb-beacon-aplus";
t.setAttribute("exparams","category=&userid=&aplus");
t.src=("https:"==d.location.protocol?"https://s":"http://a")+".tbcdn.cn/s/aplus_v2.js";
d.getElementsByTagName("head")[0].appendChild(t);
})(document);
</script>


<script>window.location.href="http://www.taobao.com"</script>
</body>
</html>
Connection closed by foreign host.

閸欘垯浜掗惇瀣煂閿涘本绐愮?规繂鎼锋惔鏂剧啊娑?濞?HTML 閺傚洦婀伴敍宀?鍔ч崥搴″彠闂傤厺绨℃潻鐐村复閵嗗倸顩ч弸婊勫灉娴狀剛鏁ら崥灞剧壉閻ㄥ嫬鎳℃禒銈堢箾閹恒儳娅ㄦ惔锔炬畱閺堝秴濮熼崳顭掔礉娴兼艾绶遍崚棰佺瑝娑?閺嶉娈戠紒鎾寸亯閿?/p>

$ telnet www.baidu.com 80
Trying 36.152.44.96...
Connected to www.a.shifen.com.
Escape character is '^]'.





GET /

HTTP/1.1 400 Bad Request



Connection closed by foreign host.

閸ョ姳璐熼惂鎯у瀹歌尙绮℃稉宥嗘暜閹?HTTP/0.9 閸楀繗顔呮禍鍡礉閻╁瓨甯撮崫宥呯安娴?HTTP/1.1 閸楀繗顔呴敍宀?濮搁幀浣虹垳閺?400閿涘矂娈㈤崥搴″彠闂傤叀绻涢幒銉??/p>

缁讳浇宕抽惃?HTTP/1.0

HTTP/0.9 閺?1991 楠炴潙褰傜敮鍐畱閿涘苯鍩屾禍?1995 楠?9 閺堝牞绱濈純鎴犵捕娑撳﹤姘ㄩ張澶夌啊 19705 娑擃亙瀵岄張鍝勬倳閿涘瞼鍔ч崥搴濈矌娴犲懓绻冩禍鍡曠娑擃亝婀?鐏忓崬顤冮懛?31568 娑擃亷绱濇径褔鍣洪惃鍕秹缁旀瑥顩ч梿銊ユ倵閺勩儳鐟℃稉?閼割剚绉鹃悳甯礉HTTP/0.9 閸楀繗顔呴惃鍕暆閸楁洘?褎妲搁崗璺虹繁閸掓媽鎽ら崟鍐ㄥ絺鐏炴洜娈戦柌宥堫洣閸樼喎娲滈敍宀?鍔ч懓灞藉従鐏?闂勬劖?褌绡冨鑼病閸掗绨℃稉宥咁啇韫囧?燁潒閻ㄥ嫮鈻兼惔锔跨啊閿涘奔绨弰?HTTP 瀹搞儰缍旂紒鍕彛闁匡絽鐦戞Η鎾舵畱瀵?婵鐖虹粚?HTTP/1.0閿涘苯婀?1996 楠?5 閺堝牊顒滃蹇撳絺鐢喛绱濈??HTTP/0.9 鏉╂稖顢戞禍鍡樺⒖鐏炴洩绱濇晶鐐插娴滃棔绔存禍娑㈠櫢鐟曚胶娈戦崝鐔诲厴閿?/p>

  • 闂勩倓绨?GET 娑斿顦婚敍灞炬煀婢х偘绨?HEAD 閸?POST 閺傝纭?/li>
  • 婢х偛濮炴禍鍡楀讲闁娈戦悧鍫熸拱閸欏嘲鐡у▓纰夌礉姒涙ǹ顓绘稉?HTTP/0.9
  • 婢х偛濮炴禍?HTTP 妫f牠鍎撮敍灞藉讲娴犮儰绗岀拠閿嬬湴閸滃苯鎼锋惔鏂剧鐠у嘲褰傞柅?/li>
  • 婢х偛濮炴禍鍡楁惙鎼存梻濮搁幀浣虹垳閸滃本寮挎潻?/li>

閸欘垯浜掗惇瀣煂閿涘矁绻栨禍娑樺閼宠姤顒滈弰顖欑矕婢垛晞顫︽径褍顔嶉幍?閻旂喓鐓¢惃鍕剁礉鐠囬攱鐪版禒搴″斧閸忓牏娈戦崡鏇☆攽閿?/p>

GET /index.html

閸欐ɑ鍨氭禍鍡楊樋鐞涘矉绱欑拠閿嬬湴鐞?妫f牠鍎撮敍澶涚窗

GET /index.html HTTP/1.0
Header1: Value1
Header2: Value2

閸濆秴绨叉稊鐔奉杻閸旂姳绨¢悩鑸?浣筋攽閿涘澃tatus line閿?/p>

HTTP/1.0 200 OK

Content-Type: text/html



<html>
  Welcome to juejin
</html>

閸欘垯浜掗惇瀣煂閿涘瓛TTP/1.0 閻ㄥ嫬褰傜敮鍐跨礉鐠?HTTP 閸楀繗顔呴惃鍕嚔濞夋洖绶遍崚棰佺啊閺嬩礁銇囬惃鍕⒖鐏炴洩绱濋搹鐣屽姧閺冨爼娈ф潻?30 楠炵绻冮崢璁崇啊閿涘苯銇囬柈銊ュ瀻閻ㄥ嫮缍夌粩娆戝箛閸︺劋绶烽悞璺烘躬閹稿鍙?HTTP/1.0 閻ㄥ嫯顕㈠▔鏇熺垼閸戝棙娼甸柅姘繆閵嗗倷绶ユ俊鍌︾窗濮濓絾妲搁崶鐘辫礋婢х偛濮炴禍?POST 閺傝纭堕敍灞藉讲娴犮儴顔?鐎广垺鍩涚粩顖涙儭鐢附绉烽幁顖欑秼缂佹瑦婀囬崝鈥虫珤閿?/p>

POST / HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: 27

field1=value1&field2=value2

濮濓絾妲搁崶鐘辫礋婢х偛濮炴禍鍡涱浕闁煉绱濈拋?HTTP 閸欘垯浜掓径鍕倞閸氬嫮顫掗弽鐓庣础閻ㄥ嫭鏋冩禒璁圭礉閼板奔绗夐崘宥嗘Ц缁?閸楁洜娈?HTML 閺傚洦婀版禍鍡礉Content-Type 妫f牠鍎寸?涙顔屾导姘啞鐠囧顓归幋椋庮伂閸忚渹缍嬮惃鍕瀮娴犲墎琚崹瀣剁窗

HTTP/1.0 200 OK

Content-Type: text/gif



<Encoded data of logo.gif>

鏉╂瑤绨洪柌宥呫亣閻ㄥ嫬褰夐崠鏍ㄦЦ娴犲﹤銇?HTTP 缁讳浇宕抽惃鍕唨閻绱濇稉杞扮啊閸旂姵绻侀悶鍡毿掗敍宀?鐟懓鍛暏 Node.js 閸愭瑤绨℃稉?娑擃亪娼敮绋跨唨绾?閻?HTTP 閺堝秴濮熼崳顭掔窗

const http = require('http')
const consumers = require('stream/consumers')



const app = http.createServer(async (req, res) => {
  console.log('method: ', req.method)
  console.log('url: ', req.url)
  console.log('httpVersion: ', req.httpVersion)
  console.log('headers: ', req.headers)
  const body = await consumers.text(req)
  console.log('body: ', body)
  res.end('<html>Welcome to juejin</html>\n')
})

app.listen(8080)

娑撳﹪娼伴惃鍕柤鎼村繒娲冮崥顒佹拱閸?8080 缁旑垰褰涢敍灞借嫙閹垫挸宓?HTTP 鐠囬攱鐪伴惃鍕煙濞夋洖鎮曢妴浣哄閺堫剙褰块妴浣界熅瀵板嫬鎷版#鏍劥缁涘淇婇幁顖?鍌涘灉娴狀兛绮涢悞鏈靛▏閻?telnet 閸涙垝鎶ら弶銉ㄧ箻鐞涘本绁寸拠鏇窗

$ telnet 127.0.0.1 8080


Trying 127.0.0.1...


Connected to localhost.


Escape character is '^]'.





GET / HTTP/1.0
User-Agent: MyAwesomeBrowser



HTTP/1.1 200 OK

Connection: close

<html>Welcome to juejin</html>
Connection closed by foreign host.

瑜版捁绻涚紒顓熷瘻娑撱倖顐奸崶鐐舵簠娑斿鎮楅敍瀛瞖rver 閸嬫艾鍤禍鍡楁惙鎼存棑绱欓幐澶屽弾 HTTP/1.1 閺嶇厧绱¢敍澶涚礉濮濄倖妞傞張宥呭缁旑垳娈戞潏鎾冲毉缂佹挻鐏夋稉鐚寸窗

method:  GET
url:  /
httpVersion:  1.0
headers:  { 'user-agent': 'MyAwesomeBrowser' }
body:

閸欘垯浜掗惇瀣煂閿涘瞼鈻兼惔蹇旑劀绾喖婀撮懢宄板絿閸掗绨?HTTP 閸楀繗顔呴惃鍕煙濞夋洏?浣界熅瀵板嫨?浣哄閺堫剙褰块崪宀勵浕闁劋淇婇幁顖ょ礉閹恒儰绗呴弶銉ヮ嚠 POST 鐠囬攱鐪版潻娑滎攽濞村鐦敍灞肩瑓闂堛垼鐦崶鐐儭鐢缚绔存稉?application/x-www-form-urlencoded 閺嶇厧绱¢惃鍕殶閹诡噯绱?/p>

$ telnet 127.0.0.1 8080


Trying 127.0.0.1...


Connected to localhost.


Escape character is '^]'.





POST / HTTP/1.0

Content-Type: application/x-www-form-urlencoded

娴e棙妲歌ぐ鎾圭翻閸忋儰琚卞▎鈥虫礀鏉烇箑鍣径鍥э綖閸忋儲绉烽幁顖欑秼閻ㄥ嫭妞傞崐娆欑礉閸欐垹骞囬張宥呭閸c劎娲块幒銉ユ惙鎼存柧绨?/p>

HTTP/1.1 200 OK
Connection: close

鏉╂瑦妲搁崶鐘辫礋閸?Node.js 娑擃叏绱濈拠閿嬬湴閻ㄥ嫭妞傞崐娆欑礉闂?鐟曚線?姘崇箖 Content-Length 妫f牠鍎撮崨濠呯様閺堝秴濮熼崳銊︾Х閹垯缍嬮惃鍕毐鎼达讣绱濇潻娆愮壉閹靛秷鍏橀崷銊︾ウ瑜版挷鑵戦幓鎰絿閸掔増顒滅涵顔炬畱閺佺増宓侀敍?/p>

$ telnet 127.0.0.1 8080


Trying 127.0.0.1...


Connected to localhost.


Escape character is '^]'.





POST / HTTP/1.0

Content-Type: application/x-www-form-urlencoded

Content-Length: 27

field1=value1&field2=value2
HTTP/1.1 200 OK
Connection: close

閸︺劏藟閸?Content-Length 娑斿鎮楅敍宀冪翻閸忋儰琚卞▎鈥虫礀鏉烇缚绠i崥搴礉閺堝秴濮熼崳銊ヨ嫙濞屸剝婀侀弬顓炵磻鏉╃偞甯撮敍宀?灞炬Ц鐏忔繆鐦禒搴㈢ウ瑜版挷鑵戦幓鎰絿閺佺増宓侀敍灞炬付缂佸牊瀣侀崚棰佺啊 body 闁插矂娼伴惃鍕?纭风窗

method:  POST
url:  /
httpVersion:  1.0
headers:  {
  'content-type': 'application/x-www-form-urlencoded',
  'content-length': '27'
}
body:  field1=value1&field2=value2

娴犳挷绺鹃惃?HTTP/1.1

閸?HTTP/1.0 鐟欏嫯瀵栭崣鎴濈閸氬簼绮庢禒?9 娑擃亝婀?閿涘瓛TTP/1.1 鐟欏嫯瀵栫亸鍗炲絺鐢啩绨¢敍宀冪箹閺勵垰娲滄稉铏圭秹缂佹粎鍨庨悙绋跨础婢х偤鏆遍敍宀勬付鐟曚礁顤冮崝鐘虫煀閻ㄥ嫬濮涢懗鏂ょ礉楠炴湹浜掗弬鍥ㄣ?傞惃鍕埌瀵繗顔囪ぐ鏇$箹娴滄稓瀹崇?规哎??/p>

娑撳秴鍎氭禒?HTTP/0.9 閸楀洨楠囬崚?HTTP/1.0 闁絾鐗遍敍灞炬箒瀵板牆顦块弰鎹愭啿閻ㄥ嫬褰夐崠鏍电礉HTTP/1.1 娑?HTTP/1.0 閻╁憡鐦敍灞界唨閺堫剛绮ㄩ弸鍕嫙濞屸剝婀侀弨鐟板З閿涘矁?灞炬Ц閺傛澘顤冩禍?PUT閵嗕副PTIONS閵嗕竼ONNECT閵嗕箑RACE閵嗕赋ATCH閵嗕笍ELETE 缁涘鏌熷▔鏇礉鏉╂稐绔村銉﹀⒖鐏炴洑绨?HTTP 閻ㄥ嫯銆冩潏鎹愬厴閸旀冻绱濋崣锕?顦绘潻妯侯樋娴滃棔绔存禍娑㈩杺婢舵牜娈戠痪锕?鐣鹃敍灞肩伐婵″偊绱?/p>

  • 瀵搫鍩?Host 妫f牠鍎?/li>
  • 姒涙ǹ顓婚幐浣风畽鏉╃偞甯?/li>

閸ョ姳璐熸潻娆庤⒈娑擃亪妫舵0妯绘Ц瑜版挻妞傛潻顐㈡躬閻娼鹃惃鍕皑閹懌?渚禩TP 閸楀繗顔呴崷銊啎鐠佲?茬閸掓繐绱濇稉?娑擃亝婀囬崝鈥虫珤閸欘亣鍏橀幍妯碱吀娑?娑擃亞缍夌粩娆欑礉闂呭繒娼冮搹姘珯娑撶粯婧?閹?閺堫垳娈戦弲顔煎挤閿涘奔绔存稉顏呮箛閸斺?虫珤閸欘垯浜掗幍妯碱吀瀵板牆顦跨純鎴犵彲閿涘矁??HTTP 閸楀繗顔呴柌宀勬桨閸欘亜瀵橀崥顐$啊鐠囬攱鐪扮捄顖氱窞閿涘苯鑻熷▽鈩冩箒娑撶粯婧?閹存牕鐓欓崥宥勪繆閹垽绱濇總鐣屾畱鐟欙絽鍠呴崝鐐寸《閺勵垱濡搁崡蹇氼唴闁插矂娼伴惃鍕嚞濮瑰倽鐭惧鍕矤閻╃ǹ顕捄顖氱窞閺?瑙勫灇缂佹繂顕捄顖氱窞閿涘瞼鍔ч懓宀冪箹娴兼艾顕遍懛瀛樻煀閻ㄥ嫬宕楃拋顔荤瑝閸氭垵澧犻崗鐓庮啇閿涘苯绶㈡径姘劀閸︺劏绻嶇悰宀?娈戦張宥呭閸c劌鎷扮?广垺鍩涚粩顖炲厴閺冪姵纭舵潻鎰攽閿涘苯娲滃銈?姘崇箖瀵搫鍩楁晶鐐插 Host 妫f牠鍎撮弶銉︽绾喖鎲$拠澶嬫箛閸斺?虫珤娑撶粯婧?閸氬稄绱濇笟瀣洤閿?/p>

POST / HTTP/1.1
Host: foo.example

閸?HTTP/1.0 娑擃叏绱濈?广垺鍩涚粩顖氬絺闁浇顕Ч鍌︾礉閺堝秴濮熼崳銊ф祲鎼存棁绁┃鎰閸氬骸姘ㄩ弬顓炵磻鏉╃偞甯存禍鍡礉婵″倹鐏夋稉?娑擃亪銆夐棃銏ゆ付鐟曚礁顦挎稉顏囩カ濠ф劧绱濋崣顏囧厴闁插秵鏌婇幍鎾崇磻鏉╃偞甯撮敍灞肩矤閼板苯顕遍懛缈犵瑝韫囧懓顩﹂惃鍕鏉╃喆?渚禩TP/1.1 閻楀牊婀版稉顓熸煀婢х偘绨?Connection 妫f牠鍎撮敍灞藉讲娴犮儲瀵氱?规艾?闂磋礋 Keep-Alive閿涘矁顩﹀Ч鍌涙箛閸斺?虫珤娣囨繃瀵旀潻鐐村复閿涘奔浜掗弨顖涘瘮閸欐垿?浣规纯婢舵氨娈戠拠閿嬬湴閵?/p>

GET / HTTP/1.1
Connection: Keep-Alive

閸?HTTP/1.1 娑擃叏绱濇潻娆庨嚋鐞涘奔璐熼弰顖炵帛鐠併倗娈戦敍灞藉祮娴f寧鐥呴張澶嬫▔瀵繑瀵氱??Keep-Alive 閻ㄥ嫬?纭风礉閺堝秴濮熼崳銊ょ瘍娴兼岸绮拋銈勭箽閹镐浇绻涢幒銉礉閻€劋绗傞棃銏犲晸閻?Node.js 閺堝秴濮熼崳銊ュ讲娴犮儵娼敮鍛婄閺呮澘婀撮惇瀣毉閺夈儻绱?/p>

# HTTP/1.0 姒涙ǹ顓婚崗鎶芥4鏉╃偞甯?/span>
$ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0



HTTP/1.1 200 OK

Date: Wed, 28 Jun 2023 09:53:32 GMT
Connection: close

<html>Welcome to juejin</html>
Connection closed by foreign host.

# HTTP/1.1 姒涙ǹ顓绘穱婵囧瘮鏉╃偞甯?/span>
$ telnet 127.0.0.1 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1


HTTP/1.1 200 OK
Date: Wed, 28 Jun 2023 09:53:40 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 31

<html>Welcome to juejin</html>
Connection closed by foreign host.

Node.js 姒涙ǹ顓?Keep-Alive 閻ㄥ嫭妞傞梻瀛樻Ц 5 缁夋帪绱濇俊鍌涚亯閸?5 缁夋帊绠i崘鍜冪礉濞屸剝婀侀弬鎵畱鐠囬攱鐪版潻鍥ㄦ降閿涘奔绱伴崗鎶芥4鏉╃偞甯撮妴鍌濈箹娑擃亜?鐓庡讲娴犮儱婀崚娑樼紦閺堝秴濮熼崳銊ф畱閺冭泛?娆?姘崇箖 keepAliveTimeout 鐎涙顔屾潻娑滎攽鐠佸墽鐤嗛妴?/p>

闂勩倓绨℃稉濠囨桨閻ㄥ嫬褰夐崠鏍︾婢舵牭绱滺TTP/1.1 鏉╂ê顤冮崝鐘辩啊閺囨潙銈介惃鍕处鐎涙ɑ鏌熷▔鏇礉娓氬顩?Cache-Control 妫f牠鍎村В鏂剧閸撳秶娈?Expires 妫f牠鍎撮崝鐔诲厴閺囨潙宸辨径褋?鍌濈箹娴滄稖鍏橀崝娑氭畱婢х偛宸辨潻娑楃濮濄儱濮為柅鐔剁啊 Web 閻㈢喐?浣烘畱閽冾剙濯伴崣鎴濈潔閿涘瞼鍔ч懓宀勬閻?缂冩垹鐝棁?鐟曚礁濮炴潪鐣屾畱鐠у嫭绨搾濠冩降鐡掑﹤顦块敍灞筋洤娴f洝绻樻稉?濮濄儲褰侀崡鍥у鏉炰粙?鐔峰閺勵垯绨鹃棁?閺?璇插帬閻ㄥ嫰姣︽0妯?渚禩TP/1.1 閻ㄥ嫮澧楅張顑胯厬閿涘奔璐熸禍鍡毿掗崘瀹犵箹娑擃亪妫舵0姗堢礉閹绘劕鍤禍鍡欘吀闁挸瀵查惃鍕洤韫囩绱濋崗鑸?婵囧厒闂堢偛鐖剁粻?閸楁洩绱伴弮銏㈠姧閸欘垯浜掗柅姘崇箖 Keep-Alive 娣囨繃瀵旀潻鐐村复閿涘苯姘ㄩ懗钘夘槻閻€劋绔存稉顏冪炊鏉堟捇?姘朵壕閿涘本顒濋弮鑸靛Ω娑撹尪顢戦惃?HTTP 鐠囬攱鐪伴崣妯诲灇楠炴儼顢戦惃鍕焵娑撳秵妲搁崣顖欎簰閹绘劕宕岄崝鐘烘祰闁喎瀹虫禍鍡吹娓氬顩ч崷?HTTP/1.0 娑擃厺绔存稉顏勭敨娑撱倕绱堕崶鍓у閻ㄥ嫮缍夋い纰夌礉閹鍙¢棁?鐟曚礁褰傞柅浣风瑏娑擃亣顕Ч鍌︾窗

閼板奔琚卞鐘叉禈閻楀洤鍙剧?圭偞妲搁崣顖欎簰閸氬本妞傜拠閿嬬湴閻ㄥ嫸绱濇潻娆愮壉鐏忚精鍏樻径鐔虹級閻厺绔撮崡濠冩闂傜繝绨¢敍?/p>

閸氼剝鎹i弶銉╂姜鐢憡婀侀柆鎾舵倞閿涘瞼鍔ч懓宀?娲块崚棰佺矕婢垛晛銇囬柈銊ュ瀻濞村繗顫嶉崳銊ヨ嫙娑撳秵鏁幐浣界箹娑擃亜濮涢懗鏂ょ礉閸ョ姳璐熺?瑰啯婀佹稉顏堟閸掕绱?strong>韫囧懘銆忛幐澶屽弾鐠囬攱鐪伴惃鍕?庢惔蹇氱箲閸ョ偛鎼锋惔?/strong>閿涘矁绻栫亸鍙樼窗闁洤鍩岄梼鐔枫仈閿涘湚OL閿涘妯嗘繅鐐烘6妫版﹫绱濋崑鍥ь洤閼惧嘲褰囬崶鎯у剼1閻ㄥ嫭妞傞梻鏉戠发闂?鍖$礉閸楀厖濞囬崶鎯у剼2瀹歌尙绮¢崙鍡楊槵鐎瑰本鐦敍灞肩瘍娑撳秷鍏橀崣鎴?浣虹舶鐎广垺鍩涚粩顖ょ礉閹?娴犮儰绮犻張顒冨窛娑撳﹨顔夐敍灞借嫙濞屸剝婀侀惇鐔割劀鐟欙絽鍠呴梻顕?顣介妴鍌欑瑝鏉╁浄绱濇潻娆庨嚋閹?閺堫垶姣﹂悙鐧哥礉閸?HTTP/2 瑜版挷鑵戠悮顐f暰閸忓绨¢敍宀勫亝 HTTP/2 閸楀繗顔呴崣鍫濈敨閺夈儰绨¢崫顏冪昂閺傛壆娈戦悧瑙?褍鎲块敍鐔锋倵缂侇厽鏋冪粩鐘茬殺娴兼碍褰弲鎾??/p>

© 版权声明
THE END
喜欢就支持一下吧
点赞0

Warning: mysqli_query(): (HY000/3): Error writing file '/tmp/MY0Aic52' (Errcode: 28 - No space left on device) in /www/wwwroot/583.cn/wp-includes/class-wpdb.php on line 2345
admin的头像-五八三
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

图形验证码
取消
昵称代码图片