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处理核心堆栈层级图

本书共88小节:

评论 (写第一个评论)