HTTP鐨勪笘鐣岃

Posted IQ鍓嶇

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTTP鐨勪笘鐣岃相关的知识,希望对你有一定的参考价值。

杩欐槸鍓嶇椋熷爞鐨勭11绡囧師鍒?/strong>  



瑙傛劅搴︼細馃専馃専馃専馃専馃専


鍙e懗锛氶粦绯栫弽鐝?/span>


鐑归オ鏃堕棿锛?5min




鍓嶇鍦堟妧鏈殑鐖嗗彂寮忓闀块殢涔嬭€屾潵鐨勫紑鍙戜汉鍛樺涓嶅姩鐨勭柌鎯劅銆佺劍铏戞劅鍜屼笉鎯宠烦鍑鸿垝閫傚湀鐨勬嫋寤舵噿鎯般€?/p>


jQuery鍗庝附璋㈠箷锛孯eact v16宸茬粡鏅強銆丄ngular9鍜孷ue3鍗冲皢鍙戝竷銆備笁澶ф鏋惰秺鏉ヨ秺璐磋繎WebComponents鏍囧噯銆?span class="mq-24">TypeScript閬嶅湴寮€鑺憋紝灏忕▼搴忔棩鐩婄伀鐖嗭紝蹇簲鐢?PWA绱ч殢鍏跺悗鈥︹€?/span>


绔欏湪娴疆涔嬪穮鐨勬垜浠渶闇€瑕佺殑鏄仠涓嬫潵鎬濊€冿紝杞拌桨鐑堢儓鐨勬妧鏈湰璐ㄦ槸浠€涔堬紵


鍏跺疄锛岃桨杞扮儓鐑堢殑鎶€鏈湰璐紝鏄熀纭€鐭ヨ瘑鍜屾牳蹇冩蹇?/span>銆?/p>


鐪嬩綘杩欑瘒棰樼洰鐨勬枃绔狅紝鏄璁睭TTP鍜紵HTTP閭d箞绠€鍗曪紝鎴戜滑澶у姣忓ぉ閮界敤锛屾湁浠€涔堝ソ璁茬殑锛?/p>


鍦ㄥ仠涓嬫潵鎬濊€冩妧鏈湰璐ㄧ殑鍚屾椂锛屾垜浠篃瑕佷笉鏂殑鎻愰珮鑷繁鐨勮璇嗗眰娆★紝浣犳墍璋撶殑绠€鍗曟槸鍥犱负浣犳病鏈夊惉鍒扳€?span>閬ヨ繙鐨勫摥澹?/strong>鈥濄€?/p>



(shout out to 鐢风榛勬墽涓?


鏈夎鎴戜滑浠婂ぉ鐨勪富瑙掔櫥鍦猴細HTTP


鎴戝皢甯︿綘浠嶩TTP鐨勫巻鍙插彂灞曞埌鍚勭増鏈凯浠d富瑕佺壒鎬ф潵浠庡叏灞€鐨勮搴﹂噸鏂拌璇咹TTP銆?/p>


1

 HTTP鐨勪笘鐣岃


鍏堟潵鏄庣‘涓€涓嬫椂闂寸嚎锛屽洖鍒?0骞村墠鐨勯偅涓槬澶┿€?/p>


涓€鍒囩殑涓€鍒囬兘濮嬩簬1989骞寸殑3鏈堬紝涓囩淮缃戜箣鐖惰拏濮喡蜂集绾虫柉路鏉?Tim Berners-Lee)鐨勪竴绡囪鏂囷紝鍒涢€犱簡涓囩淮缃戯紝鍒涢€犱簡HTTP銆?/p>


  • 1991骞?span class="mq-38">HTTP/0.9鍙戝竷  锛堟病鏈塕FC锛岀増鏈彿鏄悗鍔犱笂鍘荤殑锛?/p>

  • 1996骞?鏈?span class="mq-40">HTTP/1.0鍦≧FC1945鍙戝竷

  • 1997骞?鏈?span class="mq-42">HTTP/1.1鍙戝竷RFC2616鏄綋鍓嶆渶鏂扮増鏈?/span>

  • 2014骞?span class="mq-44">HTTP/1.1鍐嶆淇锛屽皢澶ф枃妗f媶鍒嗕负鍏唤杈冨皬鐨勬枃妗o紝RFC7230-7235

  • 2015骞?span class="mq-46">HTTP/2鍙戝竷RFC7540 (鍩轰簬璋锋瓕鐨凷PDY鍗忚)  

  • 2018骞达紝浜掕仈缃戞爣鍑嗗寲缁勭粐IETF鎻愯灏?span class="mq-49">HTTP over QUIC 鏇村悕涓?span class="mq-50">HTTP/3


