File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323- In the ` handleRequest ` method, to the ` Request ` is attached a ` Response ` object (see below) that will serve the response data back to the client
2424- When the ` Response ` is sent, the client is closed and freed from the memory
2525
26+ ``` mermaid
27+ flowchart TD
28+ A([TCP Connection]) --> B[New AsyncWebServerRequest]
29+ B --> C["Parse request line\nMETHOD · URL · GET params · HTTP/version"]
30+ C --> D[Parse headers line by line]
31+ D --> E["Apply Rewrites in order\nAll matching rewrites applied sequentially\nEach can rewrite URL and/or inject params"]
32+ E --> F["Attach Handler\nIterate handlers in order added:\nfilter() → canHandle()\nFirst match wins · fallback to catch-all"]
33+ F --> G{Body or upload?}
34+ G -- "Content-Length > 0\nor chunked transfer" --> H["Receive body / file upload\nhandleBody() · handleUpload()"]
35+ H --> I
36+ G -- no --> I([PARSE_REQ_END])
37+
38+ I --> J{mustSkipServerMiddlewares?}
39+ J -- "no (default)" --> K["Server Middlewares\nexecuted in order added\neach can call next() or short-circuit"]
40+ J -- "yes (skipServerMiddlewares)" --> L
41+ K -- "next()" --> L["Handler Middlewares\nexecuted in order added\neach can call next() or short-circuit"]
42+ K -- "short-circuit" --> N
43+ L -- "next()" --> M["handleRequest()\nattach Response object"]
44+ L -- "short-circuit" --> N
45+ M --> N["_send()\nwrite response to client asynchronously"]
46+ N --> O([Close connection · free memory])
47+ ```
48+
2649### Rewrites and how do they work
2750
2851- The ` Rewrites ` are used to rewrite the request url and/or inject get parameters for a specific request url path.
Original file line number Diff line number Diff line change @@ -27,7 +27,11 @@ theme:
2727markdown_extensions :
2828 - admonition
2929 - pymdownx.details
30- - pymdownx.superfences
30+ - pymdownx.superfences :
31+ custom_fences :
32+ - name : mermaid
33+ class : mermaid
34+ format : !!python/name:pymdownx.superfences.fence_code_format
3135 - pymdownx.highlight :
3236 anchor_linenums : true
3337 line_spans : __span
You can’t perform that action at this time.
0 commit comments