6. HttpKernel堆栈

HttpKernel 龣龢龡龠龝龛龚龖龒龐龍龉龇龃龀齾http齺齹齶齳齱齯齬齪齨齧齺齹齣齢齡齟龉齯龇齝齛齘齕齣齢齯齓齒http齐齎齌齉齅龇齂齁鼾鼺鼶龣鼵鼴鼲龃齌齉齅齯鼯鼬鼪齕鼦鼢鼟鼞齁齘齕鼚鼘鼖齓鼒鼐鼌鼉鼆鼅鼄鼂黿黻齶黷黴黰齯龣黭黪黩齓 HttpKernel 齶黨鼦symfony龣黚黗黔鼺 HttpKernel 黓黐齯黍鼉 \vendor\symfony\http-kernel\HttpKernelInterface 齯鼯drupal8鼢麰麬HttpKernel黗黔鼐麫麧麣齨鼬麟麜黓黐齯鼯Druapl8鼢 HttpKernel 齣齢麔麒齬麬齓麎齯麋龃麬麈麎齯麅麁鼉鹽鹺鹷齯龝齅鹵鹱鹭齒鹩鹧齯鹦鹢鹠鹞齶黍鼉鹽鹺齅鹚齯龝鹙鹚鹕鹑鹩鹧齯齅鹚鹏鼦鹱鹚齯鹎鼾齓麎鼐鼌鹊鹉鹇鼅齶龀齾鹃鹁齯鸾鹵麬齘齕齣齢鸻鸸鸵鸳鸰齯鹱鹚齶 HttpKernel 龖鸯麒鸮鹩鹧齯鹱鸭鸫鸧鸥齓鸥鸢麎鹃鹁鸟

HttpKernel堆栈是怎么产生的

鼯drupal8鼢齧鹽鹺鹷鸭齶 HttpKernel 齣齢鸞鸚龣 http_middleware 鼶http鼢鸔鸑黰齯鹽鹺鼉鸏鸍鸊鸇鸆鸅鸄鸀鷽黗鼶鸊鸇鼯 Drupal\Core\DrupalKernel 鼢鹎鼾黰齯齣黚鹽鹺齶鸆鸅鹃鹁黗黔鼯 \core\lib\Drupal\Core\DependencyInjection\Compiler\StackedKernelPass.php 齯鼯鸆鸅鸊鸇齶鷪鷨鸢麎 CompilerPass 鷦鷢麰麬鸮鷡鷝龣 http_middleware 齶鸏鸍鼶鸢鷛齶鸏鸍麧麣鼬麟 HttpKernelInterface 黓黐黰齯麔鹭鷚鹦鹢鹠鷗鹧鷕鷒齯鷏鷎鹞鹦鹢鹠齶 HttpKernel 鷌鸢麎鷕鷉鷒齶鼂鷇鷄鷃黻龣鹽鹺鷂齾齣齢 StackedHttpKernel 齶鶿齓鷌鶿鶽麎鶻鼂齯鼯鸊鸇鼢 $Container->get('http_kernel') 鶩龍 http_kernel 鸏鸍齶鷪鷨鶩龍齶龇龃鸢麎鹽鹺鷂齾齣齢鼺齯鸢鹷鶨鶥鶣齓鹱鶠龢黗黔鹽鹺鼢齶 HttpKernel 鸏鸍齯麜鸏鸍麧麣鼬麟 HttpKernel 黓黐齯麔鷡鷝龣 http_middleware 齯鶟鶜龖龒鶚鶙 priority 鼶鹦鹢鹠齯鶖麬鶚鶙鶒鶑龣0黰鶌 responder 鼶齘齕鸇齯鸯鸻鸸齘齕齣齢鷪鶚鶙龣鶊黰齯鶆鶠鶅鸭鶃麁 HttpKernel 鸏鸍齶黗黔鶠鹱鵿

鹽鹺鹷鸭齶 HttpKernel 齣齢麒齓黗鼘鸻鸸齘齕齯龉龖鸯齬龃鵽鵹鶚鶙齓鹱齺齹齣齢齯鵶龖鸯鷗鹧齓鼒鵳鸯齯齺齹齣齢鼘鹭齒龝鹞鹚齡鵱鹵鵰鹚鸟黚鶜鼦鵯鵶龖龒鼯鵬鵪齶鵦鵢鼢黗黔 HttpKernel 齣齢齯鹞鹦鹢鹠齶 HttpKernel 龖龒鼢鵟鵝鵰鹦鹢鹠 HttpKernel 齶鹩鹧鸟

services:  
  http_middleware.page_cache:  
    class: Drupal\page_cache\StackMiddleware\PageCache  
    arguments: ['@cache.render', '@page_cache_request_policy', '@page_cache_response_policy']  
    tags:  
      - { name: http_middleware, priority: 200, responder: true }  

鹱鸭鵚鵙龐齓龐鶒鶑齶drupal8鵘鵗鵔鹽鹺鹷麫麬鵒鼒龀齾齳齱齯龣鶥鼉齾鵎鵚鵍鼺齓鵋鵉鵇鵄鵿