濡傛灉甯屾湜鍏ㄩ潰鐨勪簡瑙?HTTP/3锛?/span>鎺ㄨ崘 Daniel Stenberg 锛圕URL 浣滆€咃級鐨凥TTP/3璇﹁В銆?/p>


褰撶劧濡傛灉浣犳兂鐪嬫渶鏂板悓姝ョ殑涓枃锛屽彲浠ョ湅鎴戠炕璇戠殑鐗堟湰HTTP/3璇﹁В銆?/p>

HTTP/3璇﹁В涓枃鐗?/p>

https://hungryturbo.com/HTTP3-explained/


娆㈣繋鎸囨閿欒鍜孲tar銆?/p>


绾佃HTTP鐨勫巻鍙插彂灞曢暱娌筹紝绌跺叾鍘熷洜锛?span>鏄妧鏈拰闇€姹備竴鐩村湪鎺ㄥ姩鐫€瀹冪殑鍙戝睍銆?/span>


2

 HTTP鏄粈涔堬紵



HTTP鏄竴涓湪璁$畻鏈轰笘鐣岄噷涓撻棬鍦ㄤ袱鐐逛箣闂翠紶杈撴枃瀛椼€佸浘鐗囥€侀煶棰戙€佽棰戠瓑瓒呮枃鏈暟鎹殑绾﹀畾鍜岃鑼冦€?/strong>


HTTP閫氬父璺戝湪TCP/IP鍗忚鏍堜箣涓婏紝渚濋潬IP鍗忚瀹炵幇瀵诲潃鍜岃矾鐢便€乀CP鍗忚瀹炵幇鍙潬鏁版嵁浼犺緭銆丏NS鍗忚瀹炵幇鍩熷悕鏌ユ壘銆丼SL/TLS鍗忚瀹炵幇瀹夊叏閫氫俊銆傚綋鐒讹紝WebSocket銆丠TTPDNS渚濊禆浜嶩TTP銆?/p>


3

 HTTP/0.9


GET/index.html


HTTP/0.9褰撴椂鏄负浜嗗鏈氦娴侊紝鍩轰簬璇锋眰鍜屽搷搴旂殑妯″紡锛屽湪缃戠粶涓紶杈揌TML瓒呮枃鏈殑鍐呭銆?/p>


濡備笂鎵€绀猴紝鍙湁涓€涓姹傝锛屾病鏈塇TTP璇锋眰澶村拰璇锋眰浣撱€傚悓鏍凤紝鏈嶅姟鍣ㄤ篃娌℃湁鍝嶅簲澶翠俊鎭紝鍙槸杩斿洖浜嗘暟鎹€?/p>


鍥犱负閮芥槸HTML鏍煎紡鐨勬枃浠讹紝鍐冲畾浜嗚繑鍥炵殑鏂囦欢鍐呭閫氳繃ASCII瀛楃娴?/strong>杩涜浼犺緭銆?/p>


4

 HTTP/1.0


1994骞翠綆寮€鍚嫧鍙蜂笂缃戯紝缃戞櫙涔熷湪鍚屽勾鎺ㄥ嚭浜嗙涓€娆炬祻瑙堝櫒锛屼汉浠涓囩淮缃戠殑闇€姹備笉鍐嶄粎灞€闄愪簬瀛︽湳浜ゆ祦銆?/p>


W3C鍜孒TTP宸ヤ綔缁?span>HTTP-WG涔熷湪杩欎釜鏃朵唬鍒涘缓銆備负浜嗘弧瓒充汉浠娴忚鍣ㄧ殑闇€姹?涓嶅厜鏄疕TML锛岃繕鏈塁SS銆丣S銆佸浘鐗囥€侀煶瑙嗛绛?锛屾枃浠舵牸寮忎笉鍐嶅眬闄愪簬ASCII缂栫爜銆?/p>


