Files
core/lib/doc/dever-http-value.md
T
2026-11-03 03:32:07 +00:00

67 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# HTTP 数据结构
请求、响应、HTTP 头及协议限额。
## dever.http.Header
HTTP 头的名称和原始字节值。
字段:
- `name`:HTTP 头名称
- `value`:未经文本转换的头部字节
## dever.http.Request
HTTP 请求的方法、目标路径、头和完整正文。
字段:
- `method`:请求方法,例如 GET
- `target`:路径及查询字符串
- `headers`:请求头,保留同名字段
- `body`:完整请求正文字节
## dever.http.Response
HTTP 响应的状态码、头和完整正文。
字段:
- `status`:HTTP 状态码
- `headers`:响应头,保留同名字段
- `body`:完整响应正文字节
## dever.http.Limits
请求头、正文、请求期限和并发连接限制;http2=null 表示不启用 HTTP/2。
字段:
- `header_bytes`:请求头的字节上限
- `body_bytes`:请求正文的字节上限
- `timeout_ms`:请求期限;HTTP/2 服务连接在没有活动请求或响应流时,也按此期限回收。关闭握手最多再等待一个相同期限。
- `connections`:并发连接上限
- `http2`:HTTP/2 配置,null 表示关闭
## dever.http.Http2Limits
HTTP/2 的并发流数、单流窗口和连接窗口配置。
字段:
- `streams`:单连接的并发流上限
- `stream_window_bytes`:单流接收窗口,单位为字节
- `connection_window_bytes`:连接接收窗口,单位为字节
## dever.http.ResponseResult
完整响应或请求失败原因。
分支:
- `Read(response: Response)`:成功响应
- `error Failed(message: Text)`:失败原因
## dever.http.defaultLimits
默认限制:8 KiB 请求头、1 MiB 正文、5 秒期限、32 个连接,不启用 HTTP/2。
## dever.http.defaultHttp2Limits
默认 HTTP/2 配置:16 个流,单流窗口 65535 字节,连接窗口 262144 字节。