Files
marqdo/ext/net/http.mq.md
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

3.0 KiB
Executable File

markup, title, description, import
markup title description import
occlusion ext/net/http HTTP primitives surface for Web Runtime (ADR 0007). Prefer Document/Endpoint Artifacts over raw calls.
plugin sys
lib/plugin.mq.md lib/sys.mq.md

This file constructs application Result records and binds explicit server redirects; it does not implement an HTTP client. For real HTTP requests, response limits and downloads, import lib/net.mq.md. The network entry distinguishes pure URL transformations from native WebSocket exchanges. Keep these responsibilities explicit when extending the package so a readable tool name never implies a missing capability.

_load

返回 类型 说明
result any No business value on completion; a missing native plugin reports the cause and exits this run.

Resolve and load the native web plugin before resource operations; missing binaries stop this run.

We retain p = Locate the installed native plugin.

  1. p We Load the native plugin required by this operation.

We [Print the prepared message](print(text="ext/net: native web plugin not found")). We End this run with the selected exit status. Return None.

result

参数 类型 默认 说明
ok any required Whether this application-level operation succeeded
value any None Value supplied to this operation; immutable transformations return a new value
error any None Structured failure information supplied by the caller
返回 类型 说明
result any Unified Result map {ok, value, error}.

Use ok, value=None, error=None as the inputs for this operation.

Unified Result map {ok, value, error}.

out =

ok value error
ok value error

Return out.

redirect

参数 类型 默认 说明
app any required Prepared web application
from text required Explicit source route
to text required Redirect destination
permanent bool False False uses a temporary redirect; True uses the native permanent status
返回 类型 说明
result map Updated app with the declared server redirect

Use app, from, to and permanent=False before web.listen. This is a server route policy owned by the network resource, not a client-side history operation. Keep the returned app because binding produces a new value. Redirecting a legacy entry path can coexist with Document and Endpoint discovery without rebuilding the application through removed configure methods. The native runtime validates declared source paths. No listener starts here, and constructing a redirect does not verify that its destination page exists.

We Load the existing native HTTP runtime. Return [Bind this declared HTTP redirect](web_app_redirect(app=app, from=from, to=to, permanent=permanent)).