HTTP/1.0鐨勮В鍐冲姙娉曟槸寮曞叆浜?span>璇锋眰澶?/strong>鍜?span>鍝嶅簲澶?/strong>銆?/p>


accept: text/htmlaccept-encoding: gzip, deflate, braccept-Charset: ISO-8859-1,utf-8accept-language: zh-CN,zh


鍚屾椂涔熷紩鍏ヤ簡鐘舵€佺爜锛屼负浜嗗噺杞绘湇鍔″櫒鐨勫帇鍔涳紝鎻愪緵浜?span>Cache鏈哄埗銆傛湇鍔″櫒闇€瑕佺粺璁″鎴风鐨勫熀纭€淇℃伅(Windows 鍜?macOS)锛屽姞鍏ヤ簡鐢ㄦ埛浠g悊瀛楁銆?/p>


5

 HTTP/1.1


鏀硅繘鎸佷箙杩炴帴


涓€涓猅CP杩炴帴涓婂彲浠ヤ紶杈撳涓狧TTP璇锋眰锛屽彧瑕佹祻瑙堝櫒鎴栬€呮湇鍔″櫒娌℃湁鏂紑杩炴帴锛岃TCP浼氫竴鐩翠繚鎸併€?/p>


鎸佷箙杩炴帴鏄粯璁ゅ紑鍚殑锛屽鏋滄兂瑕佸叧闂紝鍦ㄨ姹傚ご涓姞涓?span>Connection:close鍗冲彲鍏抽棴銆?/p>


鐩墠娴忚鍣ㄤ腑瀵逛簬鍚屼竴涓煙鍚嶏紝榛樿鍏佽鍚屾椂寤虹珛6涓猅CP鎸佷箙杩炴帴銆?/p>


涓嶆垚鐔熺殑HTTP绠$嚎鍖?/span>


HTTP/1.1 涓瘯鍥鹃€氳繃绠$嚎鍖栫殑鎶€鏈潵瑙e喅闃熷ご闃诲鐨勯棶棰樸€備絾鏄洜涓哄悇绉嶅師鍥狅紝琚悇澶у巶鍟嗘斁寮冩不鐤椾簡銆?/p>


澧炲姞瀵硅櫄鎷熶富鏈虹殑鏀寔





澧炲姞瀵瑰姩鎬佺敓浜у唴瀹圭殑鏀寔


HTTP/1.0闇€瑕佸湪鍝嶅簲澶翠腑璁剧疆瀹屾暣鐨勬暟鎹ぇ灏?span>Content-Length锛?00锛岃繖鏍凤紝娴忚鍣ㄥ氨鍙互鏍规嵁璁剧疆鐨勬暟鎹ぇ灏忔潵鎺ユ敹鏁版嵁銆?/p>


鐢变簬鏈嶅姟鍣ㄧ鎶€鏈彂灞曪紝椤甸潰閮芥槸鍔ㄦ€佺敓鎴愮殑锛屼紶杈撴暟鎹箣鍓嶅苟涓嶇煡閬撴渶缁堟暟鎹ぇ灏忥紝瀵艰嚧娴忚鍣ㄤ笉鐭ラ亾浣曟椂浼氭帴鍙楀畬鎵€鏈夌殑鏂囦欢鏁版嵁銆?/span>


HTTP/1.1閫氳繃寮曞叆Chunk transfer鏈哄埗鏉ヨВ鍐抽棶棰橈紝鏈嶅姟鍣ㄥ皢鏁版嵁鍒嗗壊鎴愯嫢骞蹭釜浠绘剰澶у皬鐨勬暟鎹潡锛屾瘡涓暟鎹潡鍙戦€佹椂浼氶檮涓婁笂涓€涓暟鎹潡鐨勯暱搴︼紝鏈€鍚庝娇鐢ㄤ竴涓暱搴︿负0鐨勫潡浣滀负鍙戦€佹暟鎹畬鎴愮殑鏍囧織銆?/p>


瀹㈡埛绔疌ookie銆佸畨鍏ㄦ満鍒?/span>


HTTP1.1寮曞叆浜?span>瀹㈡埛绔疌ookie鏈哄埗鍜?span>瀹夊叏鏈哄埗銆?/p>


6

 HTTP/2.0