鵂鹑鵘鵗齶Drupal8鶒鶑麬7麎龀齾齳齱齯鹭鷚鹦鹢鹠齯龉鵙鼯鹽鹺鼢鹎鼾7麎鹚齯鴾齅鹚鹦鹢鹠鴾鹞齯鴻齅鴷鹱鹭齒鹩鹧 HttpKernel handle() 鴶鴵齯鸢鼒 HttpKernel 龖鴲鴰齶鼬麟 TerminableInterface 黓黐齯鶠鴩鼬麟齯龉鵙齶 terminate() 鴶鴵鵶龃龝齅鹵鹱鹭齒鹩鹧齯鴦麎鹽鹺齶鼬麟龖龒龐齓龐 StackedHttpKernel 鼐齶鼬麟齯黍鼉 \vendor\stack\builder\src\Stack\StackedHttpKernel.php 齯鹱鸭鷄鷃龐齓龐鸢7麎 HttpKernel 麫鴢鼺鼵鼴鵿


1鵿 http_middleware.negotiation Drupal\Core\StackMiddleware\NegotiationMiddleware
鼦鼉鷗鹧鴖鸊鴒鴎齯龉鼘鼯齺齹齣齢鹷鸭鶚鶙齺齹齶鴊鹉齯鴇鵔鹏鼦鹱齓鹚齶handle()鴶鴵龃龉齶鴆鴄鸟


2鵿 http_middleware.reverse_proxy Drupal\Core\StackMiddleware\ReverseProxyMiddleware
龣齺齹齣齢鳺鳶鳵鳲鳯齾鼂鷚齯麜鼂鷚龖龒黗黔鼯鳫鳪鳦鶙鳥鸑settings.php鼢鸟


3鵿 ban.middleware Drupal\ban\BanMiddleware
龉龇龃鷂齾鵔鳞/鳙鳘鵦鵢鹷鸭齶Ban鵦鵢齯龉鳗鳔鼂鷚鳐鳌鳊麒鳉鳈齐齎鳫鳪齶IP齯鶠鴩龃鳅鸰齶ip鳁鸳鵟鹱鹚HttpKernel齶龀齾齯齟龍鴖鸊龣鲿鲻齐齎齶齘齕齣齢齯鶠鴩鲸鲴鲳鲰鲭鲩鵦鵢鹕鼟齯鲧鼴齳齱齶Ban鵦鵢龃鲤鷉齶鲠鹁齯鹷鸭麬鸏鸍黗黔鶌鲞鲜黗黔鶌鲘鲗黗黔鶌鲓鲗黗黔鶌鼂鷚鳐鲏黻鶌鲌鴻黗黔鲊鲊齯龉龖龒鼾龣鲸鲇鲃齶鶿齓麎鵦鵢鹕鼟鱿鱾鸟


4鵿 http_middleware.page_cache Drupal\page_cache\StackMiddleware\PageCache
鶃麁鹚齯鱻鷚齺齹齣齢鳗鱹龃鱵麬鶃麁齶鼂鷚齯麬鳁鸾黓鸻鸸齘齕齯鱵鳁鱳鱰鹱鹚齶龀齾齯麔齧龖鶃麁齶齘齕鶃麁鱯鱭鱫龒鵔黨鼦齯龉鱨鼬龇龃鷂齾鵔鳞/鳙鳘鵦鵢鹷鸭齶 Internal Page Cache 鵦鵢齯鶒鶑龃麒鸯鱧鱥齶鸟


5鵿 http_middleware.kernel_pre_handle Drupal\Core\StackMiddleware\KernelPreHandle
齣齺齹鷗鹧鱞龀齾齯鲸鵶鳈鱛鱗鱖鱔鹃 DrupalKernel 鼐齶鳯鱓鼺齯鱐鷪龖鸯鲸鱌鱊鹷鸭齶 preHandle 鴶鴵龃鼵鼴鷪鷨鹏鼦齶齯鶖鱈齯龇龃鸢麎 HttpKernel 鹚齶黿黻齯龉鱇鱄 \core\includes 鹷鸭齶鳈麈鼄鼂鳐鶌鱇鱄鵦鵢鼄鼂鳐鶌鳺鱀鰼鰺鵗鸇鶌鰹鰷齺齹鹽鹺鲊鲊齯鸢麎鹚鰶鰶龣鹱鹚齶龀齾鷗鹧鳈麈鰴鰰黿黻鸟


6鵿 http_middleware.session Drupal\Core\StackMiddleware\Session
session 鰩黩龇龃鸢麎鷪鷨鰧鰤齶齯麔鷏 session 齣齢鳺鳶鼺鰠齺齹齣齢鼢齯鶥鼉鵔鱰黨鼦鸟


7鵿 http_kernel.basic Symfony\Component\HttpKernel\HttpKernel
鰧鰤 Symfony齶 HttpKernel 齯鹕鹑鷗鹧鷎鹷鹚齶齺齹鰞龣齘齕鹃鹁齯鰛鰘鼚鼯鱳鱰鸟

鷉鼺齯鸢龇龃 HttpKernel 鹽鹺齶鹇鼅鷌鰼鹁鰗齾齯龉龃鵬鸏鸍鸊鸇龒鱭齶鰓齓齌鰐鸟

http处理核心堆栈层级图

本书共63小节:

评论 (写第一个评论)