Files
marqdo/lib/网络.mq.md
T
cflmyandCursor e7c9c21a49 ext/web W4c: SEO meta, Markdown render, RSS, pagination UI
Add lib/net markdown_parse, page.meta/paginate and app.route_rss author
APIs, GFM Markdown article bodies, head SEO tags, list pagination nav, and
RSS 2.0 feed routes — keeping tables + class methods as the author surface.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-28 09:46:16 +08:00

2.1 KiB
Raw Blame History

title, description
title description
lib/网络 中文 HTTP(S) 包装。可选 headers / content_type 经宿主别名绑定。

获取

+ `地址`
+ `headers`=None

支持 HTTPS。可选具名实参 headers=(映射)。

> host_http_get url=地址 headers=headers

提交

+ `地址`
+ `内容`
+ `content_type`=None
+ `headers`=None

默认 Content-Type 为 JSON。可选 content_type= / headers=。

> host_http_post url=地址 body=内容 content_type=content_type headers=headers

提交流式

+ `地址`
+ `内容`
+ `content_type`=None
+ `headers`=None
+ `打印增量`=False

POST 并消费 OpenAI 兼容 SSE。返回 {status, events}(delta / done / error)。打印增量=真 时边读边打印增量文本。

> host_http_post_sse url=地址 body=内容 content_type=content_type headers=headers echo=打印增量

解析流式

+ `内容`
+ `打印增量`=False

离线解析 OpenAI 聊天 SSE 正文为事件列表(不联网)。

> host_openai_sse_parse text=内容 echo=打印增量

请求

+ `方法`
+ `地址`
+ `body`=None
+ `content_type`=None
+ `headers`=None

可选 body= / content_type= / headers=。

> host_http_request method=方法 url=地址 body=body content_type=content_type headers=headers

编码地址

+ `内容`

> host_url_encode text=内容

解析Cookie

+ `内容`
+ `是响应头`=False

解析 Cookie 请求头(默认)或一个/多个 Set-Cookie 响应头(是响应头=真)为 {name, value, path, domain, expires, max_age, secure, http_only, same_site} 列表。

> host_cookie_parse text=内容 is_response=是响应头

解析多部分

+ `正文`
+ `边界`

解析 multipart/form-data 请求体(给定 boundary)为 {name, filename?, content_type?, value} 部件列表。

> host_multipart_parse body=正文 boundary=边界

解析Markdown

+ `文本`

将 Markdown / GFM 解析为 HTML(纯转换,无网络 I/O)。

> host_markdown_parse text=文本