HTTP/1.1鐨勭己闄?/span>


瀵瑰甫瀹界殑鍒╃敤鐜囦笉鐞嗘兂锛?span class="mq-105">涓変釜闂瀵艰嚧锛?/span>


  • TCP 鐨勬參鍚姩

  • 鍚屾椂寮€鍚簡澶氭潯 TCP 杩炴帴锛岄偅涔堣繖浜涜繛鎺ヤ細绔炰簤鍥哄畾鐨勫甫瀹?/p>

  • HTTP/1.1 闃熷ご闃诲鐨勯棶棰?/p>


HTTP/2澶氳矾澶嶇敤


HTTP/2浣跨敤澶氳矾澶嶇敤鏈哄埗瑙e喅浜嗕笂杩伴棶棰樸€?/p>


涓€涓煙鍚嶅彧浣跨敤涓€涓?TCP 闀胯繛鎺ュ拰娑堥櫎闃熷ご闃诲闂銆傞€氳繃寮曞叆浜岃繘鍒跺垎甯у眰锛屽疄鐜颁簡 HTTP 鐨勫璺鐢ㄦ妧鏈€?/p>


HTTP/2鏈嶅姟鍣ㄦ帹閫?/span>


鏈嶅姟鍣ㄥ彲浠ユ彁鍓嶅皢鏁版嵁鎺ㄩ€佸埌娴忚鍣紝娴忚鍣ㄦ湁鏉冮€夋嫨鏄惁鎺ュ彈銆傛祻瑙堝櫒鍙戦€?span>RST_STREAM甯?/strong>鍙互閫夋嫨鎷掓敹銆?/p>


HTTP/2澶撮儴鍘嬬缉


澶撮儴鐨勫帇缂╁ぇ澶х殑鎻愬崌浜嗕紶杈撴晥鐜囥€侶TTP/2寮€鍙戜簡鈥淗PACK鈥濈畻娉曪紝鍦ㄥ鎴风鍜屾湇鍔″櫒寤虹珛鈥滃瓧鍏糕€濓紝鐢ㄧ储寮曞彿琛ㄧず閲嶅鐨勫瓧绗︿覆锛岃繕閲囩敤鍝堝か鏇肩紪鐮佹潵鍘嬬缉鏁存暟鍜屽瓧绗︿覆銆?/p>


HTTP/2鍙互璁剧疆璇锋眰鐨勪紭鍏堢骇


鍙互璁剧疆璁╂煇浜涢噸瑕佺殑鏁版嵁浼樺厛琚湇鍔″櫒澶勭悊骞惰繑鍥炪€?/p>


7

 HTTP/3.0


HTTP/2鐨勭己闄?/span>


TCP鐨勯槦澶撮樆濉?/span>


鍦?TCP 浼犺緭杩囩▼涓紝鐢变簬鍗曚釜鏁版嵁鍖呯殑涓㈠け鑰岄€犳垚鐨勯樆濉炵О涓?TCP 涓婄殑闃熷ご闃诲銆?/p>


HTTP/2鍙В鍐充簡搴旂敤灞傞潰鐨勯槦澶撮樆濉烇紝闃熷ご闃诲鐨勯棶棰樿繕瀛樺湪浜嶵CP鍗忚鏈韩銆?/p>


TCP寤虹珛杩炴帴鐨勫欢鏃?/span>


TCP浠ュ強TCP+TLS寤虹珛杩炴帴鐨勬墍浜х敓鐨勫欢鏃朵篃鏄奖鍝嶄紶杈撴晥鐜囩殑涓€涓富瑕佸洜绱犮€?/p>


TCP鍗忚鍍靛寲


涓棿浠跺兊鍖?/strong>


鎴戜滑鎶婂湪浜掕仈缃戠殑鍚勫鎼缓鐨勮澶囧彨鍋氫腑闂磋澶?涓棿浠?锛屾瘮濡傝矾鐢卞櫒銆丯AT銆侀槻鐏銆佷氦鎹㈡満绛夛紝瀹冧滑閫氬父渚濊禆涓€浜涘緢灏戝崌绾х殑杞欢锛岃繖浜涜蒋浠朵娇鐢ㄤ簡澶ч噺鐨?TCP 鐗规€э紝璁剧疆涔嬪悗渚垮緢灏戣繘琛屾洿鏂般€傝繖灏卞鎴戜滑鎴戜滑鏇存柊TCP鐨勬椂鍊欓€犳垚浜嗗緢澶х殑鍥伴毦锛?span class="mq-129">鏂板崗璁殑鏁版嵁鍖呯粡杩囪繖浜涗腑闂翠欢鏃讹紝瀹冧滑涓嶄細鍘荤悊瑙e寘鐨勫唴瀹逛粠鑰屼涪寮冩帀杩欎簺鏁版嵁鍖呫€?/span>


鎿嶄綔绯荤粺


鍥犱负 TCP 鍗忚閮芥槸閫氳繃鎿嶄綔绯荤粺鍐呮牳鏉ュ疄鐜扮殑锛屽簲鐢ㄧ▼搴忓彧鑳戒娇鐢ㄤ笉鑳戒慨鏀广€傞€氬父鎿嶄綔绯荤粺鐨勬洿鏂伴兘婊炲悗浜庤蒋浠剁殑鏇存柊锛屾墍浠ユ兂瑕佹洿鏂版搷浣滅郴缁熷唴鏍镐腑鐨凾CP鍗忚涔熸槸闈炲父鍥伴毦鐨勩€?/p>

QUIC鍗忚

HTTP/3 閫夋嫨浜嗕竴涓姌琛风殑鏂规硶鈥斺€擴DP 鍗忚锛?span>鍩轰簬 UDP 瀹炵幇浜嗙被浼间簬 TCP 鐨勫璺暟鎹祦銆佷紶杈撳彲闈犳€х瓑鍔熻兘锛屾垜浠妸杩欏鍔熻兘绉颁负QUIC 鍗忚銆?/p>


  • 瀹炵幇浜嗙被浼?TCP 鐨勬祦閲忔帶鍒躲€佷紶杈撳彲闈犳€х殑鍔熻兘

  • 闆嗘垚浜?TLS 鍔犲瘑鍔熻兘

  • 瀹炵幇浜?HTTP/2 涓殑澶氳矾澶嶇敤鍔熻兘

  • 瀹炵幇浜嗗揩閫熸彙鎵嬪姛鑳?/p>


鍏充簬HTTP/3鏇村璇︾粏鐨勫唴瀹癸紝璇风Щ姝ユ垜缈昏瘧鐨勪腑鏂囩増鏈琀TTP/3璇﹁В銆?/p>


HTTP/3璇﹁В涓枃鐗?/p>

https://hungryturbo.com/HTTP3-explained/


娆㈣繋Star鍜屾彁鍑洪敊璇垨涓嶅鐨勫湴鏂广€?/span>


浠撳簱閾炬帴

https://github.com/Geekhyt/HTTP3-explained

缁撹

銆屸潳锔忓叧娉?鐐硅禐+鏀惰棌+璇勮+杞彂鉂わ笍銆?/strong>锛屽師鍒涗笉鏄擄紝榧撳姳绗旇€呭垱浣滄洿濂界殑鏂囩珷

  • 鍏虫敞鍚庡洖澶? 鍏抽敭璇?/code>鍏嶈垂棰嗗彇瑙嗛鏁欑▼
  • 鍏虫敞鍚庢坊鍔? 鎴戝井淇?/code>鎷変綘杩涙妧鏈氦娴佺兢
  • 娆㈣繋鍏虫敞 IQ鍓嶇锛屾洿澶? 銆孋SS/JS寮€鍙戞妧宸с€?/strong>鍙湪鍏紬鍙锋帹閫?





以上是关于HTTP鐨勪笘鐣岃的主要内容,如果未能解决你的问题,请参考以下文章

浣犺窛绂?WebGL 鍙樊涓€鐐癸紒

浠庢簮鐮佸垎鏋?MyBatis缂撳瓨 宸ヤ綔鍘熺悊

鍨冨溇鍥炴敹鍣細浣犳槸浠€涔堝瀮鍦撅紵

浜戝師鐢熸妧鏈細楂樺彲鐢↘ubernetes闆嗙兢

娴侀噺寮曞锛氱綉缁滀笘鐣岀殑璐熻浇鍧囪 瑙e瘑 | Linux 涓浗

(c)2006-2024 SYSTEM All Rights Reserved IT常识